Skip to content

fix(tee): check the TSM provider before reading outblob - #112

Merged
imran-siddique merged 1 commit into
agentrust-io:mainfrom
Susanpdl:fix/tsm-check-provider-first
Aug 17, 2026
Merged

fix(tee): check the TSM provider before reading outblob#112
imran-siddique merged 1 commit into
agentrust-io:mainfrom
Susanpdl:fix/tsm-check-provider-first

Conversation

@Susanpdl

Copy link
Copy Markdown
Contributor

The non-blocking follow-up from your review of #86.

What was wrong

collect_report read outblob and then checked provider:

(entry / "inblob").write_bytes(report_data)
outblob = (entry / "outblob").read_bytes()
provider = (entry / "provider").read_text().strip()

if provider != expect_provider:
    raise AttestationFailed(...)

Reading outblob is what makes the platform generate and sign the report, so on a mismatched provider the hardware signed a report over the caller's binding and it was then thrown away. As you said, nothing is returned and the entry is removed, so this is not a disclosure. It is asking the hardware to sign something no one can use, and the check costs nothing where it belongs.

The provider check now gates the read. The two failures also read differently now, since they are different problems: an entry that names no provider cannot be trusted to be the right platform, and a matching provider that returns nothing is a collection failure.

Making it stick

The interesting part was that the old test could not have caught this, because the fake configfs tree wrote outblob when inblob was written. That made the read a plain file read with no observable effect, which is exactly the property that matters here inverted.

The fake now generates the report when outblob is read, which is the kernel's actual sequence, and records which attributes were read. test_collect_report_refuses_the_wrong_platform then asserts reads == [], so a mismatch means the report was never produced rather than produced and discarded.

I checked the test fails against the old ordering rather than passing vacuously: restoring the previous sequence fails two tests, including that one.

Testing

429 passed, 3 skipped. ruff check, ruff format --check, mypy and bandit all clean.

Reading outblob is what makes the platform generate and sign a report,
so checking the provider afterwards meant a mismatched guest signed a
report over the caller's binding which was then discarded. Nothing was
returned and the entry was removed either way, so this was not a
disclosure, but it asked the hardware to sign something no one could
use.

The provider check now gates the read, and a test asserts outblob is
never read on a mismatch so the ordering cannot quietly regress. The
fake configfs tree now generates the report on outblob read rather than
on inblob write, which is the kernel's actual sequence and is what makes
that assertion mean anything.

Follow-up requested on review of agentrust-io#86.

Signed-off-by: Susan Poudel <susanpdl77@gmail.com>
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@imran-siddique imran-siddique 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 the provider-before-outblob ordering and the adversarial configfs test. The wrong-provider path now performs zero outblob reads, avoiding unnecessary hardware report generation. Hosted tests, CodeQL, analysis, governance, Windows/Linux matrices, Ruff, mypy, and bandit are green. Approving.

@imran-siddique
imran-siddique merged commit 454721a into agentrust-io:main Aug 17, 2026
13 of 14 checks passed
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.

3 participants