Skip to content

test(env): cover the config-file parser and run-dir cleanup guard#820

Merged
Chemaclass merged 1 commit into
mainfrom
test/env-config-and-cleanup
Jul 16, 2026
Merged

test(env): cover the config-file parser and run-dir cleanup guard#820
Chemaclass merged 1 commit into
mainfrom
test/env-config-and-cleanup

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

load_config_file evals export lines from .bashunitrc; only its happy path had acceptance-level coverage. Its edge cases — including the injection guard — were untested, as was the cleanup_run_output_dir safety check from #811.

💡 Changes

  • Unit tests for the parser: comments/blank lines, export prefix + quote stripping, env-over-file precedence, invalid-identifier rejection, missing-file no-op.
  • Security property pinned: command substitutions in values stay literal text; keys with shell metacharacters are skipped, never evaled.
  • cleanup_run_output_dir: removes a real run dir; refuses (exit 1, files intact) anything outside */bashunit/run/*.

load_config_file evals export lines from .bashunitrc, but only its happy path
had (acceptance-level) coverage. Add unit tests for the parser's edges:
comments/blank lines, 'export ' prefix and quote stripping, env-over-file
precedence, invalid-identifier rejection, missing-file no-op — and the
security-relevant property that a command substitution in a value is stored
as literal text and a key carrying shell metacharacters is skipped, never
evaled.

Also covers cleanup_run_output_dir (#811): removes a proper run dir, refuses
(exit 1, files intact) any path outside */bashunit/run/*.
@Chemaclass Chemaclass added the enhancement New feature or request label Jul 16, 2026
@Chemaclass Chemaclass self-assigned this Jul 16, 2026
@Chemaclass Chemaclass merged commit 959966d into main Jul 16, 2026
37 checks passed
@Chemaclass Chemaclass deleted the test/env-config-and-cleanup branch July 16, 2026 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant