Skip to content

TdPolicyAttestation source; bounty to 31 January 2027 - #77

Merged
brainchaindev merged 2 commits into
mainfrom
publish-td-policy
Nov 22, 2026
Merged

brainchaindev merged 2 commits into
mainfrom
publish-td-policy

Conversation

@brainchaindev

Copy link
Copy Markdown
Contributor

Publishes the source and tests of TdPolicyAttestation, the contract every mainnet DecisionLog uses as its attestation verifier since 10 November (0xdb2a8FA9018946438772DCB0756e39b17F81E416). It passes each quote to Automata's DCAP verifier and refuses a quote from a TD that can be debugged, whose host could read its memory while it reports the same measurements.

Also moves the bounty's closing date to 23:59 UTC on 31 January 2027 and links the first round's results on docs.usebrainchain.com/security.

forge test --match-path test/TdPolicyAttestation.t.sol: 11 passed.

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

BrainChain review

SECURITY.md, line 35: the sentence about late reports is dropped. The old text said reports sent after the close were still welcome and earned advisory credit with no payment. The new line 35 and line 49 say nothing about reports after 31 January 2027. Reporters then don't know whether a late report is welcome or credited. Fix, if the old policy still holds:

The bounty is open until 23:59 UTC on 31 January 2027, on the terms below. Reports sent after that are still welcome at the same addresses and earn credit in the advisory, with no payment. Results of the first round (7 to 22 November 2026) are at https://docs.usebrainchain.com/security#results-7-to-22-november-2026.

src/TdPolicyAttestation.sol: no defect found. What I checked:

  • Offsets. The header is 2+2+1+6 = 11 bytes. Adding the 112 bytes of TCB SVN, MRSEAM and MRSIGNERSEAM gives SEAMATTRIBUTES at 123 and TDATTRIBUTES at 131. The test vector agrees: bytes 123–130 are zero, and byte 134 is 0x10, which is bit 28 (SEPT_VE_DISABLE) in little-endian order.
  • DEBUG bit. Byte 131 is the low byte of TDATTRIBUTES, so bit 0 (DEBUG) and the reserved TUD bits all fall in the out[TD_ATTRIBUTES] == 0 check.
  • Bounds and reads. ATTRIBUTES_END is 139, so every out[i] read is in range.
  • Failure paths. A refusal by the verifier, a short output and a non-TD body type all return false.
  • Test offsets. The test's MRTD (147), RTMR0–2 (339) and RTMR3 (483) offsets are consistent with the same layout.

What I could not see:

  • DecisionLog.sol and IDcapAttestation. I could not confirm that attestBrain reverts with QuoteRejected whenever the returned ok is false. I also could not confirm that the interface declares both overloads as payable. The log tests exercise this but I could not run them.
  • Automata verifier's ETH handling. Both wrappers forward msg.value, and the contract has no receive function or refund path. If the verifier ever refunds ETH, it would be stuck, which I could not rule out.
  • TDX module behaviour. The requirement that SEAMATTRIBUTES be zero is stated as true for every released module. A future module that sets it would make this policy refuse every quote. The owner could then switch the log to another attestation contract with setAttestation.

Reviewed through BrainChain. Jev, a decision model from TypeSafe, hired the model and accepted this review, so the model earns 0.97 USDG. Paid 1 USDG on Robinhood Chain; see task 11. Reviewed at fcb95dd.

@brainchaindev
brainchaindev merged commit 6aa1e5d into main Nov 22, 2026
5 checks passed
@brainchaindev
brainchaindev deleted the publish-td-policy branch November 22, 2026 10:42
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.

1 participant