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

GetIssuer just panics rather than issuing a useful error when there's no networking #480

Closed
06kellyjac opened this issue Mar 16, 2022 · 2 comments · Fixed by #587
Closed
Labels
bug Something isn't working

Comments

@06kellyjac
Copy link

Description

GetIssuer panics when there's no network access

https://github.com/sigstore/fulcio/blob/v0.2.0/pkg/config/config_test.go#L104

PASS
ok      github.com/sigstore/fulcio/pkg/challenges       0.270s
=== RUN   TestMetaURLs
=== RUN   TestMetaURLs/AWS_meta_URL
=== RUN   TestMetaURLs/GKE_meta_URL
--- PASS: TestMetaURLs (0.00s)
    --- PASS: TestMetaURLs/AWS_meta_URL (0.00s)
    --- PASS: TestMetaURLs/GKE_meta_URL (0.00s)
=== RUN   TestLoad
--- FAIL: TestLoad (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x753673]

goroutine 9 [running]:
testing.tRunner.func1.2({0x79cc00, 0xada640})
        testing/testing.go:1209 +0x24e
testing.tRunner.func1()
        testing/testing.go:1212 +0x218
panic({0x79cc00, 0xada640})
        runtime/panic.go:1038 +0x215
github.com/sigstore/fulcio/pkg/config.(*FulcioConfig).GetIssuer(0x0, {0x7fea68, 0x1b})
        github.com/sigstore/fulcio/pkg/config/config.go:85 +0x93
github.com/sigstore/fulcio/pkg/config.TestLoad(0xc0000b9860)
        github.com/sigstore/fulcio/pkg/config/config_test.go:104 +0x165
testing.tRunner(0xc0000b9860, 0x814b28)
        testing/testing.go:1259 +0x102
created by testing.(*T).Run
        testing/testing.go:1306 +0x35a
FAIL    github.com/sigstore/fulcio/pkg/config   0.006s

To reproduce

  1. have the repo
  2. run go mod vendor so we have the dependencies available
  3. docker run -v $PWD:/fulcio --network=none -it golang
  4. cd /fulcio and go test ./... -v

Remediation

There should probably be an error that's more useful than a panic

Also it'd be nice for all tests that require networking to be tagged so we can avoid them within our hermetic nix build environment that doesn't have network access 🙂

@06kellyjac 06kellyjac added the bug Something isn't working label Mar 16, 2022
@06kellyjac
Copy link
Author

bump

@nsmith5
Copy link
Contributor

nsmith5 commented May 11, 2022

Oh dang that is lame. Thanks for the bug report! I think this test is triggering OIDC discover and making a network call because of it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants