Skip to content

[fix] require host grants for script environment keys - #20

Merged
vt128 merged 4 commits into
masterfrom
codex/fix-star-95
Sep 23, 2026
Merged

vt128 merged 4 commits into
masterfrom
codex/fix-star-95

Conversation

@vt128

@vt128 vt128 commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

A command allowlist could be bypassed through script-supplied application environment hooks such as GIT_CONFIG_*, BASH_ENV or interpreter startup options. Require exact host-granted environment keys before starting restricted commands, across per-call env, set_env and CMD_ENV (STAR-95).

Add NewModuleWithPolicy(Policy{Commands, EnvKeys}) with defensive copies. NewModuleWithAllow grants no environment overrides; existing callers needing them must migrate to explicit grants. Names follow the OS case rules, unknown keys produce deterministic errors without values, and the complete script-facing module surface is pinned by a golden assertion. Trusted NewModuleWithAllowAll retains its environment behavior and dynamic-linker stripping.

This addresses the module's config/call inputs; hosts must also prevent untrusted mutation of global process environment or executable files through other modules. Go 1.19 and the pinned Starlark version are unchanged.

Validation: pre-fix reproductions, build, race tests twice, vet, formatting, document coverage, and Go 1.19 Linux amd64 tests with networking disabled. Depends on #19 for the already-reviewed dependency-floor and CI corrections; merge #19 first. No release is requested by this PR.

@codacy-production

codacy-production Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 15 complexity · 0 duplication

Metric Results
Complexity 15
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@vt128
vt128 merged commit 8c8bb6b into master Sep 23, 2026
17 checks passed
@vt128
vt128 deleted the codex/fix-star-95 branch September 23, 2026 16:55
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