Skip to content

security: block cloud provider credentials and git credential prompts in subprocesses (salvage of #7990) - #22647

Closed
wesleysimplicio wants to merge 4 commits into
NousResearch:mainfrom
wesleysimplicio:fix/ag05-salvage-7990-block-cloud-creds
Closed

security: block cloud provider credentials and git credential prompts in subprocesses (salvage of #7990)#22647
wesleysimplicio wants to merge 4 commits into
NousResearch:mainfrom
wesleysimplicio:fix/ag05-salvage-7990-block-cloud-creds

Conversation

@wesleysimplicio

Copy link
Copy Markdown
Contributor

Salvage of abandoned PR #7990 (27 days stale, original author @SHL0MS).

Problem

Two gaps in subprocess environment sanitization:

1. Cloud provider credentials not blocked

_build_provider_env_blocklist() blocked Hermes-managed API keys but not cloud provider credentials. Agent-spawned subprocesses could silently access:

  • AWS (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, AWS_SECURITY_TOKEN)
  • Azure (AZURE_CLIENT_SECRET, AZURE_CLIENT_ID, AZURE_TENANT_ID)
  • GCP (GOOGLE_APPLICATION_CREDENTIALS)
  • Infrastructure (KUBECONFIG, DOCKER_HOST, DOCKER_CERT_PATH, SSH_AUTH_SOCK, GPG_AGENT_INFO)
  • Package registries (NPM_TOKEN, PYPI_TOKEN)

2. GIT_TERMINAL_PROMPT not disabled

Git subprocesses could prompt for credentials, blocking execution or leaking timing information.

Fix

# 14 new entries in _build_provider_env_blocklist()
"AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN", "AWS_SECURITY_TOKEN",
"AZURE_CLIENT_SECRET", "AZURE_CLIENT_ID", "AZURE_TENANT_ID",
"GOOGLE_APPLICATION_CREDENTIALS", "KUBECONFIG",
"DOCKER_HOST", "DOCKER_CERT_PATH",
"NPM_TOKEN", "PYPI_TOKEN",
"SSH_AUTH_SOCK", "GPG_AGENT_INFO",

# New hardening dict applied in both env-building paths
_GIT_HARDENING_VARS = {"GIT_TERMINAL_PROMPT": "0"}

Applied in both _make_run_env() (the execute() path) and _sanitize_subprocess_env() (the subprocess delegation path) so neither code path misses it.

Tests

New test classes in tests/tools/test_local_env_blocklist.py using the existing _run_with_env() harness:

  • TestCloudCredentialBlocklist: AWS/Azure/GCP+infra blocked, constant subset check
  • TestGitHardeningVars: GIT_TERMINAL_PROMPT=0 set, not overrideable by OS env

Stash-verify: 6 tests fail without fix, all 24 pass with it.

Differences from #7990

  • Applies _GIT_HARDENING_VARS in _make_run_env() too (original only patched _sanitize_subprocess_env())
  • Adds regression tests the original PR was missing
  • Applies cleanly to current main (context-line drift after 27 days)

…cale

Add native pt-BR translation of the main README plus bootstrap of the
Docusaurus pt-BR locale, complementing existing pt-BR work in flight.

- README.pt-BR.md: full native translation of README.md (mirrors the
  README.zh-CN.md structural template; not a machine translation).
- README.md / README.zh-CN.md: add bidirectional language badge to
  README.pt-BR.md.
- website/docusaurus.config.ts: register `pt-BR` alongside `en` and
  `zh-Hans` with localized label "Português (Brasil)".
- website/i18n/pt-BR/.../features/image-generation.md: seed translation
  of the image-generation guide to mirror the parity coverage that
  zh-Hans currently has (3 docs translated). Additional pages can be
  added incrementally without further config changes.

This contribution intentionally avoids overlap with the in-flight pt-BR
PRs:

- NousResearch#15737 (web/src/i18n/pt.ts)        -- Web UI strings
- NousResearch#20443 (locales/pt.yaml + agent/i18n.py) -- CLI runtime catalog
- NousResearch#22063 (web/src/i18n/pt-BR.ts)     -- Web UI strings

Surfaces here (root README + Docusaurus docs site i18n) are not touched
by any of the above.
Addresses Copilot review on NousResearch#22178: image-generation.md (line 31) had
a relative link to `tool-gateway.md` that did not resolve in the pt-BR
locale. Translating tool-gateway.md fixes the link and matches the
zh-Hans precedent (NousResearch#20430), which translated the two docs as a pair
for the same reason.

Native pt-BR translation mirroring the en source structure 1:1 (matches
the sibling image-generation.md style already in this PR).
… in subprocesses (salvage of NousResearch#7990)

Cloud provider credentials (AWS, Azure, GCP, KUBECONFIG, Docker TLS, NPM/PyPI
tokens, SSH agent socket, GPG agent) were not in the subprocess env blocklist,
allowing agent-spawned commands to silently access cloud infrastructure.

GIT_TERMINAL_PROMPT was not forced to 0, allowing git to prompt for credentials
inside subprocesses and potentially blocking execution or leaking timing info.

Changes:
- _build_provider_env_blocklist(): add 14 cloud/infra credential vars
  (AWS_ACCESS_KEY_ID/SECRET/SESSION/SECURITY, AZURE_CLIENT_SECRET/ID/TENANT,
  GOOGLE_APPLICATION_CREDENTIALS, KUBECONFIG, DOCKER_HOST/CERT_PATH,
  NPM_TOKEN, PYPI_TOKEN, SSH_AUTH_SOCK, GPG_AGENT_INFO)
- Add _GIT_HARDENING_VARS = {'GIT_TERMINAL_PROMPT': '0'}
- Apply _GIT_HARDENING_VARS in both _make_run_env() (execute path) and
  _sanitize_subprocess_env() (subprocess delegation path)

New tests in TestCloudCredentialBlocklist and TestGitHardeningVars verify
blocking and hardening via the existing _run_with_env() test harness.

Salvage of abandoned PR NousResearch#7990 (27 days stale).
Stash-verify: 6 tests fail without fix, all 24 pass with it.
Copilot AI review requested due to automatic review settings May 9, 2026 15:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens subprocess environment sanitization to prevent inadvertent credential leakage (cloud provider creds + git credential prompts) and adds Portuguese (Brazil) documentation/i18n assets to the website/docs.

Changes:

  • Extend the local subprocess env blocklist to strip common cloud/infra credentials and force-disable GIT_TERMINAL_PROMPT for subprocesses.
  • Add regression tests covering the new blocklisted variables and the git prompt hardening (via the LocalEnvironment.execute() path).
  • Add pt-BR as a Docusaurus locale plus new pt-BR docs/README entries.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tools/environments/local.py Adds cloud credential env var blocklist entries and forces GIT_TERMINAL_PROMPT=0 in subprocess env construction paths.
tests/tools/test_local_env_blocklist.py Adds tests ensuring cloud/infra env vars are stripped and git terminal prompt is forced off (execute path).
website/docusaurus.config.ts Enables pt-BR locale in Docusaurus configuration.
website/i18n/pt-BR/docusaurus-plugin-content-docs/current/user-guide/features/tool-gateway.md Adds pt-BR Tool Gateway documentation page.
website/i18n/pt-BR/docusaurus-plugin-content-docs/current/user-guide/features/image-generation.md Adds pt-BR Image Generation documentation page.
README.md Adds pt-BR README badge/link.
README.zh-CN.md Adds pt-BR README badge/link.
README.pt-BR.md Adds a Portuguese (Brazil) README.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +94 to +101
| FLUX 2 Pro | `fal-ai/flux-2/pro` | FLUX de fidelidade maior |
| Z-Image Turbo | `fal-ai/z-image/turbo` | Estilizado, rápido |
| Nano Banana Pro | `fal-ai/gemini-3-pro-image` | Google Gemini 3 Pro Image |
| GPT Image 1.5 | `fal-ai/gpt-image-1/5` | Geração de imagem da OpenAI, texto+imagem |
| GPT Image 2 | `fal-ai/gpt-image-2` | OpenAI mais recente |
| Ideogram V3 | `fal-ai/ideogram/v3` | Boa aderência a prompt + tipografia |
| Recraft V4 Pro | `fal-ai/recraft/v4/pro` | Estilo vetorial, design gráfico |
| Qwen Image | `fal-ai/qwen-image` | Multimodal da Alibaba |
Comment on lines 25 to +39
@@ -33,6 +33,10 @@ const config: Config = {
label: '简体中文',
htmlLang: 'zh-Hans',
},
'pt-BR': {
label: 'Português (Brasil)',
htmlLang: 'pt-BR',
},
Comment on lines 25 to 29
i18n: {
defaultLocale: 'en',
locales: ['en', 'zh-Hans'],
locales: ['en', 'zh-Hans', 'pt-BR'],
localeConfigs: {
en: {
Comment on lines 191 to 199
# Per-profile HOME isolation for background processes (same as _make_run_env).
from hermes_constants import get_subprocess_home
_profile_home = get_subprocess_home()
if _profile_home:
sanitized["HOME"] = _profile_home

# Apply git hardening: disable credential prompts in subprocesses
sanitized.update(_GIT_HARDENING_VARS)
return sanitized
@alt-glitch alt-glitch added type/security Security vulnerability or hardening backend/local Local shell execution P1 High — major feature broken, no workaround labels May 11, 2026
@wesleysimplicio

Copy link
Copy Markdown
Contributor Author

Closing voluntarily — heard feedback from @teknium1 that the salvage pattern is creating PR-spam noise. Stepping back to reviews and direct fixes for issues without an existing PR. Apologies for the volume.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend/local Local shell execution P1 High — major feature broken, no workaround type/security Security vulnerability or hardening

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants