Harden TTP protocol MVP - #42
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 50ef39c263
ℹ️ 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".
| const expiresAt = parseDate(claim.expires_at, "expires_at"); | ||
| if (evaluatedAt > expiresAt) { |
There was a problem hiding this comment.
Reject future-dated trust claims
When --at is earlier than claim.issued_at, the evaluator still returns TRUST_PROOF_VALID: only expires_at is checked here, freshness only checks for age greater than the window, and decay clamps negative elapsed time to zero. A future-dated trust claim can therefore be accepted before it exists, which breaks execution-time trust evaluation for any caller evaluating historical or skewed timestamps; parse issued_at unconditionally and fail closed when evaluatedAt < issuedAt.
Useful? React with 👍 / 👎.
| blockPattern.lastIndex = index; | ||
| const match = blockPattern.exec(source); |
There was a problem hiding this comment.
Reject garbage between top-level blocks
Because exec() searches forward from index without validating source.slice(index, match.index), any non-comment text between two valid blocks is silently skipped as long as another recognized block follows. For example, a stray this is garbage line between subject and trust still makes ttp check succeed, so malformed .ttp files can pass the new syntax validation; check the gap before each match the same way the trailing content is checked.
Useful? React with 👍 / 👎.
No description provided.