Skip to content

fix(security): secure OAuth callback redirects - #3984

Draft
thoniTUB wants to merge 2 commits into
developfrom
fix/remote-soure-redirect
Draft

fix(security): secure OAuth callback redirects#3984
thoniTUB wants to merge 2 commits into
developfrom
fix/remote-soure-redirect

Conversation

@thoniTUB

Copy link
Copy Markdown
Collaborator

No description provided.

Co-authored-by: Codex GPT-5 <codex@openai.com>
@thoniTUB thoniTUB self-assigned this Aug 27, 2026

@awildturtok awildturtok left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

sieht gut aus aber muss es mir nochmal mit klarerem kopf anschauen


@JsonIgnore
@Getter(AccessLevel.NONE)
private final Cache<String, PendingAuthorizationRequest> pendingAuthorizationRequests = Caffeine.newBuilder()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

=> CaffeinSpec, und 10K wirkt absurd viel.

}

String registerAuthorizationRequest(URI callbackUri, URI returnUri) {
final String state = UUID.randomUUID().toString();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ist "state" ein oauth name? Meiner intuition nach ist das ja eigentlich ein Identifier?

}

static URI toRootRelativeUri(URI requestUri) {
if (requestUri == null || !requestUri.isAbsolute()) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

der null check sollte separat sein imo?

final JwtPkceVerifyingRealmFactory factory = new JwtPkceVerifyingRealmFactory();
final URI callbackUri = URI.create("https://example.com/admin-ui");
final String state = factory.registerAuthorizationRequest(callbackUri, URI.create("/admin-ui/users"));
factory.validateAndConsumeAuthorizationRequest(state, callbackUri);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

bitte hier kommentar dran machen, dass das stateful ist und ab hier nicht reused werden kann

);
assertThrows(
BadRequestException.class,
() -> JwtPkceVerifyingRealmFactory.toRootRelativeUri(URI.create("https://example.com//attacker.example/path"))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

doppelslash??

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

also .com//attacker/

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.

2 participants