fix(sponge): use $$var[1] to avoid test arg-count error on array vars
This commit is contained in:
@@ -89,7 +89,9 @@ function __sponge_register_secret_values --on-event fish_prompt
|
||||
'(?i)(?:TOKEN|PASSWORD|PASSWD|SECRET|API[_-]KEY|PRIVATE[_-]KEY|ACCESS[_-]KEY|AUTH[_-]KEY|CREDENTIAL|KOPIA_PASSWORD)')
|
||||
|
||||
for var in $sensitive_vars
|
||||
set -l value $$var
|
||||
# Take only the first element — array vars yield multiple values which
|
||||
# would make `test (string length ...)` receive too many arguments.
|
||||
set -l value $$var[1]
|
||||
# Skip empty, short, or path-like values
|
||||
test (string length -- $value) -gt 8; or continue
|
||||
string match --quiet --regex '^[/~]' -- $value; and continue
|
||||
|
||||
@@ -35,7 +35,8 @@ function sponge_filter_secrets --argument-names command
|
||||
'(?i)(?:TOKEN|PASSWORD|PASSWD|SECRET|API[_-]KEY|PRIVATE[_-]KEY|ACCESS[_-]KEY|AUTH[_-]KEY|CREDENTIAL|KOPIA_PASSWORD)')
|
||||
|
||||
for var in $sensitive_vars
|
||||
set -l value $$var
|
||||
# Take only the first element — array vars yield multiple values
|
||||
set -l value $$var[1]
|
||||
|
||||
# Skip empty, short, or path-like values — not real credentials
|
||||
test (string length -- $value) -gt 8; or continue
|
||||
|
||||
Reference in New Issue
Block a user