- Notifications
You must be signed in to change notification settings - Fork1.1k
chore: optimize auth check recordings#20300
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
Conversation
Signed-off-by: Danny Kopping <danny@coder.com>
…ntextsSigned-off-by: Danny Kopping <danny@coder.com>
recordAuthzCheckUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Signed-off-by: Danny Kopping <danny@coder.com>
| const ( | ||
| // MaxRecordedChecks is the maximum number of authorization checks to keep | ||
| // in the ring buffer. This prevents unbounded memory growth for long-running contexts. | ||
| MaxRecordedChecks=20 |
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.
Do we have any data on how many authz checks are performed, on average, per request? Is this just a guesstimate?
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.
Just a guesstimate, yeah.
Uh oh!
There was an error while loading.Please reload this page.
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.
Why not just disable authz recording on dev builds unless it's a testing build? We get no value out of it on dogfood, because AFAIK there's no API to actually look at the recorded authz checks.
johnstcn commentedOct 15, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
We set a HTTP header Lines 22 to 41 ine0b1536
|
This seems so niche that it could just be something that someone can enable with a const or a build flag. Do people even use this on dogfood? |
Ideally the requester could add some header to request the response header be present. Then the cli and ui could have some hidden switch to staple the header on these requests |
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.
The ring buffer would omit some authz checks, which returns an incomplete story.
I would rather us find a way to opt in on a per request basis
We're rather going to take the approach of enabling the auth recordings on a per-request basis. |
|
Uh oh!
There was an error while loading.Please reload this page.
Disclaimer: mostly implemented with Claude Code.
recordAuthzCheckis currently very inefficient. Aggravating this is the fact that the checks are recorded inAuthzCheckRecorder'schecksslice which grows inexorably for long-running requests like WebSocket conns whose contexts can remain active for hours or days.(source)
I've implemented a ring-buffer (cap 20) to help with this.
Fortunately it's only in use when running the dev version, so this won't affect production instances.
Benchmarks: