Skip to content

Fix module release packaging and verifier ownership - #63

Merged
senamakel merged 9 commits into
mainfrom
tinybox-release-validation-fix
Oct 12, 2026
Merged

senamakel merged 9 commits into
mainfrom
tinybox-release-validation-fix

Conversation

@senamakel

Copy link
Copy Markdown
Member

The v0.1.22 release exposed two packaging failures: Ubuntu host keys include a version dot that the archive builder rejected, and distro verification ran as root against a workspace mounted for another UID. This change accepts safe dotted host labels and passes the supplied workspace UID/GID to the verifier, transferring ownership only of its private extracted module directory before the privilege drop. TinyBus admission checks remain unchanged.\n\nValidation: python3 scripts/test-package-layout.py (4/4); bash -n scripts/build-module.sh scripts/test-distro.sh scripts/verify-module.sh; git diff --check origin/main...HEAD. The test suite pins dotted archive naming/attestation, UID/GID handoff ordering, prebuilt-verifier use, and rejection of archive traversal. The shipped distro workflow will exercise real module loading under the workspace UID in the next release.\n\nNo Rust API or module contract changes. The v0.1.22 tag remains immutable; a 0.1.23 release follows this fix.

senamakel and others added 9 commits October 12, 2026 09:24
Add a packaging test that builds with a dotted release host key and checks
the archive still ships the compiled library alongside a matching
modules.toml attestation.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The host key validation in both build scripts now accepts dots and
requires the key to start and end with an alphanumeric character, so
hostnames like `ubuntu-24.04` pass. Added package layout tests covering
the Linux verifier handoff and rejection of archive traversal.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The module verifier now accepts --uid and --gid and drops privileges via
setpriv before running the verifier binary, so archives are checked with the
same ownership the host user will see. The distro test image installs
util-linux for setpriv and passes the host ids through, and the verifier can
reuse a prebuilt binary via --verifier-bin instead of always invoking cargo.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The package layout test now invokes build-module.sh from the extracted
package root instead of the repository root, so it exercises the script
shipped in the archive. verify-module.sh also converts a relative
verifier binary path to an absolute one before changing directories,
which previously caused the verifier lookup to fail.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test read the extracted library path from the wrong argument position, so it now uses index 7 to match the verifier invocation it builds.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…r skips cargo

Remove the outdated tinybox 0.1.22 Ubuntu 24.04 tarball from release assets and extend the package layout test to stub a cargo binary and assert it is never invoked. This guards against the prebuilt verifier accidentally falling back to a source build.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The module verifier runs as an unprivileged uid via setpriv, but the
temporary work directory was still owned by root, so the verifier could
not write to it. Hand ownership to the target uid and gid before
dropping privileges.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The package layout test now stubs chown alongside setpriv and records the
order in which both are invoked, so it can verify the extracted workspace is
handed to its owner before privileges are dropped. It also checks that chown
receives the expected host uid, gid, and target directory.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Oct 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 5 billable files and costs up to $1.25.

Or wait 32 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4db3add1-a234-4764-8deb-576cec46ec37

📥 Commits

Reviewing files that changed from the base of the PR and between 59f659f and 00b40d8.


📒 Files selected for processing (5)
  • scripts/build-module.ps1
  • scripts/build-module.sh
  • scripts/test-distro.sh
  • scripts/test-package-layout.py
  • scripts/verify-module.sh

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@senamakel
senamakel merged commit 3d63859 into main Oct 12, 2026
14 checks passed
@senamakel senamakel mentioned this pull request Oct 12, 2026
@tinysweeper

tinysweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Tiny Sweeper completed its review; deterministic results follow.

State: Incomplete
Priority: none
Reviewed head: 00b40d8bd13b
Updated: 2026-10-12T22:47:40Z

Review snapshot

Change surface Files Review signal Count
Production 3 Active findings 0
Tests 2 Noted findings 0
Documentation 0 Resolved findings 0
Configuration 0 Pending checks/questions 4

Completeness: Incomplete
Test assessment: Test coverage is assessed from changed tests and lane evidence; execution is not claimed without trusted check data.

