Repository navigation
extractor-plugin: strip secret env vars from plugin subprocess - #1205
Merged
Merged
Conversation
internal/parser/languages/extractor_plugin.go launches the configured plugin with cmd.Env = append(os.Environ(), "GORTEX_FILE_PATH=…"), inheriting the daemon's whole environment — OPENAI_API_KEY, GOOGLE_API_KEY, GORTEX_LLM_API_KEY, GITHUB_TOKEN, AWS_SECRET_ACCESS_KEY, and the like — into the plugin process. A plugin command is config a repo-local .gortex.yaml can declare, so it could read os.Environ() and exfiltrate those secrets. Strip secret-shaped entries before launching: stripSecretEnv keeps only vars whose name is not secret-shaped (matching the shapes the LLM/embedding/network backends use: *_API_KEY, APIKEY, _TOKEN, _SECRET, _BEARER, Authorization), so no future key escapes by an unknown name. PATH and other non-secret vars are inherited so the command still resolves; GORTEX_FILE_PATH is added after filtering.
zzet
force-pushed
the
fix/extractor-plugin-secret-env-strip
branch
from
October 31, 2026 14:00
0a525b0 to
18eb06c
Compare
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.
Problem
internal/parser/languages/extractor_plugin.golaunches the configuredplugin with
cmd.Env = append(os.Environ(), "GORTEX_FILE_PATH=…"). Thatinherits the daemon's entire environment —
OPENAI_API_KEY,GOOGLE_API_KEY,GORTEX_LLM_API_KEY,GITHUB_TOKEN,AWS_SECRET_ACCESS_KEY,and the like — into the plugin process. A plugin command is config that a
repo-local
.gortex.yamlcan declare, so such a command could callos.Environ()and exfiltrate those secrets.Fix
Strip secret-shaped entries from the environment before launching the
plugin.
stripSecretEnvkeeps only vars whose name is not secret-shaped(matching the shapes the LLM/embedding/network backends use —
*_API_KEY,APIKEY,_TOKEN,_SECRET,_BEARER, andAuthorization),so no future key escapes by an unknown name.
PATHand other non-secretvars are inherited so the command still resolves;
GORTEX_FILE_PATHisadded after filtering.
Test
TestStripSecretEnvverifies API keys/tokens/secrets/bearer vars aredropped while
PATH,GORTEX_FILE_PATH, and a non-secret var survive.The existing extractor-plugin suite passes unchanged.