Skip to content

fix(cli): export Java trust-store settings to all shells - #109

Merged
shejnowicz merged 2 commits into
masterfrom
fix/102-java-trust-store-shells
Sep 8, 2026
Merged

shejnowicz merged 2 commits into
masterfrom
fix/102-java-trust-store-shells

Conversation

@shejnowicz

Copy link
Copy Markdown
Collaborator

Fixes #102. Carries #108 by @atirna — the original commit is cherry-picked with authorship preserved; opened from an in-repo branch so CI runs without the fork-approval step. On top of it there is one cosmetic follow-up commit renaming the test-seam variable SANDCAT_HOME → SANDCAT_USER_HOME (the former already means "host CLI install dir" in install.sh, so one name carried two meanings).

Summary (from #108)

Java trust-store exports move out of .bashrc into a guarded /etc/profile.d/sandcat-java.sh. The entrypoint sources it after app-user-init.sh refreshes the writable trust store, so the agent process — and everything it spawns — inherits JAVA_HOME and JAVA_TOOL_OPTIONS. Login shells get it via /etc/profile, VS Code terminals via the existing sandcat-*.sh sourcing block in /etc/bash.bashrc.

Verification

  • bats: init 162/162, run 9/9 (incl. the PR's three new tests)
  • Hands-on integration on a real container with --stacks java (temurin via devbox):
    • PID1 (agent process) environment contains both JAVA_HOME and JAVA_TOOL_OPTIONS (/proc/1/environ)
    • end-to-end: a JVM child with the inherited env fetches https://example.com through the proxy → HTTP 200 (mitmproxy CA honored via the sandcat trust store)
    • negative control: same fetch with env -u JAVA_TOOL_OPTIONS → PKIX path building failed — the exact JAVA_TOOL_OPTIONS trust-store export is invisible to non-interactive shells (agent-spawned JVMs fail PKIX) #102 symptom
    • login shell exports present; cacerts refreshed by app-user-init; baseline (GET 200 / POST 403 / no sudoers / no CA private key) unregressed
  • Reviewer note: docker compose exec … printenv can NOT observe these variables — docker exec always gets the image's Config.Env, never the entrypoint's; /proc/1/environ is the correct probe.

🤖 Generated with Claude Code

atirna and others added 2 commits September 7, 2026 11:19
Follow-up to the previous commit: SANDCAT_HOME already means "host CLI
install dir" in install.sh (~/.local/share/sandcat), so reusing the same
name inside the agent container for "the vscode user's home" gives one
variable two meanings. Rename the test seam to SANDCAT_USER_HOME; behavior
unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@shejnowicz
shejnowicz merged commit 9cbb924 into master Sep 8, 2026
6 checks passed
@shejnowicz
shejnowicz deleted the fix/102-java-trust-store-shells branch September 8, 2026 08:00
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.

JAVA_TOOL_OPTIONS trust-store export is invisible to non-interactive shells (agent-spawned JVMs fail PKIX)

2 participants