security: block cloud provider credentials and git credential prompts in subprocesses (salvage of #7990) - #22647
Closed
wesleysimplicio wants to merge 4 commits into
Conversation
…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.
Contributor
There was a problem hiding this comment.
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_PROMPTfor subprocesses. - Add regression tests covering the new blocklisted variables and the git prompt hardening (via the
LocalEnvironment.execute()path). - Add
pt-BRas 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 |
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. |
1 task
19 tasks
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.
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_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,SSH_AUTH_SOCK,GPG_AGENT_INFO)NPM_TOKEN,PYPI_TOKEN)2.
GIT_TERMINAL_PROMPTnot disabledGit subprocesses could prompt for credentials, blocking execution or leaking timing information.
Fix
Applied in both
_make_run_env()(theexecute()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.pyusing the existing_run_with_env()harness:TestCloudCredentialBlocklist: AWS/Azure/GCP+infra blocked, constant subset checkTestGitHardeningVars:GIT_TERMINAL_PROMPT=0set, not overrideable by OS envStash-verify: 6 tests fail without fix, all 24 pass with it.
Differences from #7990
_GIT_HARDENING_VARSin_make_run_env()too (original only patched_sanitize_subprocess_env())main(context-line drift after 27 days)