Skip to content

Harden the primary log sink#195

Merged
codeforester merged 3 commits into
mainfrom
bug/192-20260725-primary-log-sink-hardening
Jul 25, 2026
Merged

Harden the primary log sink#195
codeforester merged 3 commits into
mainfrom
bug/192-20260725-primary-log-sink-hardening

Conversation

@codeforester

Copy link
Copy Markdown
Collaborator

Summary

  • make persistent-sink eligibility reflect the configured filesystem path
  • keep log_is_enabled non-mutating while rejecting missing-parent,
    non-regular, symlink, non-owned, and unwritable targets
  • create new primary logs privately and normalize new or existing files to
    mode 0600 before appending
  • suppress best-effort setup and redirection failures, then disable a failed
    path for the remainder of the process
  • apply the same sink contract to structured and file-content logging

Issue

Closes #192

Validation

  • bats lib/bash/std/tests/lib_std.bats — 159 tests passed locally, with one
    environment-specific process-listing skip
  • ./tests/validate.sh — 321 tests passed
  • shellcheck --severity=warning lib/bash/std/lib_std.sh
  • git diff --check

Notes

  • This PR is stacked on Stop implicit argv logging #194; its base branch is
    security/191-20260725-safe-argv-logging.
  • Successful terminal behavior and rendered log records are unchanged.
  • log_is_enabled does not create or chmod a path; the final setup and append
    remain best-effort across filesystem races and I/O failures.
  • Parent-directory creation, ACL removal, rotation, and new public sink APIs are
    out of scope.
  • Run logging smoke tests on actual Bash 4.2 #193 will add an actual Bash 4.2 logging smoke test over the completed path.
  • VERSION remains unchanged; this work is targeted to the v1.4.0
    milestone.

Checklist

  • Branch name follows <category>/<issue>-<YYYYMMDD>-<slug>.
  • Pull request is scoped to one issue, unless a documented multi-issue exception applies.
  • Pull request body explains what changed and how it was validated.
  • Relevant project checks pass.
  • Documentation is updated when behavior or user-facing commands change.
  • CHANGELOG is updated for notable user-visible or release-worthy changes.
  • Pull request includes Fixes #<issue> or Closes #<issue> when merge should close the issue.

Base automatically changed from security/191-20260725-safe-argv-logging to main July 25, 2026 23:03
@codeforester
codeforester force-pushed the bug/192-20260725-primary-log-sink-hardening branch from cd96d13 to a0f3559 Compare July 25, 2026 23:04
@codeforester codeforester mentioned this pull request Jul 25, 2026
10 tasks
@codeforester
codeforester marked this pull request as ready for review July 25, 2026 23:07
@codeforester
codeforester merged commit ac681a1 into main Jul 25, 2026
2 checks passed
@codeforester
codeforester deleted the bug/192-20260725-primary-log-sink-hardening branch July 25, 2026 23:07
codeforester added a commit that referenced this pull request Jul 25, 2026
## Summary

- add one standalone logging smoke script that runs under any supported
Bash
  and can assert an exact interpreter version
- exercise default INFO output, dependency category isolation,
dotted-category
inheritance, `log_is_enabled`, DEBUG persistence, mode `0600`, file
logging,
  UTC timestamps, and VERBOSE compatibility
- run the smoke in normal local validation
- add a dedicated Ubuntu job using the Docker Official Bash 4.2.53 image
pinned
  to its immutable linux/amd64 manifest digest
- isolate the compatibility container with a read-only repository, no
network,
dropped capabilities, `no-new-privileges`, a PID limit, and a bounded
tmpfs

## Issue

Closes #193

## Validation

- `tests/bash-42-logging-smoke.sh` — passed on local Bash 5.3.15
- `tests/bash-42-logging-smoke.sh 5 3 15` — exact-version assertion path
passed
- `./tests/validate.sh` — 321 BATS tests plus the logging smoke passed
- `tests/lint-warnings.sh`
- workflow YAML parsed successfully
- `git diff --check`

## Notes

- This PR is stacked on #195; its base branch is
  `bug/192-20260725-primary-log-sink-hardening`.
- The local Docker daemon was unavailable, so the new GitHub Actions job
is the
  exact Bash 4.2.53 runtime proof.
- The pinned image is

`docker.io/library/bash@sha256:0931edd3941d0603cb3d5da1cb298cf3eb6a579e09e094c3e34e2d5e9df8cddc`.
- The complete BATS suite remains on hosted macOS and Ubuntu runners;
the
  minimal 4.2 image runs only the focused compatibility contract.
- No changelog entry is needed for this CI-only change.
- `VERSION` remains unchanged; this work is targeted to the `v1.4.0`
  milestone.

## Checklist

- [x] Branch name follows `<category>/<issue>-<YYYYMMDD>-<slug>`.
- [x] Pull request is scoped to one issue, unless a documented
multi-issue exception applies.
- [x] Pull request body explains what changed and how it was validated.
- [x] Relevant project checks pass.
- [x] Documentation is updated when behavior or user-facing commands
change.
- [x] CHANGELOG is updated when the change is notable and
release-worthy.
- [x] Pull request includes `Fixes #<issue>` or `Closes #<issue>` when
merge should close the issue.
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.

Harden primary diagnostic sink eligibility and permissions

1 participant