8000 fix(bep): test the tpm auth file owner check without root and bound its read by bryan-minimal · Pull Request #3543 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@bryan-minimal
Copy link
Copy Markdown
Member

What

Two follow-ups to #3510, both from review notes there:

  1. The owner and mode check of a TPM key's authorization file can now be tested without root.
  2. The read of that file is bounded.

Refs #3510

A correction to what I said on #3510

I replied there that a length check already ran after the read. That was wrong: no length check existed. The file was read whole, whatever its size. This PR adds the bound.

1. The owner check

The check moves into check_auth_file, which takes the file's owner, its mode and the proxy's user id as values. A test can then refuse a file owned by another user without creating one, which needs root.

2. The bound

The read stops at four times the length the store writes. It reads at most one byte past that bound, into a buffer sized for it. A longer file is refused at start as a store error. A file of several GiB no longer makes the proxy allocate its size.

Testing

  • the_auth_file_check_refuses_another_owner_and_modes_others_can_use
  • an_oversized_tpm_auth_file_refuses_start_without_reading_it_whole: a file exactly at the bound is read, and one byte more is refused.

Workspace lint, tests and the native end-to-end script pass on this commit.

🤖 Generated with Claude Code

…ts read

The owner and mode check of a TPM key's authorization file moves into
check_auth_file, which takes the file's owner and mode and the proxy's
user id, so a test can refuse another user's file without running as
root.

The read of the authorization file is now bounded at four times the
length the store writes: it reads at most one byte past the bound into
a buffer sized for it, and a longer file is refused at start as a store
error instead of being read whole. A file of several GiB no longer
makes the proxy allocate its size.

Refs #3510

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bryan-minimal
bryan-minimal requested a review from a team as a code owner November 18, 2026 17:07
@coderabbitai
coderabbitai Bot commented Nov 18, 2026
Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 1 billable file and costs up to $0.25.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 48 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: c153caed-19bd-45e6-bbfd-671689da877f
Commits

Reviewing files that changed from the base of the PR and between ff906b9 and fb7d194.

Files selected for processing: 1

  • crates/bep/src/tpm.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@minimal-foundry
minimal-foundry Bot commented Nov 18, 2026 •
Copy link
Copy Markdown
Contributor

Approved: no findings at fb7d194de054.

Nothing to do.

Clobber: none seen.

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minimal-review — approved

Verdict APPROVE — No findings.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 18, 2026
@bryan-minimal
bryan-minimal added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 2af0ca8 Nov 19, 2026
40 checks passed
@bryan-minimal
bryan-minimal deleted the fix/tpm-auth-file-followup branch November 19, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0