feat(sponge): add three-layer privacy filtering for shell history
conf.d/sponge_privacy.fish registers patterns and filters that prevent credentials from reaching fish history: Layer 1 (static regex, universal): auth flags, env assignments, credential-bearing URLs, Authorization headers, sshpass, docker login, openssl -passin/-passout Layer 2 (dynamic values, session globals): on the first prompt, after secrets.fish has loaded, reads the literal values of all exported credential-named vars (TOKEN, PASSWORD, SECRET, etc.), escapes them for regex, and merges them with the static patterns as a session global — auto-refreshes on login so rotated tokens are never stale Layer 3 (per-command filter, sponge_filter_secrets): catches credentials in variables exported mid-session (e.g. project .env) Also exempts functions/sponge_filter_secrets.fish from the sponge_* gitignore glob so our custom filter is committed alongside the config.
This commit is contained in:
@@ -1426,6 +1426,38 @@ commit them. Fisher installs and updates them automatically.
|
||||
jorgebucaran/fisher Plugin manager itself
|
||||
meaningful-ooo/sponge Remove failed commands from history
|
||||
|
||||
## Sponge History Filtering
|
||||
|
||||
Sponge removes failed commands from history and, via conf.d/sponge_privacy.fish,
|
||||
also filters privacy-sensitive commands through three layers:
|
||||
|
||||
Layer 1 — Static patterns (universal, persistent across sessions):
|
||||
Commands matching any of these structural signatures are never recorded:
|
||||
|
||||
--password / --token / --passphrase / --api-key flags with values
|
||||
Inline env assignments: GITHUB_TOKEN=xxx, MY_API_KEY=abc
|
||||
Fish set with sensitive names: set -gx GITHUB_TOKEN xxx
|
||||
URLs with embedded credentials: https://user:pass@host
|
||||
HTTP Authorization headers: curl -H "Authorization: ..."
|
||||
Basic auth flags: curl -u user:pass
|
||||
sshpass, docker login -p, openssl -passin/-passout
|
||||
|
||||
Layer 2 — Dynamic secret values (session globals, refreshed each login):
|
||||
On the first prompt, after secrets.fish has loaded, the literal values of
|
||||
all exported variables whose names suggest credentials (TOKEN, PASSWORD,
|
||||
SECRET, API_KEY, etc.) are collected, regex-escaped, and added as a
|
||||
session-scoped overlay. Because globals shadow universals in Fish, the
|
||||
combined list is what sponge sees. Rotating a token takes effect on the
|
||||
next login automatically.
|
||||
|
||||
Layer 3 — Per-command filter (sponge_filter_secrets):
|
||||
Catches credentials in variables exported after login, such as tokens
|
||||
sourced from a project .env file mid-session.
|
||||
|
||||
To add your own persistent patterns:
|
||||
|
||||
set -U -a sponge_regex_patterns 'your-regex-here'
|
||||
|
||||
## Bundled Plugin Functionality
|
||||
|
||||
The remaining plugin functionality is bundled directly with this config rather
|
||||
|
||||
Reference in New Issue
Block a user