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

chore: make authz recorder opt in#20310

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

Merged
Emyrk merged 6 commits intomainfromstevenmasley/opt_in_authz_record
Oct 21, 2025
Merged

Conversation

@Emyrk
Copy link
Member

The authz recorder is causing a lot of memory to be allocated, and is a memory leak for websocket connections.

This change makes it opt-in on a per request basis (ontop ofisDev). To get the authz headers, useCopy as cURL on chrome and append the headerx-authz-checks=true.

This is preferred to disabling this imo.

// Only enabled if the x-authz-checks header is set to a truthy value.
// The requester is expected to explicitly ask for this header to be set
// in the response.
ifenabled,_:=strconv.ParseBool(r.Header.Get("x-authz-checks"));enabled {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we make this more explicit, likex-enable-authz-checks?

x-authz-checks is what gets returned, so it could get confusing.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Maybe it should bex-enable-authz-response? Something more explicit then?

I was thinking of just setting it to the same value returned. So it's a singular header to remember 🤷

Copy link
Member

Choose a reason for hiding this comment

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

orx-record-authz-checks, since that's what the middleware is called

Emyrk reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

changed to that

Copy link
Member

@aslilacaslilac left a comment

Choose a reason for hiding this comment

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

thank you for acquiescing to my request, I will remember this come turkey day 🦃

Emyrk reacted with laugh emoji
Comment on lines +52 to +60
returnfunc(next http.Handler) http.Handler {
returnhttp.HandlerFunc(func(rw http.ResponseWriter,r*http.Request) {
ifenabled,_:=strconv.ParseBool(r.Header.Get("x-record-authz-checks"));enabled||always {
r=r.WithContext(rbac.WithAuthzCheckRecorder(r.Context()))
}

next.ServeHTTP(rw,r)
})
}
Copy link
Member

Choose a reason for hiding this comment

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

minor suggestion (that maybe would fix what the linter is complaining about?): ifalways == true you could return a version of the handler that doesn't have theif and just always adds the context

but this is also only enabled in dev builds so the performance gain wouldn't really matter. just a thought!

Emyrk reacted with thumbs up emoji
@EmyrkEmyrkenabled auto-merge (squash)October 20, 2025 16:06
@EmyrkEmyrk merged commit86f0f39 intomainOct 21, 2025
130 of 140 checks passed
@EmyrkEmyrk deleted the stevenmasley/opt_in_authz_record branchOctober 21, 2025 14:15
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsOct 21, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@dannykoppingdannykoppingdannykopping left review comments

@aslilacaslilacaslilac approved these changes

Assignees

@EmyrkEmyrk

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@Emyrk@dannykopping@aslilac

[8]ページ先頭

©2009-2025 Movatter.jp