Features

  • Modified — Release host key pattern accepts dotted keys in the PowerShell build script: Host keys containing interior dots (for example ubuntu-24.04-x86_64) are no longer rejected as invalid, while a leading or trailing dot or a non-alphanumeric boundary is still refused; previously such keys failed packaging outright. (scripts/build-module.ps1, scripts/build-module.ps1#$root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path)
  • Modified — Release host key pattern accepts dotted keys in the shell build script: The bash build script applies the same widened host-key validation as the PowerShell script, so the two packaging entry points agree on which host keys are packable. (scripts/build-module.sh, scripts/build-module.sh#while (($#)); do)
  • Added — Structured argument parsing and uid/gid validation in verify-module.sh: Callers can pass --archive, --uid, --gid, and --verifier-bin in any supported position; a bare archive path is still accepted for backward compatibility; supplying only one of uid/gid or a non-numeric value exits with a usage error instead of silently running with an ambiguous identity. (scripts/verify-module.sh)
  • Added — Verifier selection: build on demand or use a supplied binary: When --verifier-bin is omitted the script builds the verify_module example at the resolved target root and locates it under release/examples; when supplied, a relative path is resolved against the current working directory and the binary must be executable, otherwise verification stops with an error rather than falling through. (scripts/verify-module.sh)
  • Added — Ownership handoff to the workspace owner under setpriv: Before verification runs as the caller-supplied identity, the extracted work directory is chowned to <uid>:<gid> and the verifier is launched with setpriv --reuid/--regid/--clear-groups, so artifacts written during verification belong to the host workspace owner rather than the invoking user; setpriv is required on PATH for this path. (scripts/verify-module.sh)
  • Added — Traversal rejection before the privilege handoff: Archive members that escape the extraction directory are rejected before chown, setpriv, or the verifier execute, so an unsafe archive cannot reach the privileged handoff or the verifier process. (scripts/verify-module.sh, scripts/test-package-layout.py)

Tests

  • unit — Feeds scripts/verify-module.sh an archive containing a "../escape" member with a stub setpriv on PATH, asserting a non-zero exit, the stderr message "archive member escapes the extraction directory", and that setpriv never ran.: Pins that traversal rejection happens before the privilege handoff, which is the security-relevant ordering claim in this change. Not executed in this review; presence and intent only. (scripts/test-package-layout.py, scripts/verify-module.sh)

Findings

No active actionable findings.

Could not review: scripts/test-distro.sh, scripts/test-package-layout.py, scripts/verify-module.sh, tinysweeper/description

Before merge

  • Complete the critique review for scripts/test-distro.sh, scripts/test-package-layout.py, scripts/verify-module.sh.
  • Complete the description review for tinysweeper/description.

How this fits together

flowchart LR
  n0["...t_library_bytes_from_a_symlinked_checkout"]:::impacted
  n1["decode"]:::impacted
  n2["stderr"]:::impacted
  n3["directory"]:::impacted
  n0 -->|calls| n1
  n0 -->|tests| n1
  n0 -->|uses| n2
  n0 -->|uses| n3
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading
Agent review details

critique

  • Conclusion: Success
  • Scope reviewed: incomplete; unanswered: scripts/test-distro.sh, scripts/test-package-layout.py, scripts/verify-module.sh
  • Positive: The critique lane recorded 3 files it could not review (scripts/test-distro.sh, scripts/test-package-layout.py, scripts/verify-module.sh) and noted the code index is behind this pull request, so retrieved context may be out of date; the description lane produced no usable response.
  • Lane summary: Reviewed 2 files; 0 findings. 3 files could not be reviewed: scripts/test-distro.sh, scripts/test-package-layout.py, scripts/verify-module.sh. _The code index is behind this pull request (indexed at `e1d3d72b135a`), so retrieved context may be out of date._

security

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The security lane reviewed all five changed files and reported no findings; the traversal rejection path is asserted to occur before chown/setpriv, and the uid/gid inputs are constrained to non-negative integers supplied together.
  • Lane summary: Reviewed 5 files; 0 findings. _The code index is behind this pull request (indexed at `e1d3d72b135a`), so retrieved context may be out of date._

tests

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The tests lane found no defect it could demonstrate from the evidence, noting the uid/gid guard, the setpriv presence check, and the chown of the extracted work directory are each exercised by the new tests, and that the util-linux container additions are image content that no unit test can meaningfully pin.
  • Positive: The new tests are written against the real build and verify scripts with stubbed external binaries rather than against reimplementations, and they include negative assertions (no Cargo invocation for a prebuilt verifier; setpriv not reached on a traversing archive).
  • Lane summary: This change tightens the release host-key pattern in both module build scripts, adds setpriv/uid-gid handoff with traversal rejection to verify-module.sh, and adds util-linux to the distro containers. The diff ships tests for exactly the new behaviour: test_archive_accepts_dotted_release_host_key_and_attests_library pins the widened (now dot-accepting) pattern through the real build script, test_linux_verifier_hands_admitted_archive_to_workspace_owner pins the chown-then-setpriv order and argument shape, and test_linux_verifier_rejects_archive_traversal_before_handoff pins the traversal rejection path. I found no defect I can demonstrate from the evidence: the uid/gid guard, the setpriv presence check, and the chown of the extracted work directory are all exercised, and the util-linux additions are container image content that no unit test can meaningfully pin here. _The code index is behind this pull request (indexed at `e1d3d72b135a`), so retrieved context may be out of date._

commits

  • Conclusion: Neutral
  • Scope reviewed: all assigned evidence
  • Positive: The commits lane reported nothing sensitive in what this pull request commits.
  • Lane summary: Nothing sensitive found in what this pull request commits.

description

  • Conclusion: Neutral
  • Scope reviewed: incomplete; unanswered: tinysweeper/description
  • Lane summary: No reviewer produced a usable response.
Evidence and run details
  • Models: ladder/vectors-oai3, deepseek-v4.1-flash,
  • Spend: $0.007792
  • Tokens: 480324 input · 93066 output · 94464 cached · 423 embedding
Head State Pass summary
00b40d8bd13b incomplete 0 active finding(s), 0 resolved finding(s) (at 2026-10-12T22:47:40Z)

tinysweeper 0.1.2

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tinysweeper found nothing blocking, but could not review everything, so this is not an approval: scripts/test-distro.sh, scripts/test-package-layout.py, scripts/verify-module.sh, tinysweeper/description.

             $0.0078 · 480,324 in / 93,066 out · 94,464 cached (20%) · ladder/vectors-oai3, deepseek-v4.1-flash,  · 423 embedded
critique:    $0.0033 · 196,623 in / 49,256 out · 74,752 cached (38%) · deepseek-v4.1-flash
security:    $0.0034 · 215,191 in / 28,143 out · 6,656 cached (3%)   · deepseek-v4.1-flash,
tests:       $0.0001 · 38,019 in  / 596 out    · 5,888 cached (15%)  · deepseek-v4.1-flash
description: $0.0007 · 23,682 in  / 11,744 out · 7,168 cached (30%)  · deepseek-v4.1-flash

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant