@soleur/opencode 3.396.1 → 3.397.0
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/.claude-plugin/agents.manifest.json +1 -1
- package/agents/engineering/review/security-sentinel.md +2 -0
- package/agents/engineering/review/semgrep-sast.md +7 -26
- package/opencode/agents/engineering/review/semgrep-sast.md +1 -1
- package/package.json +1 -1
- package/scripts/cloudflare-readonly.sh +215 -19
- package/skills/agent-browser/SKILL.md +6 -0
- package/skills/brainstorm-techniques/references/standing-delegation.md +3 -3
- package/skills/qa/references/browser-preflight.md +2 -0
- package/skills/review/SKILL.md +3 -19
- package/skills/review/references/risk-tier-and-fix-rounds.md +3 -0
- package/skills/review/scripts/review-scan-gate.sh +276 -0
- package/skills/review/test/review-scan-gate.test.sh +517 -0
|
@@ -91,6 +91,9 @@ Two lessons from #9448 belong in every fix-agent and review-seat brief (full acc
|
|
|
91
91
|
- **A seat's remediation advice and the lead's own "X is undocumented / only / never" are claims: read the enforcing script and the whole source sentence before writing either into a document.** A fix that adds a procedure (a removal order, an apply order) names a gate; open the gate. A negative about a doc (`cut -c1-300` hides the end of the line) is not evidence of absence. **Why:** #10976 fix round — a removal-checklist order taken from a seat contradicted `sentry-alert-reference-gate.sh` (one PR, with `[ack-destroy]`), and a README row said the SDK "documents only four" key sources when the next clause calls the rest legacy members current CLIs never emit; two seats found each. See `knowledge-base/project/learnings/2026-10-25-a-diagnostic-that-can-go-blind-must-say-so-and-my-docs-claimed-more-than-the-sdk-said.md`.
|
|
92
92
|
- **A fix to PROSE that prescribes a state machine (a runbook run sheet, an abort/retry/rollback ladder) is reviewed by walking the state space, not the sentence.** List every variable the procedure can be in (flag, pause, exemption, sentinel, stamp, per-host state, before/after the irreversible step) and name the action each sentence prescribes in each reachable state; two sentences prescribing different actions in one state, or none, is a P1 whatever the wording. Key every abort/retry on the failure table's first step, not on one variable. **Why:** #11812 - the first fix commit introduced 3 new P1 and the second round still found one. See `knowledge-base/project/learnings/2026-11-01-every-fix-to-the-run-sheet-covered-the-state-i-was-thinking-of-and-the-sheet-had-eight-more.md`.
|
|
93
93
|
|
|
94
|
+
- **The Workflow tool needs the user's own request; the review skill's "opt-in Workflow port" pointer is not that.** Spawn fix-round seats with the Agent tool unless the user asked for a workflow in their own words. On #12515 a fix round was launched through the Workflow tool, noticed, stopped and respawned.
|
|
95
|
+
- **A floor that counts a conditional row adds it only when its precondition held.** A UTF-8 locale row counted in an unconditional projection floor would go red on a minimal CI image with a correct tree (found by the verifier seat on #12515); count the conditional rows separately and add them to the floor when they ran. See `knowledge-base/project/learnings/2026-11-10-a-fix-rounds-new-gates-and-rows-repeated-the-class-they-closed.md`.
|
|
96
|
+
|
|
94
97
|
## Dedup-before-fixing ledger
|
|
95
98
|
|
|
96
99
|
§5 Step 1's "Remove duplicate or overlapping findings" becomes a required emitted artifact, produced **before any fix dispatch**:
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Orchestrator scan receipt. Stdout is the status line, then file:line rule-id.
|
|
3
|
+
# A temp dir, when one is needed, lives under mktemp and is removed on every return.
|
|
4
|
+
|
|
5
|
+
set -u
|
|
6
|
+
|
|
7
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
8
|
+
ROOT="$(cd "$SCRIPT_DIR/../../../../.." && pwd)"
|
|
9
|
+
ENSURE="$SCRIPT_DIR/ensure-semgrep.sh"
|
|
10
|
+
TMP="$(mktemp -d)"
|
|
11
|
+
|
|
12
|
+
# The EXIT/INT/TERM trap below is the only caller. Shellcheck does not count a trap as a call.
|
|
13
|
+
# shellcheck disable=SC2329
|
|
14
|
+
cleanup() {
|
|
15
|
+
rm -rf "$TMP"
|
|
16
|
+
}
|
|
17
|
+
trap cleanup EXIT INT TERM
|
|
18
|
+
|
|
19
|
+
refuse() {
|
|
20
|
+
echo "SOLEUR_REVIEW_SCAN_GATE refuse engine=${1:-none} files=${2:-0} rules=${3:-0} findings=${4:-0}"
|
|
21
|
+
exit 1
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if [ "${1:-}" = "--probe" ]; then
|
|
25
|
+
echo "SOLEUR_REVIEW_SCAN_GATE probe"
|
|
26
|
+
exit 0
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
is_lock() {
|
|
30
|
+
case "$(basename -- "$1")" in
|
|
31
|
+
package-lock.json|bun.lock|yarn.lock|Cargo.lock|go.sum|Gemfile.lock|poetry.lock|uv.lock) return 0 ;;
|
|
32
|
+
*) return 1 ;;
|
|
33
|
+
esac
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
kind_of() {
|
|
37
|
+
local base
|
|
38
|
+
base="$(basename -- "$1")"
|
|
39
|
+
case "$base" in
|
|
40
|
+
*.sh|*.bash|*.zsh) printf 'shell\n'; return ;;
|
|
41
|
+
esac
|
|
42
|
+
case "$base" in
|
|
43
|
+
*.py|*.js|*.jsx|*.ts|*.tsx|*.mjs|*.cjs|*.rb|*.go|*.java|*.rs|*.swift|*.kt|*.kts|*.c|*.cc|*.cpp|*.h|*.hpp|*.cs|*.php|*.scala)
|
|
44
|
+
printf 'source\n'
|
|
45
|
+
return
|
|
46
|
+
;;
|
|
47
|
+
esac
|
|
48
|
+
printf 'other\n'
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
is_test_path() {
|
|
52
|
+
case "$1" in
|
|
53
|
+
test/*|*/test/*) return 0 ;;
|
|
54
|
+
*) return 1 ;;
|
|
55
|
+
esac
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
line_copied_from_target() {
|
|
59
|
+
local line="$1" f
|
|
60
|
+
shift
|
|
61
|
+
for f in "$@"; do
|
|
62
|
+
[ -f "$f" ] || continue
|
|
63
|
+
if grep -Fxq -- "$line" "$f"; then
|
|
64
|
+
return 0
|
|
65
|
+
fi
|
|
66
|
+
done
|
|
67
|
+
return 1
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
summary_rules() {
|
|
71
|
+
local err="$1" rules=0 line n
|
|
72
|
+
shift
|
|
73
|
+
while IFS= read -r line || [ -n "$line" ]; do
|
|
74
|
+
if [[ "$line" =~ ^Ran[[:space:]]([0-9]+)[[:space:]]rules?[[:space:]]on[[:space:]]([0-9]+)[[:space:]]files? ]]; then
|
|
75
|
+
n="${BASH_REMATCH[1]}"
|
|
76
|
+
if line_copied_from_target "$line" "$@"; then
|
|
77
|
+
continue
|
|
78
|
+
fi
|
|
79
|
+
if [ "${BASH_REMATCH[2]}" -eq 0 ]; then
|
|
80
|
+
continue
|
|
81
|
+
fi
|
|
82
|
+
rules="$n"
|
|
83
|
+
fi
|
|
84
|
+
done <"$err"
|
|
85
|
+
printf '%s\n' "$rules"
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
sources=()
|
|
89
|
+
shells=()
|
|
90
|
+
for path in "$@"; do
|
|
91
|
+
[ -f "$path" ] || continue
|
|
92
|
+
if is_lock "$path"; then
|
|
93
|
+
continue
|
|
94
|
+
fi
|
|
95
|
+
case "$(kind_of "$path")" in
|
|
96
|
+
source) sources+=("$path") ;;
|
|
97
|
+
shell) shells+=("$path") ;;
|
|
98
|
+
*) ;;
|
|
99
|
+
esac
|
|
100
|
+
done
|
|
101
|
+
|
|
102
|
+
files=$(( ${#sources[@]} + ${#shells[@]} ))
|
|
103
|
+
|
|
104
|
+
if [ "$files" -eq 0 ]; then
|
|
105
|
+
echo "SOLEUR_REVIEW_SCAN_GATE skip engine=none files=0 rules=0 findings=0"
|
|
106
|
+
exit 0
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
if [ "${#sources[@]}" -gt 0 ] && [ "${#shells[@]}" -gt 0 ]; then
|
|
110
|
+
engine="mixed"
|
|
111
|
+
elif [ "${#sources[@]}" -gt 0 ]; then
|
|
112
|
+
engine="semgrep"
|
|
113
|
+
else
|
|
114
|
+
engine="shellcheck"
|
|
115
|
+
fi
|
|
116
|
+
|
|
117
|
+
TMP="$(mktemp -d)"
|
|
118
|
+
rules=0
|
|
119
|
+
findings=0
|
|
120
|
+
finding_lines=()
|
|
121
|
+
|
|
122
|
+
if [ "${#sources[@]}" -gt 0 ]; then
|
|
123
|
+
if ! bash "$ENSURE" >/dev/null 2>&1; then
|
|
124
|
+
refuse "$engine" "$files" 0 0
|
|
125
|
+
fi
|
|
126
|
+
map="$TMP/map.tsv"
|
|
127
|
+
: >"$map"
|
|
128
|
+
scan_args=()
|
|
129
|
+
need_ignore=0
|
|
130
|
+
idx=0
|
|
131
|
+
for src in "${sources[@]}"; do
|
|
132
|
+
if is_test_path "$src"; then
|
|
133
|
+
need_ignore=1
|
|
134
|
+
ext="${src##*.}"
|
|
135
|
+
copy="$TMP/scan/$idx.$ext"
|
|
136
|
+
mkdir -p "$TMP/scan"
|
|
137
|
+
cp -- "$src" "$copy"
|
|
138
|
+
printf '%s\t%s\n' "$copy" "$src" >>"$map"
|
|
139
|
+
scan_args+=("$copy")
|
|
140
|
+
idx=$((idx + 1))
|
|
141
|
+
else
|
|
142
|
+
printf '%s\t%s\n' "$src" "$src" >>"$map"
|
|
143
|
+
scan_args+=("$src")
|
|
144
|
+
fi
|
|
145
|
+
done
|
|
146
|
+
if [ "$need_ignore" -eq 1 ]; then
|
|
147
|
+
: >"$TMP/scan/.semgrepignore"
|
|
148
|
+
fi
|
|
149
|
+
sem_args=(
|
|
150
|
+
--config=auto
|
|
151
|
+
--config=p/javascript
|
|
152
|
+
--config=p/typescript
|
|
153
|
+
--config=p/owasp-top-ten
|
|
154
|
+
--config=plugins/soleur/skills/review/references/semgrep-custom-rules.yaml
|
|
155
|
+
--json
|
|
156
|
+
--error
|
|
157
|
+
)
|
|
158
|
+
if [ "$need_ignore" -eq 1 ]; then
|
|
159
|
+
sem_args+=(--no-git-ignore)
|
|
160
|
+
fi
|
|
161
|
+
out="$TMP/sem.json"
|
|
162
|
+
err="$TMP/sem.err"
|
|
163
|
+
attempt=0
|
|
164
|
+
sem_rc=0
|
|
165
|
+
while [ "$attempt" -lt 2 ]; do
|
|
166
|
+
attempt=$((attempt + 1))
|
|
167
|
+
if [ "$attempt" -eq 2 ]; then
|
|
168
|
+
( cd "$ROOT" && EIO_BACKEND=posix semgrep -j 1 "${sem_args[@]}" "${scan_args[@]}" >"$out" 2>"$err" )
|
|
169
|
+
else
|
|
170
|
+
( cd "$ROOT" && semgrep "${sem_args[@]}" "${scan_args[@]}" >"$out" 2>"$err" )
|
|
171
|
+
fi
|
|
172
|
+
sem_rc=$?
|
|
173
|
+
if [ "$attempt" -eq 1 ] && grep -q 'io_uring_queue_init: Cannot allocate memory' "$err"; then
|
|
174
|
+
continue
|
|
175
|
+
fi
|
|
176
|
+
break
|
|
177
|
+
done
|
|
178
|
+
if [ "$sem_rc" -ne 0 ] && [ "$sem_rc" -ne 1 ]; then
|
|
179
|
+
refuse "$engine" "$files" 0 0
|
|
180
|
+
fi
|
|
181
|
+
rules="$(summary_rules "$err" "${sources[@]}")"
|
|
182
|
+
if [ "$rules" -eq 0 ]; then
|
|
183
|
+
refuse "$engine" "$files" 0 0
|
|
184
|
+
fi
|
|
185
|
+
parsed="$TMP/parsed.txt"
|
|
186
|
+
if ! python3 - "$out" "$map" >"$parsed" <<'PY'
|
|
187
|
+
import json, sys
|
|
188
|
+
data = json.load(open(sys.argv[1]))
|
|
189
|
+
mapping = {}
|
|
190
|
+
for raw in open(sys.argv[2]):
|
|
191
|
+
raw = raw.rstrip("\n")
|
|
192
|
+
if not raw:
|
|
193
|
+
continue
|
|
194
|
+
src, orig = raw.split("\t", 1)
|
|
195
|
+
mapping[src] = orig
|
|
196
|
+
paths = data.get("paths") or {}
|
|
197
|
+
scanned = paths.get("scanned") or []
|
|
198
|
+
print("SCANNED")
|
|
199
|
+
for item in scanned:
|
|
200
|
+
print(mapping.get(item, item))
|
|
201
|
+
print("FINDINGS")
|
|
202
|
+
for row in data.get("results") or []:
|
|
203
|
+
path = mapping.get(row.get("path", ""), row.get("path", ""))
|
|
204
|
+
start = row.get("start") or {}
|
|
205
|
+
line = start.get("line", 0)
|
|
206
|
+
rule = row.get("check_id") or "unknown"
|
|
207
|
+
print(f"{path}:{line} {rule}")
|
|
208
|
+
PY
|
|
209
|
+
then
|
|
210
|
+
refuse "$engine" "$files" 0 0
|
|
211
|
+
fi
|
|
212
|
+
mode="wait"
|
|
213
|
+
scanned_tmp="$TMP/scanned.list"
|
|
214
|
+
: >"$scanned_tmp"
|
|
215
|
+
while IFS= read -r row || [ -n "$row" ]; do
|
|
216
|
+
if [ "$row" = "SCANNED" ]; then
|
|
217
|
+
mode="scanned"
|
|
218
|
+
continue
|
|
219
|
+
fi
|
|
220
|
+
if [ "$row" = "FINDINGS" ]; then
|
|
221
|
+
mode="findings"
|
|
222
|
+
continue
|
|
223
|
+
fi
|
|
224
|
+
if [ "$mode" = "scanned" ]; then
|
|
225
|
+
printf '%s\n' "$row" >>"$scanned_tmp"
|
|
226
|
+
elif [ "$mode" = "findings" ] && [ -n "$row" ]; then
|
|
227
|
+
finding_lines+=("$row")
|
|
228
|
+
findings=$((findings + 1))
|
|
229
|
+
fi
|
|
230
|
+
done <"$parsed"
|
|
231
|
+
for src in "${sources[@]}"; do
|
|
232
|
+
if ! grep -Fxq -- "$src" "$scanned_tmp"; then
|
|
233
|
+
refuse "$engine" "$files" "$rules" 0
|
|
234
|
+
fi
|
|
235
|
+
done
|
|
236
|
+
scanned_n="$(grep -c . "$scanned_tmp" || true)"
|
|
237
|
+
if [ "$scanned_n" -ne "${#sources[@]}" ]; then
|
|
238
|
+
refuse "$engine" "$files" "$rules" 0
|
|
239
|
+
fi
|
|
240
|
+
fi
|
|
241
|
+
|
|
242
|
+
if [ "${#shells[@]}" -gt 0 ]; then
|
|
243
|
+
if ! command -v shellcheck >/dev/null 2>&1; then
|
|
244
|
+
refuse "$engine" "$files" "$rules" 0
|
|
245
|
+
fi
|
|
246
|
+
sh_out="$TMP/sh.json"
|
|
247
|
+
sh_err="$TMP/sh.err"
|
|
248
|
+
shellcheck -f json "${shells[@]}" >"$sh_out" 2>"$sh_err"
|
|
249
|
+
sh_rc=$?
|
|
250
|
+
if [ "$sh_rc" -ne 0 ] && [ "$sh_rc" -ne 1 ]; then
|
|
251
|
+
refuse "$engine" "$files" "$rules" 0
|
|
252
|
+
fi
|
|
253
|
+
sh_parsed="$TMP/sh-parsed.txt"
|
|
254
|
+
if ! python3 - "$sh_out" >"$sh_parsed" <<'PY'
|
|
255
|
+
import json, sys
|
|
256
|
+
rows = json.load(open(sys.argv[1]))
|
|
257
|
+
for row in rows:
|
|
258
|
+
code = row.get("code")
|
|
259
|
+
rule = f"SC{code}" if isinstance(code, int) else str(code)
|
|
260
|
+
print(f"{row.get('file')}:{row.get('line')} {rule}")
|
|
261
|
+
PY
|
|
262
|
+
then
|
|
263
|
+
refuse "$engine" "$files" "$rules" 0
|
|
264
|
+
fi
|
|
265
|
+
while IFS= read -r row || [ -n "$row" ]; do
|
|
266
|
+
[ -n "$row" ] || continue
|
|
267
|
+
finding_lines+=("$row")
|
|
268
|
+
findings=$((findings + 1))
|
|
269
|
+
done <"$sh_parsed"
|
|
270
|
+
fi
|
|
271
|
+
|
|
272
|
+
echo "SOLEUR_REVIEW_SCAN_GATE ok engine=${engine} files=${files} rules=${rules} findings=${findings}"
|
|
273
|
+
if [ "${#finding_lines[@]}" -gt 0 ]; then
|
|
274
|
+
printf '%s\n' "${finding_lines[@]}"
|
|
275
|
+
fi
|
|
276
|
+
exit 0
|