Skip to content

feat: implement oauth2 RFC 7009 token revocation endpoint#20362

Merged
Emyrk merged 11 commits into
mainfrom
stevenmasley/revoke_oauth
Oct 22, 2025
Merged

feat: implement oauth2 RFC 7009 token revocation endpoint#20362
Emyrk merged 11 commits into
mainfrom
stevenmasley/revoke_oauth

Conversation

@Emyrk
Copy link
Copy Markdown
Member

@Emyrk Emyrk commented Oct 17, 2025

Taken from #18809

The linked PR is too big, refactored some functions and fixed the test.

What this does

Adds RFC 7009 token revocation endpoint

@Emyrk Emyrk changed the title feat: oauth2 RFC 7009 token revocation endpoint feat: implement oauth2 RFC 7009 token revocation endpoint Oct 17, 2025
@Emyrk Emyrk marked this pull request as ready for review October 17, 2025 15:00
@Emyrk Emyrk requested review from ThomasK33 and code-asher October 17, 2025 15:37
Comment thread coderd/database/dbauthz/dbauthz.go
Comment thread coderd/oauth2_test.go
Comment thread coderd/oauth2_test.go
Comment thread coderd/oauth2provider/revoke.go Outdated
Comment thread coderd/oauth2provider/revoke.go
Comment thread coderd/oauth2provider/revoke.go
Comment on lines +35 to +36
// Secret is the raw secret value. This value should only be known to the client.
Secret string
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why are we storing the secret?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The Formatted stores the secret, so we were already storing the secret in this struct.

I added this field because the previous PR had 2 structs.

type parsedSecret struct {
	prefix string
	secret string
}

type AppSecret struct {
	// Formatted contains the secret. This value is owned by the client, not the
	// server.  It is formatted to include the prefix.
	Formatted string
	// Prefix is the ID of this secret owned by the server. When a client uses a
	// secret, this is the matching string to do a lookup on the hashed value.  We
	// cannot use the hashed value directly because the server does not store the
	// salt.
	Prefix string
	// Hashed is the server stored hash(secret,salt,...). Used for verifying a
	// secret.
	Hashed string
}

The parseFormattedSecret was in registration.go. My refactor was to make 1 struct for the AppSecret and another for HashedAppSecret. I moved ParseFormattedSecret next to GenerateSecret. I think we still need to workshop some better names to not conflate with other Secrets. Since it is in the oauth2provider package, I think that helps disambiguate it from say an APIKey secret

There is no new data being stored somewhere it was not previously.

Copy link
Copy Markdown
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

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

No blocking comments from me!

Comment thread coderd/oauth2provider/revoke.go
Comment thread coderd/oauth2provider/revoke.go Outdated
Comment thread coderd/oauth2provider/revoke.go Outdated
Comment thread coderd/oauth2provider/revoke.go Outdated
Comment thread coderd/coderd.go
@Emyrk Emyrk force-pushed the stevenmasley/revoke_oauth branch from 31a1f6f to daf8ce3 Compare October 22, 2025 17:48
@Emyrk Emyrk merged commit 4bd7c7b into main Oct 22, 2025
28 of 30 checks passed
@Emyrk Emyrk deleted the stevenmasley/revoke_oauth branch October 22, 2025 20:18
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 22, 2025
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.

3 participants