lastlight-core 0.33.1 → 0.34.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/config/default.yaml +137 -48
- package/dist/config/config.d.ts +1 -1
- package/dist/config/config.js +45 -29
- package/dist/config/config.js.map +1 -1
- package/dist/engine/event-shim.d.ts +22 -0
- package/dist/engine/event-shim.js +98 -0
- package/dist/engine/event-shim.js.map +1 -1
- package/dist/engine/executors/orchestrator.js +20 -1
- package/dist/engine/executors/orchestrator.js.map +1 -1
- package/dist/engine/github/review-poster.d.ts +249 -40
- package/dist/engine/github/review-poster.js +332 -54
- package/dist/engine/github/review-poster.js.map +1 -1
- package/dist/engine/github/review-summary.d.ts +61 -0
- package/dist/engine/github/review-summary.js +101 -0
- package/dist/engine/github/review-summary.js.map +1 -0
- package/dist/engine/pr-decisions.d.ts +16 -0
- package/dist/engine/pr-decisions.js +127 -11
- package/dist/engine/pr-decisions.js.map +1 -1
- package/dist/engine/review-spec.d.ts +1 -1
- package/dist/engine/review-spec.js +69 -38
- package/dist/engine/review-spec.js.map +1 -1
- package/dist/sandbox/docker.js +6 -0
- package/dist/sandbox/docker.js.map +1 -1
- package/dist/sandbox/k8s/run-agent-script.js +5 -0
- package/dist/sandbox/k8s/run-agent-script.js.map +1 -1
- package/dist/sandbox/sandbox.d.ts +7 -0
- package/dist/sandbox/sandbox.js +13 -0
- package/dist/sandbox/sandbox.js.map +1 -1
- package/dist/sandbox/smol.js +6 -0
- package/dist/sandbox/smol.js.map +1 -1
- package/dist/session-log.js +4 -0
- package/dist/session-log.js.map +1 -1
- package/dist/telemetry/openinference.d.ts +13 -0
- package/dist/telemetry/openinference.js +13 -0
- package/dist/telemetry/openinference.js.map +1 -1
- package/dist/telemetry/pi-events.js +16 -1
- package/dist/telemetry/pi-events.js.map +1 -1
- package/dist/workflows/handlers/fanout.d.ts +42 -7
- package/dist/workflows/handlers/fanout.js +145 -19
- package/dist/workflows/handlers/fanout.js.map +1 -1
- package/dist/workflows/handlers/post-review.d.ts +17 -0
- package/dist/workflows/handlers/post-review.js +137 -50
- package/dist/workflows/handlers/post-review.js.map +1 -1
- package/dist/workflows/runner.js +1 -1
- package/dist/workflows/runner.js.map +1 -1
- package/package.json +5 -5
- package/skills/adjudicate-pass/SKILL.md +24 -20
- package/skills/survey-pass/SKILL.md +121 -130
- package/workflows/pr-review.yaml +210 -7
- package/workflows/prompts/review-adjudicate.md +388 -263
- package/workflows/prompts/review-falsify.md +185 -44
- package/workflows/prompts/review.md +10 -10
- package/workflows/prompts/survey-contract.md +48 -48
- package/workflows/prompts/survey-enforcement.md +102 -134
- package/workflows/prompts/survey-security.md +53 -56
- package/workflows/prompts/survey-spec.md +52 -37
- package/workflows/prompts/survey-state.md +54 -53
- package/workflows/prompts/survey-tests.md +48 -48
|
@@ -1,137 +1,105 @@
|
|
|
1
|
-
You are
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
downstream can
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
3. "Quote the line that enforces `<CONST>` AND the line where the value it
|
|
101
|
-
guards is consumed. If consumption happens first, quote both in order."
|
|
102
|
-
4. "This value is written on one side and read on the other. Quote the type or
|
|
103
|
-
schema that makes a third writer impossible, or name the writer that
|
|
104
|
-
bypasses it."
|
|
105
|
-
5. "`<CONST>` changed value in this diff (`A` → `B`). Quote the line elsewhere
|
|
106
|
-
that still assumes `A`."
|
|
107
|
-
6. "This value is validated where it is ISSUED. Quote the line at the point of
|
|
108
|
-
USE that re-checks it — the consumer that decodes, the reader that trusts —
|
|
109
|
-
or state that use trusts issuance unchecked."
|
|
110
|
-
|
|
111
|
-
## State the residual risk, not the reassurance
|
|
112
|
-
|
|
113
|
-
A discharge that concludes "correctly handled", "properly ordered" or
|
|
114
|
-
"enforced" is a CLAIM, not a measurement — and its direction is the one thing
|
|
115
|
-
no downstream stage can flip. Before you write "correct", name the bar you
|
|
116
|
-
graded against: who or what can reach this code WITHOUT the check, and what
|
|
117
|
-
happens then. Two invariants can both be true of the same quoted line — "the
|
|
118
|
-
check runs before the handler" and "the check runs before any request-derived
|
|
119
|
-
value is read" are different bars — and this family's question is always the
|
|
120
|
-
strongest bar it cares about, never the weakest true statement. If you cannot
|
|
121
|
-
name the bar, record the mechanism with `needsProbe: true` and no verdict: the
|
|
122
|
-
probe and the adjudicator can remove a risk you wrote down, but they will never
|
|
123
|
-
see the one you graded away as fine.
|
|
1
|
+
You are one analysis pass over **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{baseBranch}}`. Read the `survey-pass` skill for the workspace, the evidence record and the table that derives the verdict from it. This prompt carries the question you own.
|
|
2
|
+
|
|
3
|
+
## The one question you own
|
|
4
|
+
|
|
5
|
+
**A value is defined on one side of a boundary. Who checks it on the other?**
|
|
6
|
+
|
|
7
|
+
A limit, an expiry, a quota, a claim in a token, a set of supported inputs — anything that has to hold in more than one place holds in *none* of them if one side never checks. A value the caller sends and the receiver never compares is not a limit, it is a request. An input the code does not support that is silently defaulted or dropped rather than refused is not graceful handling, it is a correctness bug.
|
|
8
|
+
|
|
9
|
+
Other passes own tests, ordering, contracts and intent. Spending this pass on them costs the one question nobody else is asking.
|
|
10
|
+
|
|
11
|
+
## Why the job is shaped like this
|
|
12
|
+
|
|
13
|
+
You post nothing. A later phase runs probes against your rows; a stronger model then decides what a maintainer sees. **Both stages can only DELETE.**
|
|
14
|
+
|
|
15
|
+
1. **A mechanism you do not record is gone.** No probe reaches it, no adjudicator recovers it.
|
|
16
|
+
2. **You pay no precision cost.** Doubt is a reason to record and flag it, never to withhold.
|
|
17
|
+
3. **Direction is the one thing downstream cannot flip.** A probe can kill a risk you wrote down. Nothing can reopen a risk you wrote down as handled.
|
|
18
|
+
|
|
19
|
+
The third is the failure this pass exists to prevent: arriving at the exact line where a defect lives, reading it, and recording that it is fine.
|
|
20
|
+
|
|
21
|
+
## What closes the mechanism, for `enforcement`
|
|
22
|
+
|
|
23
|
+
`control_site` is the only field in the shared record whose meaning is yours to fix. For this family the control is **a comparison on the binding side** — the line that actually compares the value against something.
|
|
24
|
+
|
|
25
|
+
A line that MENTIONS the value closes nothing. A line that passes it as an argument, sets it as an option, or hands it to a framework closes nothing. Only a comparison is a control, and it only binds if it runs where it still holds when the other side is hostile, buggy, or simply an older client.
|
|
26
|
+
|
|
27
|
+
## Procedure
|
|
28
|
+
|
|
29
|
+
Run this once per obligation. A later step is only sound if the earlier ones were actually performed.
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
for ob in obligations:
|
|
33
|
+
# 1. FIND EVERY SITE — not just the ones the obligation names.
|
|
34
|
+
sites = grep(repo, ob.subject) # whole checkout, not the diff
|
|
35
|
+
|
|
36
|
+
# 2. CLASSIFY each site by what it does with the value.
|
|
37
|
+
defines = [s for s in sites if s assigns or declares it]
|
|
38
|
+
uses = [s for s in sites if s consumes it to do work]
|
|
39
|
+
controls = [s for s in sites if s COMPARES it against something]
|
|
40
|
+
|
|
41
|
+
# 3. LOCATE THE BOUNDARY the value constrains.
|
|
42
|
+
producer = who supplies the input it governs
|
|
43
|
+
consumer = who acts on that input
|
|
44
|
+
# binding side = the one still correct if the other were hostile
|
|
45
|
+
|
|
46
|
+
# 4. If controls is empty, that IS the answer: control_site = none.
|
|
47
|
+
|
|
48
|
+
# 5. LOOK FOR A BYPASS before concluding anything is closed.
|
|
49
|
+
# Find one concrete path reaching `uses` without passing `controls`:
|
|
50
|
+
# another caller, another entry point, a cached or replayed value,
|
|
51
|
+
# a default applied when the value is absent.
|
|
52
|
+
# SEARCH for it. Do not reason about whether one is likely.
|
|
53
|
+
|
|
54
|
+
# 6. FILL the evidence record, then compute the verdict from it.
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Do not ask whether a controlling line exists — that question has an innocent answer almost everywhere. Ask what it cannot tell you:
|
|
58
|
+
|
|
59
|
+
- which two different situations does it treat **identically**?
|
|
60
|
+
- which side of the boundary does it run on?
|
|
61
|
+
- does it run **before or after** the value it guards is consumed?
|
|
62
|
+
- if the value changed in this diff, what elsewhere still assumes the old one?
|
|
63
|
+
- if it is checked where the value is issued, what re-checks it where it is **used**?
|
|
64
|
+
- when it trips, what does the caller learn — or does it fail silently?
|
|
65
|
+
|
|
66
|
+
`found: false` on an obligation does not mean something is missing. It means nobody has looked yet. You are the one looking.
|
|
67
|
+
|
|
68
|
+
## Worked example
|
|
69
|
+
|
|
70
|
+
Invented, for SHAPE only.
|
|
71
|
+
|
|
72
|
+
Obligation: *Quote the line that compares or enforces `MAX_UPLOAD_BYTES`, or state that no such line exists.*
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
sites = client/upload.ts:14 (defines), client/upload.ts:52 (compares),
|
|
76
|
+
server/routes/files.ts:88 (uses: streams body to disk)
|
|
77
|
+
controls = [client/upload.ts:52]
|
|
78
|
+
producer = the browser client consumer = the file-write route
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{"id":"enforcement-001","obligation":"O-007","family":"enforcement",
|
|
83
|
+
"claim":"the size cap is compared only in the browser; the route streams the body to disk without comparing it, so any non-browser client writes an unbounded file",
|
|
84
|
+
"bothEnds":{"introducedAt":"client/upload.ts:14","enforcedAt":"client/upload.ts:52"},
|
|
85
|
+
"quotes":[{"path":"client/upload.ts","line":52,"text":"if (file.size > MAX_UPLOAD_BYTES) return reject(file);"}],
|
|
86
|
+
"existingCode":"if (file.size > MAX_UPLOAD_BYTES) return reject(file);",
|
|
87
|
+
"evidence":{"subject":"MAX_UPLOAD_BYTES","control_site":"client/upload.ts:52",
|
|
88
|
+
"control_text":"if (file.size > MAX_UPLOAD_BYTES) return reject(file);",
|
|
89
|
+
"authority":"advisory","order_ok":true,
|
|
90
|
+
"cannot_distinguish":"a request from the app and a request from curl",
|
|
91
|
+
"bypass":"any direct POST to /files skips upload.ts entirely",
|
|
92
|
+
"in_changed_hunk":true,
|
|
93
|
+
"consequence":"a client that does not run this check uploads a file of any size; the route writes it to disk",
|
|
94
|
+
"trigger":"input","crosses_boundary":true,
|
|
95
|
+
"capability_gained":"writing unbounded data to server disk"},
|
|
96
|
+
"needsProbe":true,"severity":"Critical","confidence":0.7}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`authority` is `advisory`, so `discharge` derives to `PARTIAL` and `needsProbe` to `true` — even though a line was found and quoted. The quoted line is real; it just runs where it cannot bind.
|
|
124
100
|
|
|
125
101
|
## Output
|
|
126
102
|
|
|
127
|
-
Append one JSON object per
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
and the obligation ids you discharged, so that "surveyed and found nothing" and
|
|
131
|
-
"never ran" stay distinguishable.
|
|
132
|
-
|
|
133
|
-
The placeholder carries **no analysis**. The moment its details start quoting
|
|
134
|
-
lines and grading them — "X runs before Y, so the order is correct" — you are
|
|
135
|
-
writing a hypothesis with a verdict, and it must be recorded as one, bar named,
|
|
136
|
-
never folded into the no-hypothesis line where no probe and no adjudicator will
|
|
137
|
-
ever look at it.
|
|
103
|
+
Append one JSON object per obligation to `.lastlight/pr-review/hypotheses/enforcement.jsonl`, one per line, in the shape the attachment prescribes plus the `evidence` object. Create the file even with nothing to record. Read and write no other family's file.
|
|
104
|
+
|
|
105
|
+
Your obligations are appended below under `## Attached: the file this pass was seeded with`. That attachment is the delivery; do not look for them on disk. If it says NOT MEASURED, NOT AVAILABLE, or that no obligations could be built, make that your first row and then work the diff for this family's question yourself, saying plainly that you ran unseeded — *we could not look* and *we looked and it is clean* are different facts. That first row is not the pass: one that writes only it surveyed nothing, and the gate fails it.
|
|
@@ -7,46 +7,31 @@ Reviewing **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{bas
|
|
|
7
7
|
|
|
8
8
|
## What this pass is, and what it is not
|
|
9
9
|
|
|
10
|
-
A deterministic layer
|
|
11
|
-
questions that each name BOTH ENDS of a possible defect mechanism: where
|
|
12
|
-
something is introduced, and where it would have to be enforced. Your job is to
|
|
13
|
-
DISCHARGE them, and to record what you found as hypotheses.
|
|
10
|
+
A deterministic layer analysed this diff and wrote **obligations** — questions that each name BOTH ENDS of a possible defect mechanism: where something is introduced, and where it would have to be enforced. Discharge them, and record what you found as hypotheses.
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
and a stronger model adjudicates. Both of them can only REMOVE. Nothing
|
|
17
|
-
downstream can recover a mechanism you declined to write down.
|
|
12
|
+
> **Nothing downstream can recover a mechanism you declined to write down.**
|
|
18
13
|
|
|
19
|
-
So the
|
|
20
|
-
plausible mechanism you cannot yet refute is a hypothesis, not noise. Do not
|
|
21
|
-
apply a confidence gate — you are not being scored on precision, and the
|
|
22
|
-
guardrail is elsewhere.
|
|
14
|
+
So: **over-produce** — see the `survey-pass` skill for why the precision gate does not fire on you.
|
|
23
15
|
|
|
24
16
|
## Hard limits on this pass
|
|
25
17
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
working directory — open them exactly as written and never join them onto an
|
|
38
|
-
absolute path. Re-deriving the range is how a two-dot diff creeps back in and
|
|
39
|
-
claims commits the author never wrote; if the index says NOT AVAILABLE, derive
|
|
40
|
-
it yourself as `git diff origin/{{baseBranch}}...HEAD`, three dots.
|
|
18
|
+
| do NOT | why |
|
|
19
|
+
|---|---|
|
|
20
|
+
| **Do NOT read or write any other family's file** | another pass owns each; appending to disjoint files makes a consensus collapse impossible **by construction**, not by instruction |
|
|
21
|
+
| **Do NOT re-derive this PR's range with `git diff` or `git show`.** | it is already staged — see below |
|
|
22
|
+
|
|
23
|
+
**The range is already resolved.** `.lastlight/pr-review/diff/index.md` lists every changed file with its status, its changed line ranges, and the per-file patch under `.lastlight/pr-review/diff/`. Read those. Paths are relative to your working directory — open them exactly as written, never joined onto an absolute path.
|
|
24
|
+
|
|
25
|
+
If the index says NOT AVAILABLE, derive it yourself as `git diff origin/{{baseBranch}}...HEAD` — **three dots**.
|
|
26
|
+
|
|
27
|
+
<!-- Re-deriving is how a two-dot diff creeps back in and claims commits the
|
|
28
|
+
author never wrote. -->
|
|
41
29
|
|
|
42
30
|
## What you have: the whole checkout
|
|
43
31
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
references the patch never shows you, follow a changed symbol out into the files
|
|
48
|
-
this PR did not touch. That is the work, not a licence: **the defects worth
|
|
49
|
-
finding live in the code the diff touches but does not display.**
|
|
32
|
+
The staged diff is your STARTING POINT, not your scope: open the changed files whole, grep for the callers the patch never shows you, and follow a changed symbol out into files this PR did not touch.
|
|
33
|
+
|
|
34
|
+
**The defects worth finding live in the code the diff touches but does not display.**
|
|
50
35
|
|
|
51
36
|
## Your family: `security`
|
|
52
37
|
|
|
@@ -56,13 +41,7 @@ A changed symbol sits in a file a scanner also flagged. The question is whether
|
|
|
56
41
|
Injection, authn/authz, secret handling, untrusted input, and what a guard does
|
|
57
42
|
with an input shape it was not written for.
|
|
58
43
|
|
|
59
|
-
**A hazard is not a boundary crossing.**
|
|
60
|
-
`Critical`, name the boundary the input crosses AND a capability its supplier
|
|
61
|
-
does not already have. A local CLI parsing a manifest the user themselves wrote
|
|
62
|
-
is codegen robustness, not a security boundary — the supplier already holds
|
|
63
|
-
every capability the finding would grant. Record it, at its real tier. Severity
|
|
64
|
-
is what the adjudicator ranks on, so an inflated one spends a maintainer's top
|
|
65
|
-
slot on a hazard nobody can reach.
|
|
44
|
+
**A hazard is not a boundary crossing.** The `Critical` bar is the `survey-pass` skill's. The half that is yours: a hazard that fails that bar is still **recorded, at its real tier** — demoting is not dropping — and an inflated one spends a maintainer's top slot on a hazard nobody can reach.
|
|
66
45
|
|
|
67
46
|
### The change-scoped checklist
|
|
68
47
|
|
|
@@ -108,14 +87,20 @@ contract and you must follow it exactly.
|
|
|
108
87
|
path you construct for it is a guess about a harness layout that varies by
|
|
109
88
|
backend, and earlier passes have lost their seed to exactly that guess.
|
|
110
89
|
|
|
111
|
-
Read the attachment before anything else. It
|
|
112
|
-
three different facts:
|
|
90
|
+
Read the attachment before anything else. It says one of these, and they are different facts:
|
|
113
91
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
92
|
+
| it says | you do |
|
|
93
|
+
|---|---|
|
|
94
|
+
| **obligations** | discharge every one, exactly as its contract says |
|
|
95
|
+
| **NOT MEASURED**, or **no obligations could be built** | make that your FIRST row, then work the diff for this family's question yourself. It is not a result and not a licence to stop: a pass that writes only that row surveyed nothing, and the gate fails it |
|
|
96
|
+
| **NOT AVAILABLE** (or a path to open yourself) | do exactly what it tells you to |
|
|
117
97
|
|
|
118
|
-
|
|
98
|
+
A block that was never delivered is **not** a clean result, and not a finding about the code either. Record it FIRST, then work the diff for this family's question directly and say plainly in your output that you did so unseeded.
|
|
99
|
+
|
|
100
|
+
The scanner hit is CORROBORATION, not the finding. Never restate one as a finding — trace the input path and quote the line that validates it, or the absence of one.
|
|
101
|
+
|
|
102
|
+
<!-- Measured on real PRs, scanner hits and human reviewers' findings almost
|
|
103
|
+
never coincide. -->
|
|
119
104
|
|
|
120
105
|
## The questions an innocent quote cannot answer
|
|
121
106
|
|
|
@@ -136,19 +121,31 @@ how a caller learns it fired. The recurring shapes:
|
|
|
136
121
|
rejection the contract promises — not an unhandled error the caller reads
|
|
137
122
|
as a server fault."
|
|
138
123
|
|
|
124
|
+
|
|
125
|
+
## What closes the mechanism, for `security`
|
|
126
|
+
|
|
127
|
+
The `survey-pass` skill's evidence record is shared by every pass; `control_site` is the
|
|
128
|
+
only field whose meaning is yours to fix. For this family the control is a **sanitiser, escape or authorisation check between the source and the sink** — the line that makes the tainted value safe, at a point the attacker does not control.
|
|
129
|
+
|
|
130
|
+
**Every row carries an `evidence` object**, in the shape the `survey-pass` skill defines. It is
|
|
131
|
+
how the verdict is computed, and a row without one cannot be ranked by anything — it falls back
|
|
132
|
+
to a guess. Add it to every row you write.
|
|
133
|
+
|
|
134
|
+
**You do not write `severity` or `needsProbe`.** If the attached block's example row shows them,
|
|
135
|
+
ignore those two fields: they are derived from your evidence, not chosen by you. Everything else
|
|
136
|
+
the attachment prescribes still applies.
|
|
137
|
+
|
|
138
|
+
Worked example — invented, for SHAPE only, showing the fields this family fills:
|
|
139
|
+
|
|
140
|
+
```json
|
|
141
|
+
{"id": "security-001", "obligation": "O-001", "family": "security", "evidence": {"subject": "req.query.next", "control_site": "src/routes/login.ts:88", "control_text": "const next = String(req.query.next ?? \"/\");", "authority": "advisory", "order_ok": true, "cannot_distinguish": "a relative path and an absolute URL to another origin", "bypass": "none found", "in_changed_hunk": true, "consequence": "a caller supplies an absolute URL and the redirect leaves the origin, carrying the session referer", "trigger": "input", "crosses_boundary": true, "capability_gained": "redirecting an authenticated user to an origin the attacker controls"}, "claim": "the redirect target is coerced to a string but never constrained to this origin, so an absolute URL passes through"}
|
|
142
|
+
```
|
|
143
|
+
|
|
139
144
|
## State the residual risk, not the reassurance
|
|
140
145
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
graded against: who or what can reach this code WITHOUT the check, and what
|
|
145
|
-
happens then. Two invariants can both be true of the same quoted line — "the
|
|
146
|
-
check runs before the handler" and "the check runs before any request-derived
|
|
147
|
-
value is read" are different bars — and this family's question is always the
|
|
148
|
-
strongest bar it cares about, never the weakest true statement. If you cannot
|
|
149
|
-
name the bar, record the mechanism with `needsProbe: true` and no verdict: the
|
|
150
|
-
probe and the adjudicator can remove a risk you wrote down, but they will never
|
|
151
|
-
see the one you graded away as fine.
|
|
146
|
+
The `survey-pass` skill carries this rule and its examples. The family-specific half: your bar is the **trust boundary crossed**, not that a check exists somewhere.
|
|
147
|
+
|
|
148
|
+
Name that bar before you write "correct". In a changed hunk, the falsifiable risk goes in `claim` with `needsProbe: true`.
|
|
152
149
|
|
|
153
150
|
## Output
|
|
154
151
|
|
|
@@ -10,41 +10,29 @@ Reviewing **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{bas
|
|
|
10
10
|
Your job is to DISCHARGE obligations — questions that each name BOTH ENDS of a
|
|
11
11
|
possible defect mechanism — and to record what you found as hypotheses.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
and a stronger model adjudicates. Both of them can only REMOVE. Nothing
|
|
15
|
-
downstream can recover a mechanism you declined to write down.
|
|
13
|
+
> **Nothing downstream can recover a mechanism you declined to write down.**
|
|
16
14
|
|
|
17
|
-
So the
|
|
18
|
-
plausible mechanism you cannot yet refute is a hypothesis, not noise. Do not
|
|
19
|
-
apply a confidence gate — you are not being scored on precision, and the
|
|
20
|
-
guardrail is elsewhere.
|
|
15
|
+
So: **over-produce** — see the `survey-pass` skill for why the precision gate does not fire on you.
|
|
21
16
|
|
|
22
17
|
## Hard limits on this pass
|
|
23
18
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
working directory — open them exactly as written and never join them onto an
|
|
36
|
-
absolute path. Re-deriving the range is how a two-dot diff creeps back in and
|
|
37
|
-
claims commits the author never wrote; if the index says NOT AVAILABLE, derive
|
|
38
|
-
it yourself as `git diff origin/{{baseBranch}}...HEAD`, three dots.
|
|
19
|
+
| do NOT | why |
|
|
20
|
+
|---|---|
|
|
21
|
+
| **Do NOT read or write any other family's file** | another pass owns each; appending to disjoint files makes a consensus collapse impossible **by construction**, not by instruction |
|
|
22
|
+
| **Do NOT re-derive this PR's range with `git diff` or `git show`.** | it is already staged — see below |
|
|
23
|
+
|
|
24
|
+
**The range is already resolved.** `.lastlight/pr-review/diff/index.md` lists every changed file with its status, its changed line ranges, and the per-file patch under `.lastlight/pr-review/diff/`. Read those. Paths are relative to your working directory — open them exactly as written, never joined onto an absolute path.
|
|
25
|
+
|
|
26
|
+
If the index says NOT AVAILABLE, derive it yourself as `git diff origin/{{baseBranch}}...HEAD` — **three dots**.
|
|
27
|
+
|
|
28
|
+
<!-- Re-deriving is how a two-dot diff creeps back in and claims commits the
|
|
29
|
+
author never wrote. -->
|
|
39
30
|
|
|
40
31
|
## What you have: the whole checkout
|
|
41
32
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
references the patch never shows you, follow a changed symbol out into the files
|
|
46
|
-
this PR did not touch. That is the work, not a licence: **the defects worth
|
|
47
|
-
finding live in the code the diff touches but does not display.**
|
|
33
|
+
The staged diff is your STARTING POINT, not your scope: open the changed files whole, grep for the callers the patch never shows you, and follow a changed symbol out into files this PR did not touch.
|
|
34
|
+
|
|
35
|
+
**The defects worth finding live in the code the diff touches but does not display.**
|
|
48
36
|
|
|
49
37
|
## Your family: `spec`
|
|
50
38
|
|
|
@@ -59,6 +47,39 @@ sentence the code can falsify is a finding.
|
|
|
59
47
|
Every other "what to check" item in the review rubric is a STANDARDS check; this
|
|
60
48
|
is the other axis, and it is the one a clean standards review cannot answer.
|
|
61
49
|
|
|
50
|
+
## What closes the mechanism, for `spec`
|
|
51
|
+
|
|
52
|
+
The `survey-pass` skill's evidence record is shared by every pass; `control_site` is the
|
|
53
|
+
only field whose meaning is yours to fix. For this family the control is a **line in a
|
|
54
|
+
changed file that implements the criterion** — not one that mentions it, and not a promise
|
|
55
|
+
in the description.
|
|
56
|
+
|
|
57
|
+
<!-- This family's brief is restatement-adjacent: its job is checking the PR's own claims,
|
|
58
|
+
so the sentence it reaches for first describes the intended change. A criterion the PR
|
|
59
|
+
MEETS is a clean control with `consequence: null`, which the table grades Minor. The
|
|
60
|
+
scale of a change is not a severity. -->
|
|
61
|
+
|
|
62
|
+
**Every row carries an `evidence` object**, in the shape the `survey-pass` skill defines. It is
|
|
63
|
+
how the verdict is computed, and a row without one cannot be ranked by anything — it falls back
|
|
64
|
+
to a guess. Add it to every row you write.
|
|
65
|
+
|
|
66
|
+
**You do not write `severity` or `needsProbe`.** If the attached block's example row shows them,
|
|
67
|
+
ignore those two fields: they are derived from your evidence, not chosen by you. Everything else
|
|
68
|
+
the attachment prescribes still applies.
|
|
69
|
+
|
|
70
|
+
Worked example — invented, for SHAPE only, showing the fields this family fills:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{"id": "spec-001", "obligation": "O-001", "family": "spec", "evidence": {"subject": "acceptance criterion: expired sessions are rejected", "control_site": "src/auth/session.ts:120", "control_text": "if (session.expiresAt < now) return null;", "authority": "binding", "order_ok": true, "cannot_distinguish": "a session expiring during the request and one already expired", "bypass": "the refresh endpoint reads the session before this check runs", "in_changed_hunk": true, "consequence": "a session that expired mid-request is refreshed rather than rejected, extending it indefinitely", "trigger": "input", "crosses_boundary": true, "capability_gained": "holding a session past its stated lifetime"}, "claim": "the criterion is implemented on the read path but the refresh endpoint reaches the session before the check"}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
<!-- KEEP EVERYTHING BELOW `{{specObligations}}` BYTE-STABLE. The eval
|
|
77
|
+
replay (`apps/evals/scripts/micro-survey.ts`) recovers this family's
|
|
78
|
+
obligations out of a preserved transcript by anchoring on ~160
|
|
79
|
+
characters either side of the placeholder, so an edit below it makes
|
|
80
|
+
the splice refuse and `spec` becomes unmeasurable against every
|
|
81
|
+
archived arm. New prose goes ABOVE this line. -->
|
|
82
|
+
|
|
62
83
|
Your obligations are **inline below**. This is the only family whose obligations
|
|
63
84
|
do not come from the deterministic code analysis — they are built by the harness
|
|
64
85
|
from the PR body and the issues this PR closes — so unlike the other five there
|
|
@@ -94,15 +115,9 @@ change's intent is unstated.
|
|
|
94
115
|
|
|
95
116
|
## State the residual risk, not the reassurance
|
|
96
117
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
caller or state would make the claim false, and where you looked for it. Two
|
|
101
|
-
readings can both be true of one quoted line — "the gate exists" and "the gate
|
|
102
|
-
holds for every caller the ask cares about" are different bars — and the ask's
|
|
103
|
-
bar is always the stronger one. If you cannot name the bar, record the
|
|
104
|
-
mechanism with no verdict: the probe and the adjudicator can remove a risk you
|
|
105
|
-
wrote down, but they will never see the one you graded away as fine.
|
|
118
|
+
The `survey-pass` skill carries this rule and its examples. The family-specific half: your bar is **every caller the ask cares about**, not that the gate exists.
|
|
119
|
+
|
|
120
|
+
Name that bar before you write "correct". In a changed hunk, the falsifiable risk goes in `claim` with `needsProbe: true`.
|
|
106
121
|
|
|
107
122
|
## Output
|
|
108
123
|
|