Skip to content

fix(verify/tcg_event_log): reject duplicate algorithm IDs, mismatched digest sizes, and trailing Spec ID header bytes (#812) - #817

Open
drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-tcg-event-log-812
Open

drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-tcg-event-log-812

Conversation

@drk-ram

@drk-ram drk-ram commented Oct 25, 2026

Copy link
Copy Markdown

What

Reject duplicate alg_id declarations, zero or mismatched digest_size values for known algorithms (ALG_SHA1, ALG_SHA256, ALG_SHA384, ALG_SHA512), and trailing bytes after vendorInfo in _parse_spec_id, and reject duplicate alg_id entries per event and non-bytes input in parse_event_log.

Why

Closes #812.

Security impact

Prevents a crafted TCG Spec ID header from declaring truncated digest sizes (e.g., 4-byte SHA-256) or duplicate algorithm entries that overwrite earlier PCR event digests during replay.

Test plan

  • pytest passes (pytest tests/unit/test_tcg_event_log.py -q: 15 passed)
  • ruff check passes (All checks passed!)
  • mypy passes
  • Manual test performed

DCO sign-off

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Contributor Check: MEDIUM

Check Result
Profile MEDIUM
Credential LOW
Overall MEDIUM

Automated check by AgenTrust Contributor Check.

@github-actions github-actions Bot added the needs-review:MEDIUM Contributor check flagged MEDIUM risk label Oct 25, 2026

@noah-ing noah-ing 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.

Reviewed exact head e095d18 against #812. Independent synthetic TCG event-log controls confirm that duplicate Spec ID algorithms, zero or wrong digest sizes, inconsistent or truncated vendorInfo, and duplicate EVENT2 digests are rejected; valid logs, including nonempty vendorInfo, continue to parse and replay. The 15 focused tests passed, as did the full unit suite (2,530 passed, 20 skipped), touched-file lint, and type checking.

I found no blocking issue in this PR's scope and approve the change. The controls were synthetic; normal hosted checks and maintainer approval still apply.

@carloshvp carloshvp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed exact head e095d18a6c2afd1055a4872782df884b93a1a95c in an isolated checkout.

The parser rejects duplicate algorithm declarations/digests, incorrect known digest widths and Spec ID vendor-info framing errors, while retaining supported valid event logs. All five focused malformed-log cases pass at this head; four rejection assertions fail when the actual baseline parser is restored in process. No blocking finding in the changed parsing/replay boundary.

Independent validation in a fresh repository-hash-locked Python 3.12.10 environment: 2,530 tests passed, 20 skipped; pip check, configured Ruff, mypy, Bandit and diff whitespace checks passed. Commit sign-offs are present. Hosted CI and applicable independent maintainer/security gates remain separate prerequisites to merge.

Reviewed with OpenAI Codex.

… digest sizes, and trailing Spec ID header bytes (agentrust-io#812)

Signed-off-by: Raghuvar Karthik Durga <177662415+drk-ram@users.noreply.github.com>
@drk-ram
drk-ram force-pushed the drk-ram-fix-tcg-event-log-812 branch from e095d18 to 51c0d56 Compare October 31, 2026 15:53

This branch has not been deployed

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

Labels

needs-review:MEDIUM Contributor check flagged MEDIUM risk

Projects

None yet

3 participants