Skip to content
This repository was archived by the owner on Sep 23, 2025. It is now read-only.

Conversation

@codysoyland
Copy link
Contributor

This code caused the singleton trustedRoot to be returned as nil on subsequent calls. The singleton was shadowed when the variable was redeclared in the if block:

-trustedRoot, err := root.NewTrustedRootFromJSON(targetBytes)
+trustedRoot, err = root.NewTrustedRootFromJSON(targetBytes)

Additionally, this PR removes some unused code managing a singleton error.

Fixes #177

This code caused the singleton `trustedRoot` to be returned as nil on subsequent calls. The singleton was shadowed when the variable was redeclared in the `if` block.

Signed-off-by: Cody Soyland <codysoyland@github.com>
`singletonRootError` was never returned without being overwritten, so it was essentially unused. I think it's wise to always retry the TUF call on future invocations in case of network errors.

Signed-off-by: Cody Soyland <codysoyland@github.com>
@codysoyland codysoyland requested review from a team and steiza as code owners September 17, 2024 21:34
@codysoyland codysoyland requested review from malancas and removed request for a team and steiza September 17, 2024 21:36
@codysoyland codysoyland merged commit 4db97ca into release Sep 17, 2024
12 of 69 checks passed
codysoyland added a commit that referenced this pull request Oct 10, 2024
* Fix shadowed variable bug

This code caused the singleton `trustedRoot` to be returned as nil on subsequent calls. The singleton was shadowed when the variable was redeclared in the `if` block.

Signed-off-by: Cody Soyland <codysoyland@github.com>

* Remove unused singleton

`singletonRootError` was never returned without being overwritten, so it was essentially unused. I think it's wise to always retry the TUF call on future invocations in case of network errors.

Signed-off-by: Cody Soyland <codysoyland@github.com>

---------

Signed-off-by: Cody Soyland <codysoyland@github.com>
codysoyland added a commit that referenced this pull request Nov 18, 2024
* Fix shadowed variable bug

This code caused the singleton `trustedRoot` to be returned as nil on subsequent calls. The singleton was shadowed when the variable was redeclared in the `if` block.

Signed-off-by: Cody Soyland <codysoyland@github.com>

* Remove unused singleton

`singletonRootError` was never returned without being overwritten, so it was essentially unused. I think it's wise to always retry the TUF call on future invocations in case of network errors.

Signed-off-by: Cody Soyland <codysoyland@github.com>

---------

Signed-off-by: Cody Soyland <codysoyland@github.com>
codysoyland added a commit that referenced this pull request Jan 7, 2025
* Fix shadowed variable bug

This code caused the singleton `trustedRoot` to be returned as nil on subsequent calls. The singleton was shadowed when the variable was redeclared in the `if` block.

Signed-off-by: Cody Soyland <codysoyland@github.com>

* Remove unused singleton

`singletonRootError` was never returned without being overwritten, so it was essentially unused. I think it's wise to always retry the TUF call on future invocations in case of network errors.

Signed-off-by: Cody Soyland <codysoyland@github.com>

---------

Signed-off-by: Cody Soyland <codysoyland@github.com>
codysoyland added a commit that referenced this pull request Mar 27, 2025
* Fix shadowed variable bug

This code caused the singleton `trustedRoot` to be returned as nil on subsequent calls. The singleton was shadowed when the variable was redeclared in the `if` block.

Signed-off-by: Cody Soyland <codysoyland@github.com>

* Remove unused singleton

`singletonRootError` was never returned without being overwritten, so it was essentially unused. I think it's wise to always retry the TUF call on future invocations in case of network errors.

Signed-off-by: Cody Soyland <codysoyland@github.com>

---------

Signed-off-by: Cody Soyland <codysoyland@github.com>
codysoyland added a commit that referenced this pull request Apr 10, 2025
* Fix shadowed variable bug

This code caused the singleton `trustedRoot` to be returned as nil on subsequent calls. The singleton was shadowed when the variable was redeclared in the `if` block.

Signed-off-by: Cody Soyland <codysoyland@github.com>

* Remove unused singleton

`singletonRootError` was never returned without being overwritten, so it was essentially unused. I think it's wise to always retry the TUF call on future invocations in case of network errors.

Signed-off-by: Cody Soyland <codysoyland@github.com>

---------

Signed-off-by: Cody Soyland <codysoyland@github.com>
jkylekelly pushed a commit that referenced this pull request Jul 24, 2025
Signed-off-by: Cody Soyland <codysoyland@github.com>

Sync TUF cache used for sigstore bundle verification (#166)

* sync tuf cache used for sigstore bundle verification

Signed-off-by: Meredith Lancaster <malancas@github.com>

* remove singleton err

Signed-off-by: Meredith Lancaster <malancas@github.com>

* start adding lock

Signed-off-by: Meredith Lancaster <malancas@github.com>

* Use RWMutex

Signed-off-by: Meredith Lancaster <malancas@github.com>

* pr feedback

Signed-off-by: Meredith Lancaster <malancas@github.com>

---------

Signed-off-by: Meredith Lancaster <malancas@github.com>

Fix shadowed trustedroot (#178)

* Fix shadowed variable bug

This code caused the singleton `trustedRoot` to be returned as nil on subsequent calls. The singleton was shadowed when the variable was redeclared in the `if` block.

Signed-off-by: Cody Soyland <codysoyland@github.com>

* Remove unused singleton

`singletonRootError` was never returned without being overwritten, so it was essentially unused. I think it's wise to always retry the TUF call on future invocations in case of network errors.

Signed-off-by: Cody Soyland <codysoyland@github.com>

---------

Signed-off-by: Cody Soyland <codysoyland@github.com>

Update go.mod

Signed-off-by: Cody Soyland <codysoyland@github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

controller crashes with segmentation violation error when retrying to run an admissible pod

3 participants