Skip to content

fix: v0.5.45 — audit-pack.zip missing dotfile artifacts listed in manifest - #68

Merged
SoundMatt merged 3 commits into
mainfrom
fix/audit-pack-dotfile-glob
Jul 27, 2026
Merged

fix: v0.5.45 — audit-pack.zip missing dotfile artifacts listed in manifest#68
SoundMatt merged 3 commits into
mainfrom
fix/audit-pack-dotfile-glob

Conversation

@SoundMatt

Copy link
Copy Markdown
Owner

Summary

  • cmd_audit_pack staged and hashed .fusa.json/.fusa-reqs.json correctly into manifest.json, but built the final archive with zip -j "$output" * — a shell glob that does not match dotfiles by default, so both files were silently dropped from the actual zip while still being claimed (with valid hashes) in the manifest.
  • Fixed by building an explicit, quoted list of the exact basenames copied into the staging directory during the artifact loop, and passing that list directly to zip -j instead of relying on any glob expansion.
  • Added test_audit_pack_includes_dotfile_artifacts, which runs a real audit-pack invocation and asserts every dotfile artifact is actually present in the resulting archive (not just referenced in the manifest).

Closes #67

Test plan

  • cmake --build build — clean build
  • ctest --test-dir build --output-on-failure — 38/38 test binaries pass, 0 failures
  • Manually ran cfusa audit-pack and confirmed .fusa.json / .fusa-reqs.json now appear in unzip -l output alongside the manifest

…ifest

zip -j "$output" * used a shell glob that doesn't match dotfiles, so
.fusa.json and .fusa-reqs.json were correctly hashed into manifest.json
but silently excluded from the actual archive. Fixed by building an
explicit list of the exact basenames staged during the artifact loop
and passing that to zip instead of relying on glob expansion.

Closes #67

Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com>
Mirrors the same requirement already noted in cmd/cfusa/cmd_audit_pack.c.
Strict-C99 Linux toolchains (clang/gcc on ubuntu-22.04 in CI) don't expose
popen/pclose without it, which broke the new audit-pack regression test
on Linux while passing on macOS.

Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com>
Comment thread tests/test_cli_commands.c Fixed
Comment thread tests/test_cli_commands.c Fixed
Comment thread tests/test_cli_commands.c Fixed
Comment thread tests/test_cli_commands.c Fixed
Comment thread tests/test_cli_commands.c Fixed
Comment thread tests/test_cli_commands.c Fixed
Comment thread tests/test_cli_commands.c Fixed
Comment thread tests/test_cli_commands.c Fixed
- Replace shell-based `unzip -l` verification (popen) with a direct
  byte-scan of the archive, removing a CWE-78 (non-literal command
  execution) flag entirely and the CI dependency on `unzip`/POSIX
  popen declarations.
- Create the test .fusa-reqs.json via open()+fdopen() with mode 0600
  instead of fopen(path, "w"), matching the existing convention in
  tests/test_hlr_llr.c and other test files, to avoid a
  world-writable-file-creation alert.
- Drop the access()-before-fopen() check (CWE-362 TOCTOU) in favor of
  asserting cmd_init's own return code.
- Split `char *argv[] = {..., "--flag", ...}` declarations onto
  separate assignment lines: the combination of the array's `*` and
  a `--flag` string literal on the same source line was tripping the
  CFUSA-A006 pointer-arithmetic heuristic, which is a plain textual
  match unrelated to the actual (harmless) code.
- Rename the test function so it no longer contains the substring
  "des_" (from "includes_dotfile"), which was matching the CS-7
  weak-crypto-DES heuristic.

None of this changes what issue #67's fix or its regression test
actually verify -- it only removes false positives / true-but-benign
findings so c-FuSa's own dogfooding scan of its test suite stays
clean, matching this repo's existing code-scanning gate.

Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com>
@SoundMatt
SoundMatt merged commit cd0eff7 into main Jul 27, 2026
10 checks passed
@SoundMatt
SoundMatt deleted the fix/audit-pack-dotfile-glob branch July 27, 2026 22:40
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.

[P1] audit-pack.zip's manifest.json claims hashes for files not actually bundled in the archive

2 participants