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

chore!: ensure consistent secret token generation and hashing#20388

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
Emyrk merged 23 commits intomainfromstevenmasley/refresh_hashing
Oct 23, 2025

Conversation

@Emyrk
Copy link
Member

@EmyrkEmyrk commentedOct 20, 2025
edited
Loading

I noticed our oauth2 tokens useduserpassword.Hash which salts the hash. Since our tokens are 40 random characters, salting is redundant and provides no increased security.

This PR uses the same sha256 hashing technique as we use for APIKeys. So now all randomly generated secrets will be hashed with sha256 for consistency.

This is a breaking change for the oauth tokens. Since oauth is only allowed for dev builds and experimental, this is ok.

@EmyrkEmyrk changed the titlechore: oauth2 refresh tokens to use sha256 hashed secretschore: oauth2 tokens to use sha256 hashed secretsOct 20, 2025
@EmyrkEmyrk marked this pull request as ready for reviewOctober 21, 2025 15:37
Salts are not required for random secrets. Salts are only useful toprotect against rainbow table style attacks. Since the input it 40random characters, salts are overkill.
@EmyrkEmyrkforce-pushed thestevenmasley/refresh_hashing branch fromc3eb94d to2cfc267CompareOctober 21, 2025 15:46
@EmyrkEmyrk marked this pull request as draftOctober 21, 2025 16:30
@EmyrkEmyrk changed the titlechore: oauth2 tokens to use sha256 hashed secretschore: consistent secret token generation and hashingOct 21, 2025
@EmyrkEmyrk changed the titlechore: consistent secret token generation and hashingchore: ensure consistent secret token generation and hashingOct 21, 2025
@EmyrkEmyrk marked this pull request as ready for reviewOctober 21, 2025 20:58
Copy link
Member

@code-ashercode-asher left a comment

Choose a reason for hiding this comment

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

Nice!

This is a breaking change for the oauth tokens. Since oauth is only allowed for dev builds and experimental, this is ok.

To add to this, I think we use it for MCP and there might be some people using it with Backstage (@Parkreiner just a heads up).

Parkreiner reacted with eyes emoji
@Parkreiner
Copy link
Contributor

Parkreiner commentedOct 22, 2025
edited
Loading

Yeah, we just rolled out oauth for Backstage, since we have a pretty high-profile lead who really wanted it

I want to say changing the tokens should be okay, but could I get an explanation for the ways that it becomes a breaking change? That'd be really helpful for me, and I don't know if it goes beyond requiring the user to reauthorize

Copy link
Member

@ThomasK33ThomasK33 left a comment

Choose a reason for hiding this comment

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

LGTM, some style nits nothing to get blocked on.

@ThomasK33
Copy link
Member

there might be some people using it with Backstage

It's unlikely. The OAuth components were implemented before I added the experiment and were gated exclusively by the 'dev' version check. So, anyone using Backstage with the OAuth provider must have been running a custom development build.

but could I get an explanation for the ways that it becomes a breaking change

As far as I know, it's a breaking change because the codersdk now exposes a different data type for those fields. As a result, any code that explicitly types or relies on it being a nullable string in SQL will no longer work. However, I could be wrong.

Emyrk and code-asher reacted with thumbs up emoji

@Emyrk
Copy link
MemberAuthor

Emyrk commentedOct 22, 2025
edited
Loading

Yeah, we just rolled out oauth for Backstage, since we have a pretty high-profile lead who really wanted it

I want to say changing the tokens should be okay, but could I get an explanation for the ways that it becomes a breaking change? That'd be really helpful for me, and I don't know if it goes beyond requiring the user to reauthorize

TIL a customer is using it 🤦

I will comment later today specifically what breaks. Iirc all apps need to be remade and all oauth refresh tokens become invalid.

As far as I know, it's a breaking change because the codersdk now exposes a different data type for those fields. As a result, any code that explicitly types or relies on it being a nullable string in SQL will no longer work. However, I could be wrong.

Yes there are some type changes there too.@Parkreiner I'll dm you on slack

code-asher reacted with heart emoji

@Emyrk
Copy link
MemberAuthor

@Parkreiner

  • dynamic client registration apps will be invalid.
  • Refresh tokens will be invalid
  • oauth app secrets will be invalid
  • Authorization codes will be invalid (these are short lived anyway)

So basically all of oauth will be broken and have to be redone 😢

@EmyrkEmyrk changed the titlechore: ensure consistent secret token generation and hashingchore!: ensure consistent secret token generation and hashingOct 23, 2025
@EmyrkEmyrk added the release/breakingThis label is applied to PRs to detect breaking changes as part of the release process labelOct 23, 2025
@EmyrkEmyrk merged commit13ca9ea intomainOct 23, 2025
32 checks passed
@EmyrkEmyrk deleted the stevenmasley/refresh_hashing branchOctober 23, 2025 20:38
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsOct 23, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@ThomasK33ThomasK33ThomasK33 approved these changes

@code-ashercode-ashercode-asher approved these changes

Assignees

@EmyrkEmyrk

Labels

release/breakingThis label is applied to PRs to detect breaking changes as part of the release process

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@Emyrk@Parkreiner@ThomasK33@code-asher

[8]ページ先頭

©2009-2025 Movatter.jp