-
Notifications
You must be signed in to change notification settings - Fork 894
feat: Add initial AuthzQuerier implementation #5919
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
384 commits
Select commit
Hold shift + click to select a range
7d0fad4
Fix typo
Emyrk efe7f93
Merge remote-tracking branch 'origin/main' into authzquerier_layer
johnstcn 923219a
make RecordingAuthorizer wrap another rbac.Authorizer
johnstcn f97ca2a
fix FakeAuthorizer
johnstcn ad6ff52
skip TestAuthorizeAllEndpoints if authz_querier experiment is enabled
johnstcn 0e3b9ff
lock more things
johnstcn feb7689
Merge remote-tracking branch 'origin/main' into authzquerier_layer
johnstcn 083bcf2
rbac/builtin.go: remove consts
johnstcn 161842d
extract getAgentSubject()
johnstcn 11983ab
Merge remote-tracking branch 'origin/main' into authzquerier_layer
johnstcn ab9c049
use systemCtx in API.oauthLogin()
johnstcn 04e32bc
workspaceagents: fetch request ctx after httpmw.WorkspaceAgent sets a…
johnstcn 21d0f97
httpmw: pass systemCtx to getAgentSubject, add OwnerID to workspace a…
johnstcn 76a490e
authzquery: workspace: fix GetWorkspaceAppByAgentIDAndSlug and GetWor…
johnstcn fa399d6
steven said its ok to remove this
johnstcn cb9a2c5
Fix recursive test
Emyrk 9aa7835
Move experiment init below authz init
Emyrk 8f6265b
add httpmw.SystemAuthCtx to api.handleSubdomainApplications
johnstcn bfa91c1
REVERT THIS COMMIT BEFORE MERGING !!!!
johnstcn 13710c6
ALSO DO NOT MERGE THIS COMMIT
johnstcn 467646d
authzquery: fix InsertAgentStat
johnstcn 32c8af1
activitybump: use systemCtx for activityBumpWorkspace
johnstcn 11ef507
Merge remote-tracking branch 'origin/main' into authzquerier_layer
Emyrk b08fc44
remove unused function
Emyrk 69a6346
authzquery: fixes to templates and parameters
johnstcn 4967fe6
Fix fetch dry run template version from job id
Emyrk 6a7b053
Pass actor to follow logs for subscriber listen
Emyrk fc992cd
gerge remote-tracking branch 'origin/main' into authzquerier_layer
johnstcn d599753
rbac: add IsUnauthorizedError, return 404 if UnauthorizedError in org…
johnstcn 0ce75c6
goimports
johnstcn 357b05d
Implemented first draft testing framework
Emyrk 6bb2e1c
authzquery: fixes in workspaces.go
johnstcn 8a8ce06
Merge remote-tracking branch 'origin/authzquerier_layer' into authzqu…
johnstcn 300f6dc
Add test method accounting to ensure all functions are called
Emyrk 9f7d276
fixup! authzquery: fixes in workspaces.go
johnstcn d37379d
Merge remote-tracking branch 'origin/authzquerier_layer' into authzqu…
johnstcn 6cc14b4
Add rbac checks
Emyrk 2107b74
Fix scim unit tests
Emyrk 53f7a5d
authzquery: update UpdateTemplateDeletedByID to call SoftDeleteTempla…
johnstcn 44ca906
Merge remote-tracking branch 'origin/authzquerier_layer' into authzqu…
johnstcn 73655ab
Fix scim and workspace agent unit tests
Emyrk 0d6f6a0
Fix getTemplateVersionsByID
Emyrk 32a9e12
Fix more unit tests
Emyrk 85ff5f1
Fix license unit test
Emyrk e152d5f
authzquery: add some more convenience methods, comments etc.
johnstcn ef1deb5
Merge remote-tracking branch 'origin/authzquerier_layer' into authzqu…
johnstcn 4848481
Add sentinel errors for unauth authz errors
Emyrk b583a1e
Use sentinal error that returns a 404
Emyrk 75747f5
Use sentinel error always
Emyrk add77c6
add slice.New util function
johnstcn 4357a3c
RecordingAuthorizer: AllAsserted: provide more information on missed …
johnstcn 9dbc6bf
Merge remote-tracking branch 'origin/authzquerier_layer' into authzqu…
johnstcn c285f6f
skip GetAuthorizedWorkspaces
johnstcn 58261fe
Add admin context to provisonerd
Emyrk a4a2994
Merge remote-tracking branch 'origin/main' into authzquerier_layer
Emyrk 874e9da
Fix Delte group
Emyrk d878e71
remove excess comments
Emyrk 10ac765
typos and lint
Emyrk e353c4d
Fix template admin permissions
Emyrk db647ba
Fix rbac unit test
Emyrk f45a170
Call compileToSQL in getWorkspaces
Emyrk b4beb38
Call compileToSQL in getWorkspaces
Emyrk d9d23b6
Fix compile issue
Emyrk 8780e4e
Handle nil prepared case
Emyrk e6d5c2f
Linting
Emyrk 672b2e0
fix GetLatestWorkspaceBuildsByWorkspaceIDs
johnstcn 5a0e5a2
add existing workspace tests
johnstcn 016c56d
Check returned error from db call
Emyrk e086e51
Fix build number to be 1 indexed
Emyrk 390a284
more tests
johnstcn 53fcf79
generate random AuthInstanceID, more unit tests
johnstcn 0add01a
Test all api key methods
Emyrk 6191561
Test audit methods
Emyrk e8ab762
Add group and file unit tests
Emyrk 837f66a
Add template unit test
Emyrk 88d422f
Add system functions
Emyrk a32b4f3
Merge remote-tracking branch 'origin/main' into authzquerier_layer
Emyrk d3affdc
Fix merge compile issues
Emyrk 338e300
Jobs, orgs, and extra methods implemented
Emyrk f5c4040
Merge remote-tracking branch 'origin/main' into authzquerier_layer
Emyrk a7899cf
:
Emyrk 0da03c6
Implement parameters tests
Emyrk 4415b6b
Start license unit tests
Emyrk fb8973c
Merge remote-tracking branch 'origin/main' into authzquerier_layer
Emyrk 6763fbf
Finish license tests
Emyrk d1b948d
Add workspace tests
Emyrk 13a4fab
chore: Add WorkspaceApps to dbgen
Emyrk 607e428
Add user unit tests
Emyrk 592a62b
GitSSHKey, UserLink, GitAuthLink
Emyrk 102af8a
Fix user unit tests
Emyrk d2b1f41
Merge remote-tracking branch 'origin/main' into authzquerier_layer
johnstcn b6afc2a
rm unused-import
johnstcn d1cfa73
authzquery: implement group and system methods
johnstcn b7cd5a5
fixup! authzquery: implement group and system methods
johnstcn f34c61b
fixup! authzquery: implement group and system methods
johnstcn e53d709
ineffasign
johnstcn cb4d92f
unshadow, unused-reciever
johnstcn 13a8445
unused-param
johnstcn e1ce04e
finish testing template methods
johnstcn 7fde8fb
Rename logger-> log, database->db, authorizer->auth, remove "authoriz…
Emyrk 7ba3482
Rename fetchSet to fetchWithPostFilter
Emyrk cf763cb
Verify the correct error is returned on disallow auth
Emyrk 64e80fb
Linting
Emyrk 432a261
database: add missing argument to GetAuthorizedWorkspaces
johnstcn 8134d1b
Refactor recording authorizer
Emyrk 29e7c46
Address incorrect errors
Emyrk a37fead
Support asserting outputs in authzquery test
Emyrk 2e435cf
Require outputs to be asserted
Emyrk 792cbb6
Fix comment
Emyrk 1336e28
allow skipping outputs
Emyrk 0923780
Fix user tests to expect outputs
Emyrk 92f89ec
fix api key unit tests to expect outputs
Emyrk acae52b
values audit_test.go
johnstcn 764b0a0
Implement outputs for workspace tests
Emyrk 0cee453
Some system outputs
Emyrk d1e3214
values file_test.go
johnstcn e799713
values group_test.go
johnstcn cbb4502
Template outputs
Emyrk 83a31cb
System outputs
Emyrk 9010ad7
values job_test.go, methods_test.go
johnstcn 912c97a
Add organization output
Emyrk a3f67bb
values license_test.go
johnstcn 7d31209
Merge remote-tracking branch 'origin/authzquerier_layer' into authzqu…
johnstcn 2c906e5
Add parameters ooutput
Emyrk 5e92648
Api key and audit fix
Emyrk 04cce68
Fix file outputs
Emyrk 712c0f4
Fix groups
Emyrk 8f92a77
Fix job, license, and org
Emyrk 3df9848
System done
Emyrk 90a9d87
Fix templates
Emyrk 8b39d7e
Fix most users
Emyrk a621743
Linting
Emyrk 2c002bd
workspace_test.go values fix
johnstcn cbd5cb4
nolint unreachable
johnstcn 6fed479
Fix all user method tests
Emyrk 5928c37
Add unit tests for InTx and Ping
Emyrk 46b8366
Add AuthorizedXX tests
Emyrk 21a6f6a
api: skip Authorize if codersdk.ExperimentAuthzQuerier enabled
johnstcn d6810de
Merge remote-tracking branch 'origin/authzquerier_layer' into authzqu…
johnstcn 889b650
Only abort early on checks that should be removed
Emyrk 72ed503
remove authorizedQuery
Emyrk 94ff5ef
authzquery: use GetProvisionerJobById to auth GetWorkspaceResourceByID
johnstcn 38a90de
Merge remote-tracking branch 'origin/authzquerier_layer' into authzqu…
johnstcn c962897
All insert generic functions use rbac.ActionCreate
Emyrk 62e3fa0
Fix unit tests that use create over update
Emyrk a0725b9
un-skip TestAuthorizeAllEndpoints and remove always-true conditional …
johnstcn a4c4489
Merge remote-tracking branch 'origin/authzquerier_layer' into authzqu…
johnstcn 567cfa4
Merge remote-tracking branch 'origin/main' into authzquerier_layer
johnstcn 91910af
fixup! un-skip TestAuthorizeAllEndpoints and remove always-true condi…
johnstcn dce10b5
where my members at yo
johnstcn 58b71f9
Allow out of order slicing
Emyrk 833bbc2
Use slice.New()
Emyrk fcfdb4e
paralalalaleleleel
johnstcn 8858fd3
Ordering of users in fetch
Emyrk 64e0f8c
Add actual scope to workspace agent ctx
Emyrk 9d6ab90
Merge remote-tracking branch 'origin/main' into authzquerier_layer
Emyrk 1821dcb
RBAC UserData should use the correct rbac resource
Emyrk 7c9f686
Remove workspace IDs filter arg
Emyrk eda4e0a
rename authzquery.NewAuthzQuerier to authzquery.New
johnstcn 073aa2c
Start removing QueryByRelated
Emyrk 4fe26e9
Start removing QueryByRelated
Emyrk 13f1c9f
remove queryWithRelated
johnstcn ba172ea
Fixup generic func comments
Emyrk 509ebdc
fixup! remove queryWithRelated
johnstcn 802272b
remove todo
Emyrk 57cde94
Improve readability of generics and arguments
Emyrk 4daa878
Update fetchAndQuery comment
Emyrk 4608462
Fix comment about system functions
Emyrk 2767264
remove insert() function
johnstcn fc3ae4b
insertWithReturn is the new insert
johnstcn bf653b6
Merge remote-tracking branch 'origin/authzquerier_layer' into authzqu…
johnstcn ca68db2
Remove duplicate workspace agent scope
Emyrk f1f05cc
Pass agent ctx into activityBumpWorkspace
Emyrk eb38c0d
remove panic
johnstcn b96bb21
Merge remote-tracking branch 'origin/authzquerier_layer' into authzqu…
johnstcn 0a061be
Remove uneeded comments
Emyrk 8295eb3
Use 's' for all suite methods
Emyrk c2bc20e
Reduce LoC by using setup and teardown test
Emyrk 3bd3e89
Remove nested "RunMethodTest", use new assertions
Emyrk 052c531
Start converting tests to the new format
Emyrk 6aa55ac
refactor out error test
Emyrk 72d0a4e
Update unit test teardown to include NoActorError
Emyrk 4c68562
Attempt a new style of subtest
Emyrk fdfdd73
Fix user tests to use new subtest strategy
Emyrk c902715
Fix unit tests names
Emyrk f5dbd3e
Convert more tests to new format
Emyrk 97ad3df
Convert all unit tests
Emyrk b369c99
Add comments
Emyrk 03d42d3
remove unused code
Emyrk 69d1aa3
rename MethodCase to expects
Emyrk 3861a43
Merge remote-tracking branch 'origin/main' into authzquerier_layer
Emyrk 9e7ff9a
DB function was renamed/changed
Emyrk 9dc357e
imports
johnstcn ad6ad36
authzquery -> database/dbauthz
johnstcn 0985060
conditionally skip TestAuthorizeAllEndpoints
johnstcn d4e1124
userauth: use systemCtx when setting user groups
johnstcn 4e6b43f
Merge branch 'cj/dbauthz' into authzquerier_layer
johnstcn 22e1057
fixup! authzquery -> database/dbauthz
johnstcn c5346ad
rm todo
johnstcn 7a14b64
Condense into 1 file
Emyrk b89b430
doc.go
Emyrk 21532a6
Update coderd/database/dbauthz/doc.go
Emyrk 6a7970f
Move files around, consolidate to dbauthz.go
Emyrk 399241a
Merge remote-tracking branch 'origin/main' into authzquerier_layer
Emyrk 924ef9c
fix unit test to work with dbauthz
Emyrk 2cf0fb2
Consolidate files
Emyrk d1bb7cf
goimports
johnstcn ef97e4b
rename methods.go -> querier.go
johnstcn 951d74f
Do not export the authzQuerier
Emyrk 2cf1cad
Rename to "querier", add unit test for double wrap protection
Emyrk a9f2581
remove duplicate dbauthz init
johnstcn 832d91a
use codersdk experiment value instead of hard-coded string
johnstcn 0ddee07
Merge remote-tracking branch 'origin/main' into authzquerier_layer
johnstcn cc76887
Merge remote-tracking branch 'origin/main' into authzquerier_layer
johnstcn 002f354
Remove rbac ctx from provisionerd
Emyrk 039e1e2
fixup! Remove rbac ctx from provisionerd
Emyrk b509b8f
wip: dbauthz.WithAuthorizeSystemContext -> dbauthz.AsSystem()
johnstcn 524394f
Add lint rule to prevent system ctx abuse
Emyrk f666e13
fixup! wip: dbauthz.WithAuthorizeSystemContext -> dbauthz.AsSystem()
johnstcn 1a97843
Merge remote-tracking branch 'origin/authzquerier_layer' into authzqu…
johnstcn 4b292e2
fix autobuild/executor unit tests
johnstcn bebe638
Add middleware for using system ctx in middlewares
Emyrk f99c778
fix compile errors
johnstcn 84bc12f
set system ctx in provisionerdserver
johnstcn c5e69fa
Unit test the AsAuthzSystem mw
Emyrk a93c2d5
Update unit tests to cover the no actor case
Emyrk f7023a4
Typo
Emyrk 035609b
remove todo
Emyrk bbe4f18
User proper rbac errors in unit test
Emyrk f0bbaaf
Add unit test to cover prepareSQL error case
Emyrk 51a2dae
NullUUID is empty, so takeFirst fails
Emyrk 00955e0
Add AsSystem
Emyrk 2289f4d
Fix internal error logging
Emyrk 106d58b
Remove error noise in unit tests
Emyrk 2724dfd
Use AsSystem for decrypting encrypted api keys
Emyrk 2c34f6d
fix linter errors
johnstcn c54afc5
userauth: create API key as user instead of as system
johnstcn d282e9c
Merge remote-tracking branch 'origin/main' into authzquerier_layer
johnstcn 7334046
Remove unused file
Emyrk 3dbbc71
Use system context to set a disconnected agent
Emyrk cd6096f
Log error on failed agent disconnect update
Emyrk eb2497a
Merge remote-tracking branch 'origin/main' into authzquerier_layer
Emyrk d2c7a1f
Unit tests do not handle error log well
Emyrk 99fa810
Merge remote-tracking branch 'origin/main' into authzquerier_layer
Emyrk 1dfa287
Fix license uuid in merge
Emyrk 57ab200
Fix unit test error logging
Emyrk 306c591
Correct the returned error from not authorized
Emyrk f39cee0
Fix if/else logic
Emyrk 2ed5588
fixup! Fix if/else logic
Emyrk c09b077
Merge remote-tracking branch 'origin/main' into authzquerier_layer
johnstcn 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
Merge remote-tracking branch 'origin/main' into authzquerier_layer
- Loading branch information
commit 567cfa4bc1f6f29c7ea9ec2ca4ba3fd79b133a37
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
You are viewing a condensed version of this merge commit. You can view the full changes here.
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.
Uh oh!
There was an error while loading. Please reload this page.