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

refactor: replace OAuth2 callback_url with RFC 6749 compliant redirect_uris#18810

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

Open
ThomasK33 wants to merge1 commit intographite-base/18810
base:graphite-base/18810
Choose a base branch
Loading
fromthomask33/07-08-feat_replace_callback_url_with_redirect_uris_for_oauth2_rfc_6749_compliance

Conversation

ThomasK33
Copy link
Member

RFC 6749 Compliance: Replace callback_url with redirect_uris Array

This PR improves OAuth2 provider compliance with RFC 6749 by replacing the singlecallback_url field with a properredirect_uris array. This change allows OAuth2 clients to register multiple valid redirect URIs and enforces exact URI matching as required by the specification.

Key changes:

  • Migrated database schema to removecallback_url column and makeredirect_uris the source of truth
  • Updated API endpoints to accept and validate multiple redirect URIs
  • Modified OAuth2 authorization flow to perform exact URI matching against registered URIs
  • Changed device authorization endpoint to accept form-urlencoded data instead of JSON
  • Updated frontend to support adding/removing multiple redirect URIs
  • Added database migration with backward compatibility support

This change improves security by enforcing stricter redirect URI validation and provides more flexibility for OAuth2 clients that need multiple callback endpoints.

@ThomasK33Graphite App
Copy link
MemberAuthor

ThomasK33 commentedJul 9, 2025
edited
Loading

@ThomasK33ThomasK33force-pushed thethomask33/07-07-feat_standardize_oauth2_endpoints_and_add_token_revocation branch fromdd9cb2f toae754f4CompareJuly 9, 2025 12:16
@ThomasK33ThomasK33force-pushed thethomask33/07-08-feat_replace_callback_url_with_redirect_uris_for_oauth2_rfc_6749_compliance branch fromf9e6552 to1444efeCompareJuly 9, 2025 12:16
@ThomasK33ThomasK33 changed the base branch fromthomask33/07-07-feat_standardize_oauth2_endpoints_and_add_token_revocation tographite-base/18810July 9, 2025 15:19
@ThomasK33ThomasK33force-pushed thethomask33/07-08-feat_replace_callback_url_with_redirect_uris_for_oauth2_rfc_6749_compliance branch from1444efe toef4a6c8CompareJuly 9, 2025 22:21
@ThomasK33ThomasK33 changed the base branch fromgraphite-base/18810 tothomask33/07-07-feat_standardize_oauth2_endpoints_and_add_token_revocationJuly 9, 2025 22:21
@ThomasK33ThomasK33force-pushed thethomask33/07-08-feat_replace_callback_url_with_redirect_uris_for_oauth2_rfc_6749_compliance branch fromef4a6c8 toe24c4b5CompareJuly 10, 2025 09:15
@ThomasK33ThomasK33 requested a review fromjohnstcnJuly 10, 2025 09:25
@ThomasK33ThomasK33 marked this pull request as ready for reviewJuly 10, 2025 09:25
@ThomasK33ThomasK33force-pushed thethomask33/07-08-feat_replace_callback_url_with_redirect_uris_for_oauth2_rfc_6749_compliance branch frome24c4b5 to98e7f95CompareJuly 12, 2025 12:55
@ThomasK33ThomasK33force-pushed thethomask33/07-07-feat_standardize_oauth2_endpoints_and_add_token_revocation branch fromab73979 tob89c367CompareJuly 12, 2025 12:55
@ThomasK33ThomasK33force-pushed thethomask33/07-07-feat_standardize_oauth2_endpoints_and_add_token_revocation branch fromb89c367 tob73b71dCompareJuly 14, 2025 12:43
@ThomasK33ThomasK33force-pushed thethomask33/07-08-feat_replace_callback_url_with_redirect_uris_for_oauth2_rfc_6749_compliance branch from98e7f95 to2792051CompareJuly 14, 2025 12:43
@ThomasK33ThomasK33 changed the base branch fromthomask33/07-07-feat_standardize_oauth2_endpoints_and_add_token_revocation tographite-base/18810July 14, 2025 15:16
@ThomasK33ThomasK33force-pushed thethomask33/07-08-feat_replace_callback_url_with_redirect_uris_for_oauth2_rfc_6749_compliance branch from2792051 to3dd0c37CompareJuly 14, 2025 16:22
@ThomasK33ThomasK33 changed the base branch fromgraphite-base/18810 tothomask33/07-07-feat_standardize_oauth2_endpoints_and_add_token_revocationJuly 14, 2025 16:22
@ThomasK33ThomasK33force-pushed thethomask33/07-07-feat_standardize_oauth2_endpoints_and_add_token_revocation branch from386d77d tob58eed8CompareJuly 14, 2025 17:18
@ThomasK33ThomasK33force-pushed thethomask33/07-08-feat_replace_callback_url_with_redirect_uris_for_oauth2_rfc_6749_compliance branch from3dd0c37 to962c22cCompareJuly 14, 2025 17:18
@ThomasK33ThomasK33 changed the base branch fromthomask33/07-07-feat_standardize_oauth2_endpoints_and_add_token_revocation tographite-base/18810July 15, 2025 16:03
@ThomasK33ThomasK33force-pushed thethomask33/07-08-feat_replace_callback_url_with_redirect_uris_for_oauth2_rfc_6749_compliance branch from962c22c tobed62adCompareJuly 15, 2025 17:24
@ThomasK33ThomasK33 changed the base branch fromgraphite-base/18810 tothomask33/07-07-feat_standardize_oauth2_endpoints_and_add_token_revocationJuly 15, 2025 17:24
Comment on lines +7 to +9
-- being an array with a single NULL element. This is preferable to an empty
-- array as it will pass a CHECK for array length > 0, enforcing that all
-- apps have at least one URI entry, even if it's null.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we make theCHECK check for the cardinality OR the "nullness"?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I think I'm doing that in the client_credentials PR up in the stack, but I would need to double-check.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I'm sorry. I just reread the comment. I'd rather not introduce a possible null here and perform a clean migration from callback_url to redirect_uris, then make sure that all of them get carried over.

