Skip to content

fix: reject stale and future-dated attestation blobs at provider registration#129

Open
antojoseph wants to merge 2 commits into
masterfrom
security/f004-attestation-freshness
Open

fix: reject stale and future-dated attestation blobs at provider registration#129
antojoseph wants to merge 2 commits into
masterfrom
security/f004-attestation-freshness

Conversation

@antojoseph
Copy link
Copy Markdown

Summary

  • Calls attestation.CheckTimestamp with a 5-minute max-age window immediately after VerifyJSON succeeds at provider registration
  • A replayed or future-dated attestation blob causes MarkUntrusted and an early return — no trust level is granted

Security impact

Without this fix, an attacker who obtained a valid attestation blob (even legitimately, from a machine they control) could replay it indefinitely to register fake provider identities with self_signed or higher trust. The 5-minute window matches the existing challenge cycle interval, so legitimate providers re-attesting normally are unaffected.

Test plan

  • go test ./internal/api/... ./internal/attestation/...
  • Send a registration with an attestation blob timestamped > 5 min ago and verify the provider is marked untrusted
  • Send a registration with a future-dated timestamp and verify same rejection

…stration

Calls attestation.CheckTimestamp with a 5-minute max-age window immediately
after VerifyJSON succeeds. A replayed or future-dated attestation blob is
rejected and the provider is marked untrusted before any trust level is granted.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
d-inference Ready Ready Preview May 4, 2026 3:41am
d-inference-console-ui-dev Ready Ready Preview May 4, 2026 3:41am
d-inference-landing Ready Ready Preview May 4, 2026 3:41am

Request Review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 41b6cb20ba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// provider could otherwise grant trust to a new connection without fresh
// hardware verification. 5 minutes matches the challenge cycle interval.
const attestationMaxAge = 5 * time.Minute
if !attestation.CheckTimestamp(result, attestationMaxAge) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject future attestations before trusting provider

This new gate calls attestation.CheckTimestamp, but that helper currently returns time.Since(result.Timestamp) <= maxAge (coordinator/internal/attestation/attestation.go), which evaluates to true for future timestamps because time.Since is negative. As a result, future-dated blobs are still accepted here even though the log/error path says they are rejected, so an attacker can use a far-future attestation timestamp to bypass the intended replay protection window.

Useful? React with 👍 / 👎.

time.Since is negative for future timestamps, so the previous
<= maxAge check was always true for future-dated blobs.
Now explicitly rejects timestamps more than 30s in the future.
Copy link
Copy Markdown
Contributor

@hankbobtheresearchoor hankbobtheresearchoor left a comment

Choose a reason for hiding this comment

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

LGTM. This adds the missing freshness gate before any provider trust is granted, and CheckTimestamp now explicitly rejects future-dated attestations instead of treating negative age as valid.

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