@codyswann/lisa 6.0.8 → 6.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all/copy-overwrite/scripts/lisa-audit.mjs +1 -1
- package/all/copy-overwrite/scripts/lisa-hooks/sonar-secrets.sh +130 -47
- package/dist/configs/eslint/expo.d.ts.map +1 -1
- package/dist/configs/eslint/expo.js +11 -3
- package/dist/configs/eslint/expo.js.map +1 -1
- package/dist/configs/eslint/slow-expo.d.ts +15 -6
- package/dist/configs/eslint/slow-expo.d.ts.map +1 -1
- package/dist/configs/eslint/slow-expo.js +48 -19
- package/dist/configs/eslint/slow-expo.js.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +6 -0
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/nightly-e2e-guard-behavior-certificate.js.map +1 -1
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +11 -12
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/dist/migrations/index.d.ts +0 -1
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +0 -3
- package/dist/migrations/index.js.map +1 -1
- package/expo/copy-overwrite/eslint.expo.ts +11 -3
- package/expo/package-lisa/package.lisa.json +2 -1
- package/package.json +8 -7
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-security-audit-handling/SKILL.md +25 -25
- package/plugins/lisa/hooks/sonar-secrets.sh +130 -47
- package/plugins/lisa/rules/reference/security-audit-handling.md +9 -1
- package/plugins/lisa/skills/lisa-security-audit-handling/SKILL.md +25 -25
- package/plugins/lisa/skills/lisa-security-audit-handling/agents/openai.yaml +2 -2
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-security-audit-handling/SKILL.md +25 -25
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/hooks/sonar-secrets.sh +130 -47
- package/plugins/lisa-copilot/rules/reference/security-audit-handling.md +9 -1
- package/plugins/lisa-copilot/skills/lisa-security-audit-handling/SKILL.md +25 -25
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/hooks/sonar-secrets.sh +130 -47
- package/plugins/lisa-cursor/rules/security-audit-handling-reference.mdc +9 -1
- package/plugins/lisa-cursor/skills/lisa-security-audit-handling/SKILL.md +25 -25
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/hooks/sonar-secrets.sh +130 -47
- package/plugins/lisa-devin/rules/reference/security-audit-handling.md +9 -1
- package/plugins/lisa-devin/skills/lisa-security-audit-handling/SKILL.md +25 -25
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/hooks/sonar-secrets.sh +130 -47
- package/plugins/src/base/rules/reference/security-audit-handling.md +9 -1
- package/plugins/src/base/skills/lisa-security-audit-handling/SKILL.md +25 -25
- package/scripts/lisa-audit.mjs +1 -1
- package/typescript/copy-overwrite/audit.ignore.config.json +1 -140
- package/dist/migrations/ensure-audit-ignore-local-exclusions.d.ts +0 -51
- package/dist/migrations/ensure-audit-ignore-local-exclusions.d.ts.map +0 -1
- package/dist/migrations/ensure-audit-ignore-local-exclusions.js +0 -245
- package/dist/migrations/ensure-audit-ignore-local-exclusions.js.map +0 -1
|
@@ -59,8 +59,38 @@ set -uo pipefail
|
|
|
59
59
|
# the drain at exactly the moment this wrapper is proving `sonar` is absent
|
|
60
60
|
# (CodySwannGT/lisa#3308). An empty delimiter means "read through NUL or EOF";
|
|
61
61
|
# hook envelopes contain no NUL, so the non-zero EOF result is expected.
|
|
62
|
+
#
|
|
63
|
+
# Every wait in this file has a ceiling (CodySwannGT/lisa#5038). This one waited
|
|
64
|
+
# for EOF with none, so a caller that gave up on the hook without closing its end
|
|
65
|
+
# of the pipe left the hook blocked in `read` forever: four were found on one
|
|
66
|
+
# workstation, orphaned to PID 1 with no children, 2h, 2h, 5h and 146h old. A
|
|
67
|
+
# real caller writes the whole envelope at once (a 1MB payload drains in ~0.6s
|
|
68
|
+
# at a load average of 20), so the ceiling only ever ends a wait nobody is going
|
|
69
|
+
# to finish. When EOF arrives in time nothing changes: every exit below still
|
|
70
|
+
# follows it. When it does not, the hook stops waiting and steps aside — Bash
|
|
71
|
+
# discards a partial read on timeout, so there is no complete payload to scan.
|
|
72
|
+
#
|
|
73
|
+
# `read -t` cannot tell its caller which happened (Bash 3.2 returns 1 for both
|
|
74
|
+
# EOF and a timeout), so the clock decides: a read that lasted the whole ceiling
|
|
75
|
+
# timed out. A value that is not a positive whole number falls back to the
|
|
76
|
+
# shipped ten seconds rather than to `read -t 0`, which would skip the drain.
|
|
77
|
+
bound_s() {
|
|
78
|
+
case "$1" in
|
|
79
|
+
'' | *[!0-9]* | 0*) printf '10' ;;
|
|
80
|
+
*) printf '%s' "$1" ;;
|
|
81
|
+
esac
|
|
82
|
+
}
|
|
83
|
+
|
|
62
84
|
payload=""
|
|
63
|
-
|
|
85
|
+
stdin_bound="$(bound_s "${LISA_SONAR_STDIN_TIMEOUT_S:-}")"
|
|
86
|
+
stdin_started=$SECONDS
|
|
87
|
+
IFS= read -r -d '' -t "$stdin_bound" payload || true
|
|
88
|
+
if (( SECONDS - stdin_started >= stdin_bound )); then
|
|
89
|
+
echo "sonar: the hook's input did not finish arriving within ${stdin_bound}s;" >&2
|
|
90
|
+
echo " skipping the local secret scan. Commit-time and CI secret scanning" >&2
|
|
91
|
+
echo " still gate this repository." >&2
|
|
92
|
+
exit 0
|
|
93
|
+
fi
|
|
64
94
|
|
|
65
95
|
event="${1:-}"
|
|
66
96
|
[[ -n "$event" ]] || exit 0
|
|
@@ -78,8 +108,94 @@ command -v sonar >/dev/null 2>&1 || exit 0
|
|
|
78
108
|
# exit code carries no information and the reason text is the only channel.
|
|
79
109
|
inactive_marker='secret scanning is inactive'
|
|
80
110
|
|
|
111
|
+
# Run one command with a ceiling and capture its stdout into `captured`.
|
|
112
|
+
#
|
|
113
|
+
# Usage: capture_bounded <seconds> <delimiter> <label> <stdin> <command...>
|
|
114
|
+
# Returns 0 when the command answered in time, 1 when the ceiling expired (and
|
|
115
|
+
# `captured` is then empty), and 2 when the private FIFO could not be made.
|
|
116
|
+
#
|
|
117
|
+
# `read -t` supplies the ceiling. `timeout` is absent on a stock macOS and
|
|
118
|
+
# `coproc` needs Bash 4 (the hooks run under /bin/bash 3.2 there), so this is the
|
|
119
|
+
# portable form. Stopping the wait is not stopping the work, so when the read
|
|
120
|
+
# returns the command is killed and reaped; that requires its PID, which is why
|
|
121
|
+
# the command is backgrounded explicitly and its output goes through a FIFO.
|
|
122
|
+
# On /bin/bash 3.2, `$!` after `< <(cmd)` is the SHELL'S OWN PID, not the
|
|
123
|
+
# substitution's child (verified: the child's PPID is the shell, and `$!` equals
|
|
124
|
+
# the shell), so `kill -9 "$!"` there would tell the hook to kill itself. For a
|
|
125
|
+
# background pipeline `$!` is its last command, so the kill lands on the command
|
|
126
|
+
# itself; its stdin writer then dies on the closed pipe.
|
|
127
|
+
#
|
|
128
|
+
# The FIFO's OPEN is bounded too, not only the read (CodySwannGT/lisa#5038). A
|
|
129
|
+
# read-only open of a FIFO blocks until a writer opens the other end, and a
|
|
130
|
+
# writer that dies first would leave it blocked for good with `read -t` never
|
|
131
|
+
# reached. So the hook opens the FIFO read-write first, which never blocks, and
|
|
132
|
+
# the command inherits that end at fork instead of opening the path later. The
|
|
133
|
+
# read-only end is then opened while a writer is guaranteed to exist, and the
|
|
134
|
+
# hook's own write end is closed, so EOF arrives exactly when the command (and
|
|
135
|
+
# anything it handed its stdout to) is done.
|
|
136
|
+
#
|
|
137
|
+
# The FIFO is a rendezvous, not storage: a named pipe holds no data at rest, so a
|
|
138
|
+
# value carried through it never lands on disk (CWE-922) and a kill at any point
|
|
139
|
+
# leaves an empty pipe behind rather than a readable token. The directory is
|
|
140
|
+
# `mktemp -d`, which is 0700. Its explicit Lisa prefix makes an interrupted run
|
|
141
|
+
# attributable to the owning scratch lifecycle instead of anonymous `tmp.*`.
|
|
142
|
+
# Descriptors 3 and 4 are used for nothing else in this file.
|
|
143
|
+
captured=""
|
|
144
|
+
capture_bounded() {
|
|
145
|
+
local seconds="$1" delim="$2" label="$3" feed="$4" dir="" fifo="" child=""
|
|
146
|
+
local started=0 status=0
|
|
147
|
+
shift 4
|
|
148
|
+
captured=""
|
|
149
|
+
dir="$(mktemp -d "${TMPDIR:-/tmp}/lisa-sonar-${label}.XXXXXXXX")" || return 2
|
|
150
|
+
fifo="$dir/$label"
|
|
151
|
+
if ! mkfifo -m 600 "$fifo" 2>/dev/null; then
|
|
152
|
+
rm -rf "$dir"
|
|
153
|
+
return 2
|
|
154
|
+
fi
|
|
155
|
+
exec 3<>"$fifo"
|
|
156
|
+
{ printf '%s' "$feed"; } 3>&- | "$@" >&3 3>&- 2>/dev/null &
|
|
157
|
+
child=$!
|
|
158
|
+
exec 4<"$fifo"
|
|
159
|
+
exec 3>&-
|
|
160
|
+
started=$SECONDS
|
|
161
|
+
IFS= read -r -d "$delim" -t "$seconds" captured <&4
|
|
162
|
+
exec 4<&-
|
|
163
|
+
# The clock decides, as for stdin above: Bash 3.2 returns 1 for EOF and for a
|
|
164
|
+
# timeout alike, and Bash 4+ keeps a timed-out partial read, which must never
|
|
165
|
+
# pass for a verdict or a token.
|
|
166
|
+
if (( SECONDS - started >= seconds )); then
|
|
167
|
+
captured=""
|
|
168
|
+
status=1
|
|
169
|
+
fi
|
|
170
|
+
kill -9 "$child" 2>/dev/null
|
|
171
|
+
wait "$child" 2>/dev/null
|
|
172
|
+
rm -rf "$dir"
|
|
173
|
+
return "$status"
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
# `sonar hook` is a call with no ceiling of its own, in front of every prompt and
|
|
177
|
+
# every file read (CodySwannGT/lisa#5038). Ten seconds by default, like the
|
|
178
|
+
# resolver below; `LISA_SONAR_SCAN_TIMEOUT_S` lets a caller that is not a session
|
|
179
|
+
# say otherwise. A scanner that does not answer is a degraded layer, not a
|
|
180
|
+
# finding, so the hook warns and steps aside.
|
|
181
|
+
scan_bound="$(bound_s "${LISA_SONAR_SCAN_TIMEOUT_S:-}")"
|
|
81
182
|
run_scanner() {
|
|
82
|
-
|
|
183
|
+
capture_bounded "$scan_bound" '' scan "$payload" sonar hook "$event"
|
|
184
|
+
case $? in
|
|
185
|
+
0) out="$captured" ;;
|
|
186
|
+
1)
|
|
187
|
+
echo "sonar: the secret scanner did not answer within ${scan_bound}s;" >&2
|
|
188
|
+
echo " skipping the local secret scan. Commit-time and CI secret scanning" >&2
|
|
189
|
+
echo " still gate this repository." >&2
|
|
190
|
+
exit 0
|
|
191
|
+
;;
|
|
192
|
+
*)
|
|
193
|
+
echo "sonar: could not make a private pipe for the secret scanner;" >&2
|
|
194
|
+
echo " skipping the local secret scan. Commit-time and CI secret scanning" >&2
|
|
195
|
+
echo " still gate this repository." >&2
|
|
196
|
+
exit 0
|
|
197
|
+
;;
|
|
198
|
+
esac
|
|
83
199
|
}
|
|
84
200
|
|
|
85
201
|
is_inactive() {
|
|
@@ -89,21 +205,15 @@ is_inactive() {
|
|
|
89
205
|
esac
|
|
90
206
|
}
|
|
91
207
|
|
|
92
|
-
#
|
|
208
|
+
# Resolve a secret with a ceiling, because the provider call crosses the network
|
|
93
209
|
# and this sits in front of every prompt and every file read.
|
|
94
210
|
#
|
|
95
211
|
# The value never touches the filesystem. An earlier version captured it through
|
|
96
212
|
# `mktemp` and deleted the file afterwards, which is a race, not a cleanup: a
|
|
97
213
|
# kill between the write and the `rm` leaves the token readable on disk (CWE-922)
|
|
98
214
|
# — the precise failure the one-store rule in lisa-secrets-access exists to
|
|
99
|
-
# prevent, reintroduced by the code enforcing it.
|
|
100
|
-
#
|
|
101
|
-
# clean up on any exit path, signalled or not.
|
|
102
|
-
#
|
|
103
|
-
# `read -t` supplies the ceiling. `timeout` is absent on a stock macOS and
|
|
104
|
-
# `coproc` needs Bash 4 (the hooks run under /bin/bash 3.2 there), so this is the
|
|
105
|
-
# portable form. A timeout leaves `value` empty, which the caller treats as "the
|
|
106
|
-
# provider had nothing" — the warn path, never a block.
|
|
215
|
+
# prevent, reintroduced by the code enforcing it. `capture_bounded` carries it
|
|
216
|
+
# over a FIFO instead, which holds nothing at rest.
|
|
107
217
|
#
|
|
108
218
|
# Ten seconds is the ceiling a consumer gets, and that is a product decision, not
|
|
109
219
|
# a tuning constant: this runs in front of every prompt and every file read, so
|
|
@@ -116,44 +226,17 @@ is_inactive() {
|
|
|
116
226
|
# (CodySwannGT/lisa#2905). The suite scales this the same way it scales its own
|
|
117
227
|
# budgets, and stages a hang by shrinking it.
|
|
118
228
|
#
|
|
119
|
-
#
|
|
120
|
-
#
|
|
121
|
-
# is no value of this variable that
|
|
122
|
-
#
|
|
123
|
-
# Giving up on the read is not the same as stopping the work: a resolver blocked
|
|
124
|
-
# on the network otherwise outlives the hook that started it, and this runs in
|
|
125
|
-
# front of every prompt and every file read. So the child is killed and reaped,
|
|
126
|
-
# which requires knowing its PID — and that is why the transport is a FIFO and
|
|
127
|
-
# not the process substitution this function used to read from.
|
|
128
|
-
#
|
|
129
|
-
# On /bin/bash 3.2, `$!` after `< <(cmd)` is the SHELL'S OWN PID, not the
|
|
130
|
-
# substitution's child (verified: the child's PPID is the shell, and `$!` equals
|
|
131
|
-
# the shell). A `kill -9 "$!"` there tells the hook to kill itself. Backgrounding
|
|
132
|
-
# the resolver explicitly is what makes `$!` mean the resolver.
|
|
133
|
-
#
|
|
134
|
-
# The FIFO is a rendezvous, not storage: a named pipe holds no data at rest, so
|
|
135
|
-
# the value still never lands on disk (CWE-922) and a kill at any point leaves an
|
|
136
|
-
# empty pipe behind rather than a readable token. The directory is `mktemp -d`,
|
|
137
|
-
# which is 0700. Its explicit Lisa prefix makes an interrupted resolver
|
|
138
|
-
# attributable to the owning scratch lifecycle instead of anonymous `tmp.*`.
|
|
229
|
+
# A timeout leaves the value empty, which the caller treats as "the provider had
|
|
230
|
+
# nothing" — the warn path, never a block. Unset, empty, or unparseable all fall
|
|
231
|
+
# back to the shipped ten seconds, so there is no value of this variable that
|
|
232
|
+
# turns a warn into a block.
|
|
139
233
|
resolve_secret() {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if ! mkfifo -m 600 "$fifo" 2>/dev/null; then
|
|
144
|
-
rm -rf "$dir"
|
|
145
|
-
return 0
|
|
146
|
-
fi
|
|
147
|
-
node "$resolver" get "$name" >"$fifo" 2>/dev/null &
|
|
148
|
-
child=$!
|
|
149
|
-
IFS= read -r -t "${LISA_SONAR_RESOLVER_TIMEOUT_S:-10}" value < "$fifo" || true
|
|
150
|
-
kill -9 "$child" 2>/dev/null
|
|
151
|
-
wait "$child" 2>/dev/null
|
|
152
|
-
rm -rf "$dir"
|
|
153
|
-
printf '%s' "$value"
|
|
234
|
+
capture_bounded "$(bound_s "${LISA_SONAR_RESOLVER_TIMEOUT_S:-10}")" $'\n' resolver "" \
|
|
235
|
+
node "$1" get "$2"
|
|
236
|
+
printf '%s' "$captured"
|
|
154
237
|
}
|
|
155
238
|
|
|
156
|
-
|
|
239
|
+
run_scanner
|
|
157
240
|
|
|
158
241
|
if is_inactive "$out"; then
|
|
159
242
|
# Where lisa-secrets-access lives depends on how the project receives Lisa.
|
|
@@ -184,7 +267,7 @@ if is_inactive "$out"; then
|
|
|
184
267
|
export SONARQUBE_CLI_TOKEN="$token"
|
|
185
268
|
org="$(resolve_secret "$resolver" SONARQUBE_CLI_ORG)"
|
|
186
269
|
[[ -n "$org" ]] && export SONARQUBE_CLI_ORG="$org"
|
|
187
|
-
|
|
270
|
+
run_scanner
|
|
188
271
|
fi
|
|
189
272
|
unset token org
|
|
190
273
|
fi
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
# Security Audit Handling
|
|
2
2
|
|
|
3
|
-
The procedure for a push or CI run blocked by the dependency security audit lives in the `lisa-security-audit-handling` skill
|
|
3
|
+
The procedure for a push or CI run blocked by the dependency security audit lives in the `lisa-security-audit-handling` skill. Its steps run in this order:
|
|
4
|
+
|
|
5
|
+
1. Refresh the lockfile within the current range.
|
|
6
|
+
2. Upgrade the direct dependency that pulls the vulnerable copy.
|
|
7
|
+
3. Add a targeted override to the fixed version.
|
|
8
|
+
4. Evaluate reachability before any code change. An advisory that cannot affect the project gets a scoped exclusion with a concrete reason in the project's own `audit.ignore.local.json`, with no human needed; Lisa's template cannot vouch for a host's reachability. If reachability cannot be proven, the advisory affects the project.
|
|
9
|
+
5. Replace or remove the dependency.
|
|
10
|
+
|
|
11
|
+
When none of those works, file a build-ready ticket with the evidence (advisory, dependency path, what each step tried) so the factory carries the replacement or removal; stop only when the next act needs access you lack, and say exactly what is missing. The audit's failure message prints the same order and names the skill, so it loads when it is needed instead of in every session. Never bypass the hook.
|
|
@@ -1,36 +1,32 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: lisa-security-audit-handling
|
|
3
|
-
description: "What to do when a push or CI is blocked by the dependency security audit:
|
|
3
|
+
description: "What to do when a push or CI is blocked by the dependency security audit, in order: refresh the lockfile, upgrade the direct dependency, add a targeted override, exclude an advisory that cannot reach the project with a stated reason, then replace or remove the dependency. Never bypasses the hook."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Security Audit Handling
|
|
7
7
|
|
|
8
|
-
Use this when `git push` (or a CI audit gate) fails because the dependency audit reports high or critical advisories. Work the
|
|
8
|
+
Use this when `git push` (or a CI audit gate) fails because the dependency audit reports high or critical advisories. Work the ladder below **autonomously**. Never use `--no-verify`, `HUSKY=0`, `core.hooksPath`, or any other hook bypass to skip the security audit.
|
|
9
9
|
|
|
10
|
-
## The
|
|
10
|
+
## The fix ladder
|
|
11
11
|
|
|
12
|
-
The
|
|
12
|
+
The remedy for a high/critical advisory is an ordered decision, not a question to forward to the user. For each advisory, work the steps **in this order** and stop at the first one that resolves it. The audit's failure message prints the same order.
|
|
13
13
|
|
|
14
|
-
1. **
|
|
15
|
-
2. **
|
|
16
|
-
3. **
|
|
17
|
-
4. **
|
|
18
|
-
5. **
|
|
14
|
+
1. **Refresh the lockfile within the current range.** Most transitive fixes are published inside the range the parent already accepts; a stale lockfile is the usual cause.
|
|
15
|
+
2. **Upgrade the direct dependency** that pulls the vulnerable copy to a release that depends on a patched one.
|
|
16
|
+
3. **Add a targeted override** that pins the vulnerable **leaf** package to the fixed version.
|
|
17
|
+
4. **Evaluate reachability, and exclude with a stated reason if unaffected** — before considering any code change. If the advisory cannot affect this project, add a scoped exclusion with a concrete reason to `audit.ignore.local.json`. No human is needed. Typical unreachable cases: the package is used only by dev or build tooling, or the vulnerable input is never untrusted (for example, globs or patterns written in the repository itself). The evaluation is this project's own: Lisa's template exclusions cannot vouch for a host's reachability, so a host the audit flags records its own entry in `audit.ignore.local.json`. **If reachability cannot be proven, treat the advisory as affecting the project** and continue at step 5.
|
|
18
|
+
5. **Replace or remove the dependency** when it affects the project and no fixed version exists: a maintained alternative, a newer major of the parent that no longer pulls the package, or dropping it.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
If none of these works in this change, **file a build-ready ticket** in the configured tracker (through `lisa-tracker-write` with `build_ready: true`) carrying the evidence: the advisory, the dependency path that reaches the vulnerable copy, and what was tried at each of the five steps and why it failed. The factory then carries the replacement or removal as work. Stop only when the next act needs access you do not have, and then say exactly what is missing.
|
|
21
21
|
|
|
22
22
|
## Node.js Projects (GHSA advisories)
|
|
23
23
|
|
|
24
|
-
1. Note the GHSA ID(s), affected package(s), and advisory URL from the error output.
|
|
25
|
-
2. Check the advisory
|
|
26
|
-
3. **Step 1 —
|
|
27
|
-
4. **Step 2 —
|
|
28
|
-
5. **Step 3 —
|
|
29
|
-
6. **Step 4 —
|
|
30
|
-
- **Mitigate** if you can: replace or remove the vulnerable package, or guard the reachable code path so untrusted input cannot reach it, then retry.
|
|
31
|
-
- **Otherwise accept the risk**: add an exclusion entry (as in step 5) whose `reason` records the impact, why no fix or mitigation is possible now, and an expiry date, and file a build-ready follow-up work item to remove the exclusion when a fix ships.
|
|
32
|
-
- Under `humanGate.mode: "strict"`, stop for a human as described in rung 4 instead. That is the only step that pauses for a human in strict mode.
|
|
33
|
-
7. **Step 5 — ignore:** If the evaluation shows the vulnerability **does not** affect the project, add an exclusion entry to `audit.ignore.local.json` yourself, in the format `{"id": "GHSA-xxx", "package": "pkg-name", "reason": "<impact evaluation: why this advisory does not affect this project>"}`, then commit and retry the push. No human approval is required for this step — the `reason` field is the record of your evaluation.
|
|
24
|
+
1. Note the GHSA ID(s), affected package(s), vulnerable lockfile path(s), and advisory URL from the error output.
|
|
25
|
+
2. Check the advisory for the patched version in each affected major (`gh api /advisories/<GHSA-id>`). Also check whether it was withdrawn.
|
|
26
|
+
3. **Step 1 — refresh:** if the patched version satisfies the range the parent declares, update the lockfile for that package (`bun update <pkg>`, `npm update <pkg>`, or `yarn upgrade <pkg>`), confirm with `bun why <pkg>` / `npm ls <pkg>` that every copy is patched, commit, and retry.
|
|
27
|
+
4. **Step 2 — upgrade:** otherwise upgrade the direct dependency whose chain pulls the copy to a release that accepts the patched version, regenerate the lockfile, run the project's tests, commit, and retry.
|
|
28
|
+
5. **Step 3 — override:** otherwise pin the **leaf** package in both `overrides` and `resolutions` in `package.json` (see below), regenerate the lockfile, run the tests, commit, and retry. In a Lisa host, if the fix should reach every project on the stack, propose it upstream in Lisa's `package.lisa.json`.
|
|
29
|
+
6. **Step 4 — evaluate reachability:** if no refresh, upgrade or override lands a patched copy (no fixed version exists, or every compatible pin breaks a dependent), decide whether the vulnerability can affect this project **before changing any code**. Consider: is the vulnerable code path reachable from this project's usage? Does it process untrusted input? Is the dependency runtime, or dev/build-only? If it cannot affect the project, add an exclusion entry to `audit.ignore.local.json` yourself, in the format `{"id": "GHSA-xxx", "package": "pkg-name", "reason": "<impact evaluation: why this advisory does not affect this project>"}`, then commit and retry the push. No human approval is required for this step — the `reason` field is the record of your evaluation. If you cannot show it is unreachable, it affects the project: go on to step 5.
|
|
34
30
|
- **Scope the exclusion to the copy you evaluated.** An entry with only `id` (and `package`) hides the advisory for every copy of the package, including one a production dependency pulls in later. Two optional fields narrow it, and every field present must hold together:
|
|
35
31
|
- `versions` — a semver range the excused installed copies must fall inside, such as `">=3.0.0 <4.0.0"`.
|
|
36
32
|
- `paths` — a non-empty array of exact lockfile key paths for the excused copies: a `bun.lock` `packages` key such as `"lint-plugin/pkg"`, a `package-lock.json` `packages` key such as `"node_modules/lint-plugin/node_modules/pkg"`, or a `yarn.lock` selector key. No globs. Bun keys and nested npm keys isolate one parent. A `yarn.lock` selector names a requested range, not a parent, and a hoisted npm key (`"node_modules/pkg"`) names an install location; any later dependent that asks for that range or resolves to that hoisted copy is covered too, so pair those keys with a tight `versions` range.
|
|
@@ -40,6 +36,9 @@ Every step is autonomous by default. Take step 4 only after you have genuinely a
|
|
|
40
36
|
{"id": "GHSA-xxx", "package": "pkg", "versions": ">=3.0.0 <4.0.0", "paths": ["lint-plugin/pkg"], "reason": "<impact evaluation>"}
|
|
41
37
|
```
|
|
42
38
|
Then any other vulnerable copy — on an unlisted path or through an npm alias — still fails the audit and is named by its lockfile path. An empty `paths` array, an invalid range, or an unreadable lockfile fails the audit with a diagnostic; it never widens into an ID-wide exclusion. The pre-push hook, the gate registry, and CI use the same matcher. `lisa doctor` checks the scope fields and that the lockfile is readable, and reports any remaining exclusion without `versions` or `paths`, but it does not match advisories against lockfile copies — a valid-looking path that names the wrong copy can pass doctor and still be rejected by the audit. Doctor also does not reject an entry with no `id` or an exclusion file that does not parse; the audit does. Only the audit proves the exclusion files are accepted. In CI, the reusable workflow audits the manager its `package_manager` input names (default `npm`), so set that input to the project's manager. A scoped entry always wins over a wider entry for the same advisory and package. Full contract: https://github.com/CodySwannGT/lisa/blob/main/docs/dependency-audit-exclusions.md
|
|
39
|
+
7. **Step 5 — replace or remove:** if the advisory affects the project, replace the dependency with a maintained alternative or remove it, prove behavior with the tests, commit, and retry.
|
|
40
|
+
8. If none of these works in this change, file the build-ready ticket described above.
|
|
41
|
+
|
|
43
42
|
|
|
44
43
|
### Critical: Override the vulnerable package, not its parent
|
|
45
44
|
|
|
@@ -47,18 +46,19 @@ When the audit output shows a dependency chain like `@expo/cli › glob › mini
|
|
|
47
46
|
|
|
48
47
|
**Never override a parent package to force a lower major version** — other packages in the project may depend on a newer major version, and a resolution/override forces ALL installations to the specified version. For example, overriding `glob` to `^8.1.0` will break `@expo/cli` which requires `glob@^13.0.0`, causing `expo prebuild` to fail with `files.map is not a function`.
|
|
49
48
|
|
|
50
|
-
Before adding a resolution/override (step
|
|
49
|
+
Before adding a resolution/override (step 3), verify:
|
|
51
50
|
- You are targeting the **actually vulnerable package**, not a parent in the chain.
|
|
52
51
|
- The override version is **compatible with all dependents** (check with `bun why <package>` or `npm ls <package>`).
|
|
53
52
|
- The override does not **downgrade** a package across a major version boundary that other dependencies require.
|
|
54
53
|
|
|
55
|
-
If any of these checks fail, the override is "not possible" for the purposes of the ladder —
|
|
54
|
+
If any of these checks fail, the override is "not possible" for the purposes of the ladder — go to step 4 (evaluate reachability).
|
|
56
55
|
|
|
57
56
|
### Never
|
|
58
57
|
|
|
59
58
|
- Never add a blanket audit bypass or lower the configured audit level.
|
|
60
|
-
- Never
|
|
61
|
-
- Never
|
|
59
|
+
- Never add an exclusion without an impact evaluation recorded in its `reason`, and never for an advisory you cannot show is unreachable.
|
|
60
|
+
- Never file the ticket before genuinely attempting all five steps.
|
|
61
|
+
- Never wait on a human the work does not need; stop only for missing access, and name it.
|
|
62
62
|
|
|
63
63
|
## Rails Projects (bundler-audit)
|
|
64
64
|
|
|
@@ -69,4 +69,4 @@ Same ladder, bundler mechanics:
|
|
|
69
69
|
3. **Step 1 — update:** If a patched version exists:
|
|
70
70
|
- **Direct dependency** (in Gemfile): update its version constraint, run `bundle update <gem>`, commit, retry.
|
|
71
71
|
- **Transitive dependency** (only in Gemfile.lock): run `bundle update <gem>` to pull the patched version without changing the Gemfile, commit the lockfile change, retry.
|
|
72
|
-
4. **
|
|
72
|
+
4. **No patch:** If no patched version exists, evaluate whether the advisory can affect the project. If it **cannot**, document the exception with the reason and retry. If it **does**, or you cannot show it does not, upgrade or replace the gem that pulls it, or remove it. If none of that works, file a build-ready ticket with the evidence, as above.
|