The constraint forredirect_uris will be loosened in the PR introducing client_credentials. We'll then allow setting an empty redirect_uris array but not a null one.

site.RenderStaticErrorPage(rw,r, site.ErrorPageData{
Status:http.StatusInternalServerError,
HideStatus:false,
Title:"Internal Server Error",
Description:err.Error(),
Description:"OAuth2 app has no registered redirect URIs",
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto; bad request rather than internal server error.

…plianceChange-Id: I4823e475777ebdf75e3a80e47ff6bef1a556cd55Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33ThomasK33force-pushed thethomask33/07-08-feat_replace_callback_url_with_redirect_uris_for_oauth2_rfc_6749_compliance branch frombed62ad to4fb1c39CompareJuly 17, 2025 14:38
@ThomasK33ThomasK33force-pushed thethomask33/07-07-feat_standardize_oauth2_endpoints_and_add_token_revocation branch from9393060 to2c31819CompareJuly 17, 2025 14:38
@ThomasK33ThomasK33 changed the base branch fromthomask33/07-07-feat_standardize_oauth2_endpoints_and_add_token_revocation tographite-base/18810July 21, 2025 12:15
Iconstring`json:"icon"`
ID uuid.UUID`json:"id" format:"uuid"`
Namestring`json:"name"`
RedirectURIs []string`json:"redirect_uris"`
Copy link
Member

Choose a reason for hiding this comment

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

As I understand, you could only get this response if the OAuth2 provider was enabled, which was only available on development builds and not release builds. So not a breaking change, correct?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Yes, either a dev build or if one actively enables the oauth2 experiment

Comment on lines +499 to +502
// RFC 6749: Exact match against registered redirect URIs
ifslices.Contains(registeredRedirectURIs,redirectURIParam) {
returnredirectURL
}
Copy link
Member

Choose a reason for hiding this comment

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

ThomasK33 reacted with thumbs up emoji
Comment on lines +237 to 238
// @Acceptapplication/x-www-form-urlencoded
// @Produce json
Copy link
Member

Choose a reason for hiding this comment

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

I found it hard to believe, but here it ishttps://datatracker.ietf.org/doc/html/rfc8628#section-3.2

ThomasK33 reacted with thumbs up emoji
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@dannykoppingdannykoppingdannykopping left review comments

@aslilacaslilacaslilac left review comments

@johnstcnjohnstcnjohnstcn left review comments

@EmyrkEmyrkAwaiting requested review from Emyrk

@mafredrimafredriAwaiting requested review from mafredri

Assignees

@ThomasK33ThomasK33

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@ThomasK33@dannykopping@aslilac@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp