Problem
hook::bash_parse_segments' git-option walk records -c, --config, and --config-env values into the same HOOK_GIT_CONFIG_VALUES array with no marker distinguishing them (hook-utils.sh:796-801).
They are not the same thing. -c alias.c=commit supplies the value commit; --config-env=alias.c=VAR supplies the name of an environment variable holding the value. A consumer reading the array cannot tell them apart, so it treats VAR as the alias expansion.
Impact
Both git guards inherit this, and both currently fail open on it:
block-noncanonical-commit — git --config-env=alias.z=AV z -m x (with AV=commit) is not recognized as a commit. Verified exit 0.
block-dangerous-git — same shape for its alias expansion path.
Neither is a correctness bug in the guards themselves; the information they need is not in the array.
Fix sketch
Tag the origin in the shared parser — e.g. a parallel HOOK_GIT_CONFIG_VALUE_KINDS array, or an env: prefix on --config-env entries — then have each consumer resolve an env-sourced value from the hook's inherited environment. An inline env-assignment prefix on the command line (AV=commit git --config-env=...) stays out of scope: the parser does not evaluate shell assignments, which is an already-documented residual.
Why not fixed in #736
It is a hook-utils.sh change shared by both guards, with its own test surface. #736 documents the residual in the new hook's header rather than half-fixing it in one consumer.
Related
Problem
hook::bash_parse_segments' git-option walk records-c,--config, and--config-envvalues into the sameHOOK_GIT_CONFIG_VALUESarray with no marker distinguishing them (hook-utils.sh:796-801).They are not the same thing.
-c alias.c=commitsupplies the valuecommit;--config-env=alias.c=VARsupplies the name of an environment variable holding the value. A consumer reading the array cannot tell them apart, so it treatsVARas the alias expansion.Impact
Both git guards inherit this, and both currently fail open on it:
block-noncanonical-commit—git --config-env=alias.z=AV z -m x(withAV=commit) is not recognized as a commit. Verified exit 0.block-dangerous-git— same shape for its alias expansion path.Neither is a correctness bug in the guards themselves; the information they need is not in the array.
Fix sketch
Tag the origin in the shared parser — e.g. a parallel
HOOK_GIT_CONFIG_VALUE_KINDSarray, or anenv:prefix on--config-enventries — then have each consumer resolve an env-sourced value from the hook's inherited environment. An inline env-assignment prefix on the command line (AV=commit git --config-env=...) stays out of scope: the parser does not evaluate shell assignments, which is an already-documented residual.Why not fixed in #736
It is a
hook-utils.shchange shared by both guards, with its own test surface. #736 documents the residual in the new hook's header rather than half-fixing it in one consumer.Related