Skip to content

enroll: R14 — || die guards on remaining unguarded commands#186

Merged
mdheller merged 1 commit into
mainfrom
fix/enroll-fourteenth-audit
Jun 16, 2026
Merged

enroll: R14 — || die guards on remaining unguarded commands#186
mdheller merged 1 commit into
mainfrom
fix/enroll-fourteenth-audit

Conversation

@mdheller

Copy link
Copy Markdown
Contributor

Round 14 audit findings

# Severity Location Finding
1 MEDIUM minisign -G (step 8) No || die — non-zero exit fires set -e before the [[ -s ]] guard from R13 can print a diagnostic
2 LOW mkdir -p / chmod 700 (step 0) &&-chained with no || die; split into two statements each with guard
3 LOW install -m 600 (step 4) No || die on .env copy
4 LOW printf → .tmp && mv for age.pub (step 3) Atomic write chain had no || die
5 LOW printf → .tmp && mv for katello-admin-pw (step 4) Same pattern
6 LOW cat > nix-cache-info.tmp <<EOF + mv (step 8) Neither write nor rename had || die; heredoc wrapped in group command

Changes

  • minisign -G ... || die "..." with diagnose hint
  • mkdir -p ... || die + chmod 700 ... || die (two lines)
  • install -m 600 ... || die
  • printf ... && mv ... || die for both atomic password file writes
  • { cat > .tmp <<EOF ... EOF } || die + mv .tmp final || die for nix-cache-info

All six changes are mechanical || die additions to commands that were already correct but lacked operator-visible diagnostics on failure.

Test plan

  • bash -n scripts/enroll.sh passes (verified)
  • Re-run idempotency preserved (all guarded paths are in if [[ ! -f ]] or fresh-generate branches)

Six findings, all LOW/MEDIUM severity:

- MEDIUM: minisign -G had no || die; non-zero exit fired set -e before the
  [[ -s ]] guard (from R13) could run, leaving no remediation hint.

- LOW: mkdir -p / chmod 700 on SOURCEOS_DIR used && chaining with no || die;
  split into two statements each with || die.

- LOW: install -m 600 for COMPOSE_ENV had no || die; added with disk/perm hint.

- LOW: printf → .tmp && mv for AGE_PUB and KATELLO_ADMIN_PW_FILE had no || die
  on the combined write; added || die at end of each && chain.

- LOW: cat > nix-cache-info.tmp <<EOF and its mv had no || die; wrapped heredoc
  in a group command and added || die to both the write and the mv.
@mdheller mdheller merged commit 36ed613 into main Jun 16, 2026
@mdheller mdheller deleted the fix/enroll-fourteenth-audit branch June 16, 2026 20:25
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