Skip to content

fix: don't pass hook variables' values on under other names - #6

Merged
vrmiguel merged 3 commits into
mainfrom
tembo/hook-values-not-inherited
Nov 9, 2026
Merged

vrmiguel merged 3 commits into
mainfrom
tembo/hook-values-not-inherited

Conversation

@vrmiguel

@vrmiguel vrmiguel commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Variables in hookEnv are never passed to servers, but a copy of the same value under another name still was. Agent harnesses commonly copy a platform token into several variables, for example TEMBO_API_TOKEN, OPENAI_API_KEY and ANTHROPIC_API_KEY, so reserving one name didn't keep the token from stdio servers.

Now a server also doesn't inherit any variable whose value exactly equals the (non-empty) value of a variable listed in hookEnv. This applies to inheritEnv name lists too. Variables a server sets explicitly in its own env are still passed, since the config chose them. Variables that hooks merely reference, like a policy URL, aren't secrets, so their values can still be inherited under other names.

This lets a config generator protect a token without knowing every name it's copied into, so Tembo's API can write gate's config statically. It stops accidental leaks, such as a server logging its environment or passing it to its own child processes. On its own it doesn't stop a server from reading gate's environment through /proc; #8 fixes that on Linux.

Tested by hook_values_are_not_inherited_under_other_names, which fails without the change: the copy leaked through, and a copy of a hook URL was wrongly withheld.


Want tembo to make any changes? Add a comment with @tembo and i'll get back to work!

View on Tembo  Review in Tembo  View Agent Settings

Co-authored-by: Vinícius <36349314+vrmiguel@users.noreply.github.com>
@tembo tembo Bot added tembo Pull request created by Tembo labels Nov 9, 2026
vrmiguel and others added 2 commits November 9, 2026 15:10
Co-authored-by: tembo[bot] <208362400+tembo-io[bot]@users.noreply.github.com>
…-inherited

Co-authored-by: Vinícius <36349314+vrmiguel@users.noreply.github.com>
@vrmiguel
vrmiguel merged commit dbbf265 into main Nov 9, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tembo Pull request created by Tembo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant