Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protect against go-uefi panics #113

Merged
merged 1 commit into from
May 14, 2024
Merged

Protect against go-uefi panics #113

merged 1 commit into from
May 14, 2024

Conversation

Itxaka
Copy link
Member

@Itxaka Itxaka commented May 14, 2024

Seems that when things go wrong with go-uefi listing the certs it panics instead of returning an error.

try to catch that and return normally as this data is optional and we dont want to stop the execution of the state due to this

@Itxaka Itxaka requested a review from a team May 14, 2024 07:58
Copy link

codecov bot commented May 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 53.18%. Comparing base (d16d672) to head (4336d33).

❗ Current head 4336d33 differs from pull request most recent head 7fb3bad. Consider uploading reports for the commit 7fb3bad to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #113   +/-   ##
=======================================
  Coverage   53.18%   53.18%           
=======================================
  Files          16       16           
  Lines        1115     1115           
=======================================
  Hits          593      593           
  Misses        424      424           
  Partials       98       98           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Itxaka
Copy link
Member Author

Itxaka commented May 14, 2024

no, this is not working because they EXIT directly, crap

@jimmykarily
Copy link
Contributor

Maybe try to fix it upstream by returning an error instead of panicing: https://github.com/Foxboron/go-uefi/blob/48be911532c2b39532bd26b01f425530b8e33244/efi/signature/signature_list.go#L306 ?

That function can already return errors, I wonder why it should ever panic.

@mudler
Copy link
Member

mudler commented May 14, 2024

no, this is not working because they EXIT directly, crap

ouch, but I'd say it is safe to add a recover statement nevertheless as it is a very delicate portion of the stack

@Itxaka
Copy link
Member Author

Itxaka commented May 14, 2024

just gonna disable it as this its needed NOW, will submit patches after

@Itxaka Itxaka requested review from mudler and a team May 14, 2024 08:21
seem like go-uefo calls os.exit directly if something fails instead of
either panicking (which is recoverable) or returning an error(so the
caller can act on that)

Disable this for now until we get a proper error handling submitted
upstream

Signed-off-by: Itxaka <itxaka@kairos.io>
@Itxaka Itxaka merged commit c643cb5 into main May 14, 2024
7 of 8 checks passed
@Itxaka Itxaka deleted the fix_state_certs branch May 14, 2024 08:24
renovate bot referenced this pull request in kairos-io/provider-kairos May 15, 2024
)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[github.com/kairos-io/kairos-sdk](https://togithub.com/kairos-io/kairos-sdk)
| `v0.1.5` -> `v0.1.6` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fkairos-io%2fkairos-sdk/v0.1.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fkairos-io%2fkairos-sdk/v0.1.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fkairos-io%2fkairos-sdk/v0.1.5/v0.1.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fkairos-io%2fkairos-sdk/v0.1.5/v0.1.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>kairos-io/kairos-sdk
(github.com/kairos-io/kairos-sdk)</summary>

###
[`v0.1.6`](https://togithub.com/kairos-io/kairos-sdk/releases/tag/v0.1.6)

[Compare
Source](https://togithub.com/kairos-io/kairos-sdk/compare/v0.1.5...v0.1.6)

#### What's Changed

- Protect against go-uefi panics by
[@&#8203;Itxaka](https://togithub.com/Itxaka) in
[https://github.com/kairos-io/kairos-sdk/pull/113](https://togithub.com/kairos-io/kairos-sdk/pull/113)

**Full Changelog**:
kairos-io/kairos-sdk@v0.1.5...v0.1.6

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 11pm every weekday,before 7am
every weekday,every weekend" in timezone Europe/Brussels, Automerge - At
any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/kairos-io/provider-kairos).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNTEuMiIsInVwZGF0ZWRJblZlciI6IjM3LjM1MS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
mauromorales added a commit that referenced this pull request May 23, 2024
mauromorales added a commit that referenced this pull request May 23, 2024
* Bump go-uefi to include panic fix

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>

* Revert "Disable certs list in state (#113)"

This reverts commit c643cb5.

---------

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants