refactor: parse .vig-os config as data#287
Merged
c-vigo merged 5 commits intorelease/0.3.0from Mar 13, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens devcontainer scripts against command execution by treating the root .vig-os file as data (parsing DEVCONTAINER_VERSION directly) instead of sourcing it as shell code, and adds regression tests to prevent reintroducing the issue.
Changes:
- Update
initialize.shandversion-check.shto parseDEVCONTAINER_VERSIONfrom.vig-oswithoutsource. - Add integration tests ensuring
.vig-osshell content is not executed by initialization or version-check config output. - Make githook BATS tests more deterministic by running hooks with a restricted
PATHand explicit/bin/bash.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
tests/test_integration.py |
Adds regression tests ensuring .vig-os is treated as non-executable data. |
tests/bats/githooks.bats |
Adjusts hook invocation to be less dependent on environment PATH. |
assets/workspace/.devcontainer/scripts/version-check.sh |
Replaces source .vig-os with safe line-based parsing for DEVCONTAINER_VERSION. |
assets/workspace/.devcontainer/scripts/initialize.sh |
Replaces source .vig-os with safe line-based parsing before writing .env. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Replaces executable
.vig-osloading with data-only parsing ininitialize.shandversion-check.shso unexpected shell content cannot execute.Adds regression integration coverage proving shell payloads in
.vig-osare not executed whileDEVCONTAINER_VERSIONis still read and used.Includes a follow-up test hardening commit to restore
.vig-osafter mutation-based tests so later integration tests are not impacted by test-side config changes.Adds a final test stabilization commit so
IN_CONTAINER=truehook-path BATS checks are deterministic and no longer depend on host hook return behavior.Type of Change
feat-- New featurefix-- Bug fixdocs-- Documentation onlychore-- Maintenance task (deps, config, etc.)refactor-- Code restructuring (no behavior change)test-- Adding or updating testsci-- CI/CD pipeline changesbuild-- Build system or dependency changesrevert-- Reverts a previous commitstyle-- Code style (formatting, whitespace)Modifiers
!) -- This change breaks backward compatibilityChanges Made
assets/workspace/.devcontainer/scripts/initialize.shsource "$config_file"inload_vig_os_configwith line-by-line key/value parsing forDEVCONTAINER_VERSION.envupdate behavior and Darwin/Linuxsedhandlingassets/workspace/.devcontainer/scripts/version-check.shsource "$config_file"inget_current_versionwith data-only parsing forDEVCONTAINER_VERSIONdev,latest, empty)tests/test_integration.pyinitialize.shto ensure shell payloads in.vig-osare not executedversion-check.sh configto ensure shell payloads in.vig-osare not executed.vig-osafter mutation tests to prevent side effects on later teststests/bats/githooks.batsIN_CONTAINER=trueguard tests deterministic forpre-commit,prepare-commit-msg, andcommit-msgChangelog Entry
No changelog needed. Issue
#285explicitly marks changelog category as "No changelog needed", and this PR keeps behavior intact while hardening implementation details.Testing
just test)Manual Testing Details
Checklist
docs/templates/, then runjust docs)CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Additional Notes
Issue references a security hardening concern flagged during smoke-test review; this PR keeps scope limited to the two script functions and corresponding tests.
Refs: #285