Skip to content

Re-pin keep v0.7.5; assert fail-closed unlock stdout is byte-empty#98

Merged
kwsantiago merged 1 commit into
mainfrom
repin-keep-v0.7.5
Jul 12, 2026
Merged

Re-pin keep v0.7.5; assert fail-closed unlock stdout is byte-empty#98
kwsantiago merged 1 commit into
mainfrom
repin-keep-v0.7.5

Conversation

@kwsantiago

@kwsantiago kwsantiago commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

What

Re-pin the keep input v0.7.4 → v0.7.5, and tighten the shared fail_closed test helper now that the fix it worked around has landed.

Why

keep v0.7.5 (privkeyio/keep#740) stops the terminal alt-screen-exit escape (\e[?1049l) from leaking onto oprf-unlock's key-only stdout when the frost gate SIGTERMs it on the fail-closed path. Previously fail_closed had to strip ANSI escapes before asserting stdout was empty, tolerating that stray escape. With the fix, a fail-closed unlock writes nothing to stdout, so the helper now asserts the raw bytes are empty — dropping the workaround and, as a bonus, catching any future stray write to the key-only stdout (byte-empty subsumes the old "no 32-byte key" guard).

Verification

Ran oprf-unlock-2of3 locally against keep-cli 0.7.5 (838s): its Leg C fail-closed path passes the tightened raw_size == 0 assertion — confirming the escape is gone end-to-end at the appliance level. duress-freeze (also uses fail_closed) is exercised by the full matrix.

Closes keep-node-95y.

Summary by CodeRabbit

  • Bug Fixes

    • Improved protection against unintended output when an unlock operation fails, ensuring no data is emitted.
  • Chores

    • Updated the bundled keep dependency to version 0.7.5 for the latest upstream improvements.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The flake updates the pinned keep input from v0.7.4 to v0.7.5. OPRF fail-closed tests now require failed unlock attempts to produce no raw stdout bytes.

Changes

Keep version and OPRF validation

Layer / File(s) Summary
Update keep input
flake.nix
The keep input is repinned from the v0.7.4 tag to v0.7.5.
Require empty raw stdout
tests/lib/oprf-common.nix
The fail_closed assertion checks raw stdout size directly and reports any leaked byte count.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: full-ci

Poem

I’m a rabbit with a tidy flake,
And empty stdout is what tests now make.
Keep hops to seven-five,
Clean failures arrive,
No secret bytes escape the burrow’s gate.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the two main changes: repinning keep to v0.7.5 and tightening the fail-closed stdout assertion.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch repin-keep-v0.7.5

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/lib/oprf-common.nix`:
- Around line 124-134: The downstream test comment describing the shared helper
is stale: update the comment near the fail_closed call in tests/oprf-unlock.nix
to state that the helper asserts the captured stdout is exactly zero raw bytes,
without ANSI stripping. Keep the fail_closed invocation and test behavior
unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0d721d70-b1cb-48d8-8292-917211535d44

📥 Commits

Reviewing files that changed from the base of the PR and between d470cd3 and f3582bc.

⛔ Files ignored due to path filters (1)
  • flake.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • flake.nix
  • tests/lib/oprf-common.nix

Comment thread tests/lib/oprf-common.nix
Comment on lines +124 to +134
# property is "a failed unlock reconstructs no usable key." As of keep 0.7.5 (keep-node-95y) a
# fail-closed oprf-unlock exit writes NOTHING to stdout: the terminal alt-screen-exit escape
# (`\e[?1049l`) the SIGTERM/panic handler used to leak is now suppressed for non-TUI commands, so
# stdout is strictly empty -- no ANSI stripping needed, and we assert the raw bytes directly. (On
# the SUCCESS path stdout is exactly the 32-byte key -- verified in the 2-of-2 fixture -- so the
# frost-gate's key capture is unaffected.) Asserting byte-empty subsumes "no 32-byte key" and
# also catches any future stray write to the key-only stdout.
raw_size = node.succeed(f"stat -c %s {out_path}").strip()
assert raw_size != "32", f"fail-closed unlock leaked a 32-byte key ({raw_size} bytes, {out_path})"
assert raw_size == "0", (
f"fail-closed unlock wrote {raw_size} bytes to stdout; it must be empty (no key, no control bytes) ({out_path})"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Stale comment in downstream tests/oprf-unlock.nix.

The updated fail_closed no longer strips ANSI escapes — it asserts raw byte count is zero. However, the call site in tests/oprf-unlock.nix (lines 212–213) still says: "The shared helper strips keep-cli's error-path terminal escape before asserting the remainder is empty." That comment is now inaccurate and should be updated to reflect the raw-byte-empty assertion.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/lib/oprf-common.nix` around lines 124 - 134, The downstream test
comment describing the shared helper is stale: update the comment near the
fail_closed call in tests/oprf-unlock.nix to state that the helper asserts the
captured stdout is exactly zero raw bytes, without ANSI stripping. Keep the
fail_closed invocation and test behavior unchanged.

@kwsantiago
kwsantiago merged commit ad8369d into main Jul 12, 2026
38 checks passed
@kwsantiago
kwsantiago deleted the repin-keep-v0.7.5 branch July 12, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant