Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(coderd/provisionerdserver): prevent NPE if no user link exists#15289

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
johnstcn merged 3 commits intomainfromcj/fix-provisionerd-panic
Oct 30, 2024

Conversation

johnstcn
Copy link
Member

@johnstcnjohnstcn commentedOct 30, 2024
edited
Loading

This happend to@timquinlan and myself when we tried manually converting an OIDC user to password login type. We had updated the user row directly in the database without removing the correspondinguser_link. We then created some provisioner jobs, which caused Coder (v2.15.3+6f68315) to panic with the following:

panic: runtime error: invalid memory address or nil pointer dereference[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x2222501]goroutine 566 [running]:github.com/coder/coder/v2/coderd.(*OIDCConfig).TokenSource(0x14ec6a30?, {0x96cdb10?, 0xc0134cf3e0?}, 0x27286230?)        <autogenerated>:1 +0x21github.com/coder/coder/v2/coderd/provisionerdserver.obtainOIDCAccessToken({0x96cdb10, 0xc0134cf3e0}, {0x9743df8, 0xc000ec87e0}, {0x96c7740, 0x0}, {0x47, 0x4d, 0xca, 0x46, ...})        /home/runner/work/coder/coder/coderd/provisionerdserver/provisionerdserver.go:2024 +0x322github.com/coder/coder/v2/coderd/provisionerdserver.(*server).acquireProtoJob(_, {_, _}, {{0x86, 0x61, 0x84, 0xd, 0x1f, 0xc2, 0x44, ...}, ...})        /home/runner/work/coder/coder/coderd/provisionerdserver/provisionerdserver.go:503 +0x20fegithub.com/coder/coder/v2/coderd/provisionerdserver.(*server).AcquireJobWithCancel(0xc01346d380, {0x96dd800, 0xc000968e40})        /home/runner/work/coder/coder/coderd/provisionerdserver/provisionerdserver.go:390 +0xb9agithub.com/coder/coder/v2/provisionerd/proto.DRPCProvisionerDaemonDescription.Method.func2({0x2de0c20?, 0xc01346d380}, {0xc000bcffc0?, 0x34?}, {0x2e33760?, 0xc0133f26c8}, {0x54d0b4?, 0x96cd608?})        /home/runner/work/coder/coder/provisionerd/proto/provisionerd_drpc.pb.go:197 +0x134storj.io/drpc/drpcmux.(*Mux).HandleRPC(0x30?, {0x96d6be0, 0xc0133f26c8}, {0xc000bcffc0, 0x34})        /home/runner/go/pkg/mod/storj.io/drpc@v0.0.33/drpcmux/handle_rpc.go:33 +0x207github.com/coder/coder/v2/coderd/tracing.(*DRPCHandler).HandleRPC(0xc000778da0, {0x96d6be0, 0xc0133f26c8}, {0xc000bcffc0, 0x34})        /home/runner/work/coder/coder/coderd/tracing/drpc.go:23 +0x1bbstorj.io/drpc/drpcserver.(*Server).handleRPC(0xc013461dc0?, 0xc0133f26c8, {0xc000bcffc0?, 0xb0b7d00?})        /home/runner/go/pkg/mod/storj.io/drpc@v0.0.33/drpcserver/server.go:124 +0x36storj.io/drpc/drpcserver.(*Server).ServeOne(0xc000b62000, {0x96d1cc8, 0xc0134cf320}, {0x7f57576e2b20?, 0xc013468818?})        /home/runner/go/pkg/mod/storj.io/drpc@v0.0.33/drpcserver/server.go:66 +0x1d2storj.io/drpc/drpcserver.(*Server).Serve.func2({0x96d1cc8?, 0xc0134cf320?})        /home/runner/go/pkg/mod/storj.io/drpc@v0.0.33/drpcserver/server.go:114 +0x57storj.io/drpc/drpcctx.(*Tracker).track(0xc0134cf320, 0x0?)        /home/runner/go/pkg/mod/storj.io/drpc@v0.0.33/drpcctx/tracker.go:35 +0x25created by storj.io/drpc/drpcctx.(*Tracker).Run in goroutine 563        /home/runner/go/pkg/mod/storj.io/drpc@v0.0.33/drpcctx/tracker.go:30 +0x79

Looking at the defintion ofobtainOIDCAccessToken, I think the culprit is:

if errors.Is(err, sql.ErrNoRows) {  err = nil}// continue with the rest of the flow

We should instead return early here instead of trying to continue the OIDC flow.

@johnstcnjohnstcn self-assigned thisOct 30, 2024
@johnstcnjohnstcn changed the titlefix(provisionerdserver): prevent NPE if no user link existsfix(coderd/provisionerdserver): prevent NPE if no user link existsOct 30, 2024
@johnstcnjohnstcn marked this pull request as ready for reviewOctober 30, 2024 11:36
Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Nice find, old behavior looks suspicious.

Copy link
Contributor

@dannykoppingdannykopping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM

Copy link
Member

@EmyrkEmyrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Good catch

@johnstcnjohnstcn merged commit591cefa intomainOct 30, 2024
29 checks passed
@johnstcnjohnstcn deleted the cj/fix-provisionerd-panic branchOctober 30, 2024 19:17
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsOct 30, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mafredrimafredrimafredri approved these changes

@dannykoppingdannykoppingdannykopping approved these changes

@EmyrkEmyrkEmyrk approved these changes

Assignees

@johnstcnjohnstcn

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@johnstcn@mafredri@dannykopping@Emyrk

[8]ページ先頭

©2009-2025 Movatter.jp