Skip to content

Fix GHSA-c6rj-wmf4-6963, add nushell hooks, cargo-vet, PKGBUILD LTO#51

Merged
sheeki03 merged 9 commits intomainfrom
fix/advisory-and-issues
Feb 24, 2026
Merged

Fix GHSA-c6rj-wmf4-6963, add nushell hooks, cargo-vet, PKGBUILD LTO#51
sheeki03 merged 9 commits intomainfrom
fix/advisory-and-issues

Conversation

@sheeki03
Copy link
Owner

@sheeki03 sheeki03 commented Feb 24, 2026

Summary

  • Fix GHSA-c6rj-wmf4-6963 security advisory
  • Add nushell shell hooks
  • Add cargo-vet integration
  • Add LTO to PKGBUILD for AUR
  • Fix Windows TOCTOU race, doctor path quoting, case-insensitive cargo detection
  • Escape nushell doctor hook path for embedded quotes/backslashes

Test plan

  • All existing tests pass

🤖 Generated with Claude Code

Note

Add cargo vet check during Exec scans and introduce Nushell hooks across CLI and packaging to address GHSA-c6rj-wmf4-6963

Add a VetNotConfigured rule in tirith-core that flags cargo install/add when supply-chain/config.toml is missing, pass cwd and scan_context into rules::command::check, and add Nushell hook support in CLI and packaging, including AUR PKGBUILD LTO disable and asset installation.

📍Where to Start

Start with rules::command::check and the new vet logic in command.rs, then see the callsite in engine.rs.

Macroscope summarized 7c5168f.

sheeki03 and others added 6 commits February 23, 2026 19:07
Security (GHSA-c6rj-wmf4-6963):
- audit.rs: refuse symlinks + O_NOFOLLOW via libc
- last_trigger.rs: replace predictable tmp with NamedTempFile
- receipt.rs: replace predictable tmp with NamedTempFile
- runner.rs: replace predictable cache write with NamedTempFile
- Move tempfile from dev-deps to deps, add libc unix dep

Issue #34 — PKGBUILD LTO build failure:
- Add options=(!lto) for ring crate compatibility
- Bump pkgver to 0.1.9

Issue #35 — Nushell shell hook support:
- Add warn-only nushell-hook.nu (pre_execution cannot block)
- Wire into init, doctor, assets, PKGBUILD, deb packaging
- Exact-match normalize_shell_name to avoid gnu* false positives

Issue #36 — Cargo-vet supply-chain audit:
- Add VetNotConfigured rule (Low severity, exec-only)
- Add cargo_vet tier-1 pattern in build.rs
- Skip vet check when cwd is unknown (golden fixture safety)
- 6 deterministic unit tests for vet rule

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1. [High] Make audit.rs symlink check cross-platform — move
   symlink_metadata check out of #[cfg(unix)] so Windows builds
   also refuse to follow symlinks. O_NOFOLLOW remains Unix-only.

2. [Medium] Fix nushell doctor guidance — replace predictable
   /tmp/tirith-nu-hook.nu path with safe sourcing instruction
   pointing to materialized hook directory.

3. [Medium] GHSA tests now exercise production functions — extract
   Receipt::save_to() and write_last_trigger_to() for testability.
   Tests call real code paths instead of recreating patterns.

4. [Low] Cargo detection handles Windows paths — split on both
   / and \ separators, strip .exe suffix before comparison.
   New test: test_vet_detects_cargo_exe_windows_path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1. [High] audit.rs: add FILE_FLAG_OPEN_REPARSE_POINT (0x00200000)
   on Windows to prevent kernel-level symlink following, closing the
   TOCTOU race between symlink_metadata() and open().

2. [Medium] doctor.rs: use resolved info.hook_dir for nushell
   source path instead of hardcoded ~/.local/share/tirith/... which
   breaks when XDG_DATA_HOME is customized.

3. [Low] command.rs: normalize cargo command name with
   eq_ignore_ascii_case and strip both .exe/.EXE suffixes so
   CARGO.EXE on Windows is detected by the vet rule.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Quote nushell hook path in doctor output to handle spaces/metacharacters
- Normalize cargo binary name to lowercase before .exe stripping, handling
  mixed-case variants like Cargo.ExE on Windows

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Nushell single-quoted strings are literal (no interpolation or escape
sequences), so embedded double-quotes or special characters in the
hook directory path cannot cause malformed output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Nushell single-quoted strings have no escape mechanism, so a path
containing ' would produce malformed output. Switch to double-quoted
Nushell string with \ and " escaped, which handles all path characters
safely.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
sheeki03 and others added 3 commits February 24, 2026 22:56
- Merge origin/main (already up to date)
- Fix single & segment boundary in split_raw_words (security)
- Use exact match == TIRITH=0 (prevents false bypass)
- Skip flags in resolve_command_wrapper
- Remove dead code in is_tirith_command
- Remove quote-stripping in is_env_assignment (callers handle this)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolved 12 conflicts by keeping main's improved code. Used main's
audit.rs (without libc O_NOFOLLOW). Added dead_code allow for unused
NUSHELL_HOOK constant.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ct resolution

The merge conflict resolution took main's versions of init.rs, command.rs,
and build.rs, losing PR 51's unique features:
- Nushell shell init support (match arm, normalize_shell_name, materialize)
- cargo-vet check_vet_not_configured() rule with 8 tests
- cargo_vet tier-1 pattern in build.rs
- Updated command::check() signature to accept cwd and scan_context

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sheeki03 sheeki03 merged commit ea57af8 into main Feb 24, 2026
9 checks passed
@sheeki03 sheeki03 deleted the fix/advisory-and-issues branch February 24, 2026 21:58
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