-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Oauth2 granular scopes #32180
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
Closed
Closed
Oauth2 granular scopes #32180
Changes from 3 commits
Commits
Show all changes
94 commits
Select commit
Hold shift + click to select a range
4885397
oauth2 additional scopes
marcellmars 33da8f1
no setting requirement for additional grant scopes
marcellmars 667c8cc
Merge branch 'main' into oauth2-granular-scopes
marcellmars 2c56714
Refactor the DB migration system slightly (#32344)
wxiaoguang 4497ac1
Fix db engine (#32351)
wxiaoguang 960869e
Migrate vue components to setup (#32329)
anbraten 990fd45
Suggestions for issues (#32327)
anbraten 8cb7aae
Optimize branch protection rule loading (#32280)
6543 2706557
Fix clean tmp dir (#32360)
lunny 3041406
remove unused call to $.HeadRepo in view_title template (#32317)
bohde 79d63f7
Add new [lfs_client].BATCH_SIZE and [server].LFS_MAX_BATCH_SIZE confi…
rremer baec377
Fix undefined errors on Activity page (#32378)
cloudchamb3r 62ce7fc
Fix absolute-date (#32375)
wxiaoguang 440cba6
Respect UI.ExploreDefaultSort setting again (#32357)
6543 d0de783
Fix toAbsoluteLocaleDate and add more tests (#32387)
wxiaoguang ed3d87e
Fix the missing menu in organization project view page (#32313)
yp05327 abcac26
refactor: remove redundant err declarations (#32381)
alexandear 1d5e81c
Fix suggestions for issues (#32380)
wxiaoguang 65db92f
Update JS and PY dependencies (#32388)
silverwind b3efee9
Update go dependencies (#32389)
wxiaoguang 19beedc
Fix a number of typescript issues (#32308)
silverwind 70c85dd
Fix `missing signature key` error when pulling Docker images with `SE…
Zettat123 baad896
Add artifacts test fixture (#30300)
kdumontnu 7b578b8
Refactor tests to prevent from unnecessary preparations (#32398)
wxiaoguang 68ebf96
improve performance of diffs (#32393)
bohde 89c5736
Replace DateTime with DateUtils (#32383)
wxiaoguang b4e08e0
Fix created_unix for mirroring (#32342)
lunny 784f464
Fix git error handling (#32401)
wxiaoguang 05e7a65
Replace DateTime with proper functions (#32402)
wxiaoguang a1b0385
Refactor repo legacy (#32404)
wxiaoguang 2ac493d
Make LFS http_client parallel within a batch. (#32369)
rremer 5f33651
Add some handy markdown editor features (#32400)
wxiaoguang a5f8bd8
Refactor markup package (#32399)
wxiaoguang 8212728
Refactor DateUtils and merge TimeSince (#32409)
wxiaoguang 13e319f
Refactor template ctx and render utils (#32422)
wxiaoguang 61b44f9
Refactor RepoRefByType (#32413)
wxiaoguang 4b90f99
Only query team tables if repository is under org when getting assign…
lunny 347fffc
Fix milestone deadline and date related problems (#32339)
lunny 2d8f5e6
Use 8 as default value for git lfs concurrency (#32421)
wxiaoguang 1169162
Correctly query the primary button in a form (#32438)
wxiaoguang 4aa0c3c
Updated tokenizer to better matching when search for code snippets (#…
bsofiato e61ba7b
Include file extension checks in attachment API (#32151)
kemzeb c14dc65
Add new index for action to resolve the performance problem (#32333)
lunny 7f55aad
Move AddCollabrator and CreateRepositoryByExample to service layer (#…
lunny a2e9ed3
Support quote selected comments to reply (#32431)
wxiaoguang 42a5d6d
Add new event commit status creation and webhook implementation (#27151)
lunny 295bcfc
Only provide the commit summary for Discord webhook push events (#32432)
kemzeb 60fbe04
Split issue sidebar into small templates (#32444)
wxiaoguang 773d040
Refactor issue page info (#32445)
wxiaoguang 3030905
Fix broken releases when re-pushing tags (#32435)
Zettat123 473ab5a
Refactor language menu and dom utils (#32450)
wxiaoguang 1c656ff
Fix issue sidebar (#32455)
wxiaoguang 0c42d88
Add reviewers selection to new pull request (#32403)
CalK16 d406da7
Fix mermaid diagram height when initially hidden (#32457)
silverwind b1ae78e
Refactor sidebar label selector (#32460)
wxiaoguang 75152db
Refactor sidebar assignee&milestone&project selectors (#32465)
wxiaoguang ca8ca8c
Add a doctor check to disable the "Actions" unit for mirrors (#32424)
Zettat123 172e2a4
Add `DEFAULT_MIRROR_REPO_UNITS` and `DEFAULT_TEMPLATE_REPO_UNITS` opt…
Zettat123 0afff76
Calculate `PublicOnly` for org membership only once (#32234)
6543 f7cbb80
Move some functions from issue.go to standalone files (#32468)
lunny 185e1f4
Harden runner updateTask and updateLog api (#32462)
ChristopherHX 9a3cdb3
Fix a number of typescript issues (#32459)
silverwind afea8b7
Refactor LFS SSH and internal routers (#32473)
wxiaoguang cf73089
cargo registry - respect renamed dependencies (#32430)
usbalbin 9b95175
Limit org member view of restricted users (#32211)
6543 b2aecb1
Fix test fixtures for user2/lfs.git (#32477)
wxiaoguang fc0771b
Update `github.com/meilisearch/meilisearch-go` (#32484)
silverwind d43c2e2
Update JS and PY dependencies (#32482)
silverwind b01fa60
Disable Oauth check if oauth disabled (#32368)
lunny cb817e1
Fix LFS route mock, realm, middleware names (#32488)
wxiaoguang c155d0f
Perf: add extra index to notification table (#32395)
BoYanZh d852a8a
Bump CI,Flake and Snap to Node 22 (#32487)
silverwind d280204
Fix nil panic if repo doesn't exist (#32501)
wxiaoguang 4160316
Refactor render system (#32492)
wxiaoguang a7a8f4a
Reimplement GetUserOrgsList to make it simple and clear (#32486)
lunny 62869b8
Trim title before insert/update to database to match the size require…
lunny 44c6a26
Remove jQuery import from some files (#32512)
wxiaoguang ebaf67f
Reduce integration test overhead (#32475)
bohde 7902c01
Add avif image file support (#32508)
wxiaoguang d1574da
Fix incorrect project page CSS class (#32510)
wxiaoguang 9a60268
Fix oauth2 error handle not return immediately (#32514)
lunny 29aabe4
Remove transaction for archive download (#32186)
lunny 8666feb
Fix `recentupdate` sorting bugs (#32505)
Zettat123 7341c75
Improve testing and try to fix MySQL hanging (#32515)
wxiaoguang 742a255
Fix large image overflow in comment page (#31740)
charles7668 193ac86
Fix and refactor markdown rendering (#32522)
wxiaoguang fd5badc
Fix basic auth with webauthn (#32531)
lunny d3af46a
Use better name for userinfo structure (#32544)
lunny b66e71a
Refactor find forks and fix possible bugs that weak permissions check…
lunny a8a6841
Refactor markup render system (#32533)
wxiaoguang 1f89ae7
Refactor push mirror find and add check for updating push mirror (#32…
lunny c53f38c
Fix some places which doesn't repsect org full name setting (#32243)
lunny e6fab4c
oauth2 additional scopes
marcellmars e2a0187
onlyPublicGroups compiled from form & in db.Find
marcellmars File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // Copyright 2024 The Gitea Authors. All rights reserved. | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| package oauth2_provider //nolint | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| ) | ||
|
|
||
| func TestGrantAdditionalScopes(t *testing.T) { | ||
| tests := []struct { | ||
| grantScopes string | ||
| expectedScopes string | ||
| }{ | ||
| {"openid profile email", "all"}, | ||
| {"openid profile email groups", "all"}, | ||
| {"openid profile email all", "all"}, | ||
| {"openid profile email read:user all", "all"}, | ||
| {"openid profile email groups read:user", "read:user"}, | ||
| {"read:user read:repository", "read:repository,read:user"}, | ||
| {"read:user write:issue public-only", "public-only,write:issue,read:user"}, | ||
| {"openid profile email read:user", "read:user"}, | ||
| {"read:invalid_scope", "all"}, | ||
| {"read:invalid_scope,write:scope_invalid,just-plain-wrong", "all"}, | ||
| } | ||
|
|
||
| for _, test := range tests { | ||
| t.Run(test.grantScopes, func(t *testing.T) { | ||
| result := GrantAdditionalScopes(test.grantScopes) | ||
| assert.Equal(t, test.expectedScopes, string(result)) | ||
| }) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctx.FormString("private") == "" || ctx.FormBool("private")
It seems it's not right here? Maybe
ctx.FormString("private") == "" || !ctx.FormBool("private").There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that was verbatim line for the private i copied from routers/web/repo/repo.go#L573
but meanwhile there were some changes with the new public only approach introduced recently.
after those changes
oauth2_provider.GetOAuthGroupsForUserhad the search into the database so theprivatecan be done via an option without the need to traverse orgs as i originally did.i changed my code into this:
but dancing around too many repos i ended up in a major mess with my pull request so i think i will just do another pull request which would try to clean it up.