Skip to content

fix/race-condition - #121

Merged
bedrin merged 4 commits into
masterfrom
fix/race-condition
Oct 2, 2026
Merged

bedrin merged 4 commits into
masterfrom
fix/race-condition

Conversation

@bedrin

@bedrin bedrin commented Oct 2, 2026

Copy link
Copy Markdown
Owner

No description provided.

bedrin and others added 2 commits October 31, 2023 08:18
Signed-off-by: Dmitry Bedrin <dmitry.bedrin@gmail.com>
Copilot AI balanced review requested due to automatic review settings October 2, 2026 09:19

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

The fixed margin can cause repeated authentication for short-lived tickets, and the concurrency behavior lacks regression tests.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Improves Kerberos TGT refresh handling to reduce expiration races.

Changes:

  • Detects destroyed or missing tickets.
  • Refreshes tickets within 60 seconds of expiration.
  • Handles missing end times safely.
File Description
SpnegoClient.java Adds defensive and early TGT expiration checks.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +369 to +370
private boolean isExpired() {
if (tgt == null || tgt.isDestroyed()) {
Comment on lines +377 to +378
return endTime == null
|| endTime.getTime() <= System.currentTimeMillis() + TGT_REFRESH_MARGIN_MILLIS;
bedrin and others added 2 commits October 2, 2026 11:23
…egoClientBackend and KerbySpnegoClientProvider

Signed-off-by: Dmitry Bedrin <dmitry.bedrin@gmail.com>
@bedrin
bedrin requested a balanced review from Copilot October 2, 2026 10:00
@bedrin
bedrin merged commit 143910f into master Oct 2, 2026
12 checks passed
@bedrin
bedrin deleted the fix/race-condition branch October 2, 2026 10:02

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

The fixed refresh margin can cause continuous KDC authentication for short-lived tickets.

Review effort: Balanced
Findings: 4 Medium severity · 1 Low severity

Open (5)


private static boolean isExpired(TgtTicket tgtTicket) {
return tgtTicket.getEncKdcRepPart().getEndTime().lessThan(System.currentTimeMillis());
private static final long TGT_REFRESH_MARGIN_MILLIS = 60_000L;
this.subject = subject;
}

private static final long TGT_REFRESH_MARGIN_MILLIS = 60_000L;
return new CacheKey("username-password", provider, username, password);
}

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