Commit abddcbe
Callum Styan
perf(coderd/dbauthz): bypass authorization cascade for system-restricted contexts
GetWorkspaceResourceWithJobByID now checks if the context is
system-restricted and, if so, directly calls the raw database query
without going through the authorization cascade.
This completely eliminates the GetWorkspaceBuildByJobID call for
system-restricted contexts (like handleAuthInstanceID) by skipping
the GetProvisionerJobByID authorization chain.
Before: GetWorkspaceResourceWithJobByID → GetWorkspaceResourceByID →
GetProvisionerJobByID → GetWorkspaceBuildByJobID (1 call)
After: GetWorkspaceResourceWithJobByID → direct db query (0 calls)
The function returns an error if called without system-restricted
context to ensure it's only used in appropriate scenarios.1 parent 5aadcb7 commit abddcbe
1 file changed
+10
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3925 | 3925 | | |
3926 | 3926 | | |
3927 | 3927 | | |
3928 | | - | |
3929 | | - | |
3930 | | - | |
| 3928 | + | |
| 3929 | + | |
| 3930 | + | |
| 3931 | + | |
3931 | 3932 | | |
3932 | | - | |
3933 | | - | |
3934 | | - | |
3935 | | - | |
3936 | | - | |
3937 | | - | |
3938 | | - | |
3939 | | - | |
3940 | | - | |
3941 | | - | |
3942 | | - | |
| 3933 | + | |
| 3934 | + | |
| 3935 | + | |
| 3936 | + | |
3943 | 3937 | | |
3944 | 3938 | | |
3945 | | - | |
| 3939 | + | |
| 3940 | + | |
3946 | 3941 | | |
3947 | 3942 | | |
3948 | 3943 | | |
| |||
0 commit comments