Skip to content

Make unathenticated callers the exception - #649

Merged
augustuswm merged 6 commits into
mainfrom
opt-in-unathn
Nov 24, 2026
Merged

augustuswm merged 6 commits into
mainfrom
opt-in-unathn

Conversation

@augustuswm

Copy link
Copy Markdown
Collaborator

Currently by default anyone that calls get_caller gets back either an authenticated or unauthenticated caller. In either case they only carry the permissions assigned to them. This means that a downstream application has to do their own work to check if the caller is authenticated if they want to have a 401 gate. This is a breaking change that changes that behavior. Instead we now emit a 401 by default if get_caller fails to extract an authenticated caller. For the case where someone wants to accept an unauthenticated caller they can explicitly request if via:

ctx.get_caller(rqctx).await.allow_unauthenticated()?

Anyone that does not need unauthenticated callers does not need to make any changes.

@notpeter notpeter left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good.

Comment thread v-api/src/context/mod.rs
}

pub fn builtin_unauthenticated_caller(&self) -> Caller<T> {
fn builtin_unauthenticated_caller(&self) -> Caller<T> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Was it intentional to make this no longer pub? (rfd-api uses it)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I was intending to yes, but let me see how rfd-api is using it. I can revert this if the needed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Check the rfd-api usage and it is a test that should really just be constructing an empty caller. So we will just have to update here.

Comment thread v-api/src/context/mod.rs Resolved
Comment thread v-api/src/context/mod.rs Resolved
Comment thread v-api/src/authn/mod.rs Resolved
Comment thread v-api/src/authn/jwt.rs Resolved
@augustuswm
augustuswm merged commit d4239ea into main Nov 24, 2026
11 checks passed
@augustuswm
augustuswm deleted the opt-in-unathn branch November 24, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants