Skip to main content

leaked_git_names

Function leaked_git_names 

Source
pub fn leaked_git_names() -> Vec<String>
Expand description

Returns the names of every environment variable in the current process whose name starts with GIT_. Exposed so other call sites (a future std::process::Command variant in git_env, or any caller that wants the list without the scrub) share one enumeration policy.

Blast vs. selective — deliberate decision. The GIT_ prefix blast also removes intent vars (GIT_CONFIG_GLOBAL, GIT_SSH_COMMAND, GIT_TERMINAL_PROMPT, …). Today no nb-api code path consumes those; the only vars that redirect Git’s view of the repository are GIT_DIR, GIT_INDEX_FILE, GIT_COMMON_DIR, GIT_WORK_TREE, GIT_OBJECT_DIRECTORY, and GIT_ALTERNATE_OBJECT_DIRECTORIES. A more selective policy could enumerate exactly those. The blast is chosen for two reasons: (1) any future GIT_* redirect that lands in this range gets caught by default rather than requiring a code change; (2) keeping the predicate to a prefix check is the minimum surface to audit. Revisit if a container identity mechanism ever routes through GIT_CONFIG_GLOBAL — at that point a selective enumeration belongs here.