8000 Updating Secure Request Object to reject overflowing and malformed timestamps by PadzerButch · Pull Request #54907 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Updating Secure Request Object to reject overflowing and malformed timestamps - #54907

Open
PadzerButch wants to merge 2 commits into
keycloak:mainfrom
PadzerButch:Weakness_54457_RequestObject
Open

PadzerButch wants to merge 2 commits into
keycloak:mainfrom
PadzerButch:Weakness_54457_RequestObject

Conversation

@PadzerButch
Copy link
Copy Markdown
Contributor

relating to issue #54457

Closes #54905

@PadzerButch
PadzerButch marked this pull request as ready for review November 10, 2026 10:39
@PadzerButch
PadzerButch requested a review from a team as a code owner November 10, 2026 10:39
Copilot AI balanced review requested due to automatic review settings November 10, 2026 10:39
Copilot AI 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.

🟡 Changes recommended

Fractional NumericDates are truncated by asLong(), allowing the ordering check to accept a request whose expiration precedes its not-before time.

1 open issue
What changed in this PR

This PR hardens the Secure Request Object client-policy executor against timestamp coercion and integer-overflow lifetime bypasses, addressing #54457 and #54905.

Changes:

  • Adds numeric and range validation for timestamp claims.
  • Uses overflow-safe lifetime and clock-skew calculations and rejects expiration before nbf.
  • Adds unit tests for valid lifetimes, malformed timestamps, and numeric boundaries.
File Description
services/​src/​test/​java/​org/​keycloak/​services/​clientpolicy/​executor/​SecureRequestObjectExecutorTest.java Adds timestamp validation and overflow regression tests.
services/​src/​main/​java/​org/​keycloak/​services/​clientpolicy/​executor/​SecureRequestObjectExecutor.java Hardens timestamp parsing, ordering, and lifetime checks.

Review effort: Balanced

…mestamps, relating to issue keycloak#54457

Closes keycloak#54905

Signed-off-by: Paddy Buckley <paddy.buckley@ibm.com>
@PadzerButch
PadzerButch force-pushed the Weakness_54457_RequestObject branch from cc5a62b to d52407a Compare November 10, 2026 14:08
Copilot AI balanced review requested due to automatic review settings November 10, 2026 14:08
Copilot AI 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.

🟡 Changes recommended

The zero-lifetime test can intermittently fail with Request Expired if the clock crosses a second boundary; its equal timestamps should be slightly in the future within the allowed clock skew.

1 open issue
1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 10, 2026 15:50
Copilot AI 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.

🔵 Needs a closer look

The zero-lifetime test remains timing-sensitive because GC pauses or CI scheduling delays can cross a second boundary and cause a spurious Request Expired failure.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Wall-clock delay can expire the request during the test

services/​src/​test/​java/​org/​keycloak/​services/​clientpolicy/​executor/​SecureRequestObjectExecutorTest.java:145

Waiting for the first 100 ms of a second does not prevent a GC pause or CI scheduling delay from crossing the next second before the executor checks exp, causing this test to fail with Request Expired. Keep the zero lifetime but shift current into the future within ALLOWED_CLOCK_SKEW, or freeze the clock, instead of polling wall time.

1 resolved since last review

Review effort: Balanced

@keycloak-github-bot keycloak-github-bot Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unreported flaky test detected, please review

@keycloak-github-bot
Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.actions.TermsAndConditionsTest#termsAccepted

Keycloak CI - Forms IT (firefox)

java.lang.RuntimeException: Could not create statement
	at org.jboss.arquillian.junit.Arquillian.methodBlock(Arquillian.java:307)
	at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:160)
	at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:344)
	at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:48)
...

Report flaky test

@PadzerButch
PadzerButch force-pushed the Weakness_54457_RequestObject branch from 0eefb95 to 075ae63 Compare November 10, 2026 17:48
Copilot AI balanced review requested due to automatic review settings November 10, 2026 17:48
Copilot AI 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.

🟡 Changes recommended

The zero-lifetime success test remains timing-sensitive because its request expires within the current second, so scheduler or GC pauses can cause false failures.

1 open issue

Review effort: Balanced

…nd malformed timestamp tests

Signed-off-by: Paddy Buckley <paddy.buckley@ibm.com>
@PadzerButch
PadzerButch force-pushed the Weakness_54457_RequestObject branch from 075ae63 to 61fda8c Compare November 10, 2026 18:15
Copilot AI balanced review requested due to automatic review settings November 10, 2026 18:15
Copilot AI 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.

🟢 Approval recommended

No active review issues are reported for the timestamp-validation and overflow-safety changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reject overflowing and malformed timestamps in request object

2 participants

0