mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-12-04 18:58:18 +00:00
The design is approved. The example book takes AI-written cases where a sound one exists and advisory-backed web applications otherwise (the maintainer's answer). No repository is cloned on this machine, which has 2.1 GB free: the work moves to a new machine, so the first task is a fetch command that needs nothing outside this tree. Tasks generated, not approved. Co-Authored-By: Claude Fable 5.2 <[email protected]>
241 lines
16 KiB
Markdown
241 lines
16 KiB
Markdown
# Requirements Document
|
|
|
|
## Introduction
|
|
|
|
The driver is the model-driven hunter, a DSPy program. It should read a pushed change together with what
|
|
abstract interpretation establishes about it (the access-control prover's ordered trace, Joern's taint and
|
|
dominance results) and name the locations where the change introduces a bug. Today neither result reaches
|
|
the driver, and no choice in its strategy has been settled by measurement.
|
|
|
|
The maintainer's condition for this spec, 2026-11-30: "i need this design to be empircally measureable and
|
|
not theoretic. with that I want to avoid another endless circle of specs, that essentially cement things we
|
|
have to undo".
|
|
|
|
So this document is staged. It specifies in full only the first stage: the example book, the wiring, the
|
|
delivery check (E0) and the baseline (E1). Each requirement ends in something that is run and read. The
|
|
later strategy questions (E2 to E6 of `brief.md`) are named in Requirement 7 and get their own criteria only
|
|
after the result before them has been read. Nothing is designed or built for a stage whose predecessor has
|
|
no result.
|
|
|
|
The thresholds in Requirements 5 and 6 are proposals. The maintainer confirms or changes them when
|
|
approving this document; after that they are fixed before the runs.
|
|
|
|
## Boundary Context
|
|
|
|
- **In scope**: the example book; the two producers that hand abstract interpretation to the driver; the
|
|
record of one example; the rules of an experiment; the delivery check E0; the baseline E1; the rule by
|
|
which later stages enter this spec.
|
|
- **Out of scope**: new engine queries or facts; the proof arm; the hook's output and its deadline;
|
|
benchmark machinery; any admission run; families other than access control and path traversal;
|
|
repositories other than AI-written web applications in TypeScript and Python.
|
|
- **Adjacent expectations**: `access-control-prover` supplies the trace as it is today. The engine supplies
|
|
its existing taint and dominance queries as they are today. `hunter-learning-loop` supplies the runner,
|
|
the paired ablation, the proposer and the acceptance rule as built. Where an experiment shows a fact is
|
|
missing, the finding goes to `engine-change-scoped-analysis` with the examples that show it; this spec
|
|
does not add the fact. `search-with-proof` and `pre-push-safety-net` consume the driver's ordered
|
|
suspects later and are not changed here.
|
|
|
|
## Requirements
|
|
|
|
### Requirement 1: The example book
|
|
|
|
**Objective:** As the maintainer, I want a small set of real changes I can read end to end, so that every
|
|
claim about the driver points at examples I can open.
|
|
|
|
#### Acceptance Criteria
|
|
|
|
1. The example book shall hold ten vulnerable changes, five of access control and five of path traversal,
|
|
each with its fixing change, and twenty ordinary changes from the same repositories.
|
|
2. The example book shall draw every change from AI-written web application repositories in TypeScript or
|
|
Python, with at least three vulnerable changes in each language.
|
|
3. The example book shall record for each vulnerable change the repository, the two revisions, the family,
|
|
the labelled file and line range, and the source that establishes the vulnerability.
|
|
4. When the maintainer names a change as one to include, the example book shall include it or record why it
|
|
cannot be used.
|
|
5. If a candidate change belongs to a repository of any admission or evaluation population, then the
|
|
example book shall refuse it and name the population.
|
|
6. When the example book is frozen, the driver work shall record its digest, and every later record shall
|
|
carry that digest.
|
|
7. If an example is added, removed or relabelled after the freeze, then the driver work shall record a new
|
|
digest and shall not compare results across the two digests as one series.
|
|
|
|
### Requirement 2: Abstract interpretation reaches the driver
|
|
|
|
**Objective:** As the maintainer, I want the driver to receive what the prover and Joern establish about a
|
|
change, so that a driver run measures the engine and not the hunter of October.
|
|
|
|
#### Acceptance Criteria
|
|
|
|
1. When the driver is asked about an access-control example, the driver work shall give it the prover's
|
|
ordered trace for the changed location: the entry, the request-derived arguments with their origin, the
|
|
protected operation, the guards, and whether a guard dominates the operation.
|
|
2. When the driver is asked about a path-traversal example, the driver work shall give it Joern's results
|
|
for the changed functions: the path from a request source to a file operation with its steps, the
|
|
sanitizers on that path, and the dominance answer.
|
|
3. If a producer has no result for a location, then the driver work shall record one cause from a closed
|
|
list (no entry recognised; operation not recognised; call unresolved; no source-to-sink path; language
|
|
not supported; engine did not start; engine timed out) and shall hand the driver that statement in
|
|
place of a result.
|
|
4. The driver work shall record, for every producer run, the number of source bytes read, the engine's
|
|
exit status and its run time.
|
|
5. If a producer read zero source bytes or the engine exited with an error, then the driver work shall mark
|
|
the annotation failed, and shall not record it as empty.
|
|
6. The driver work shall run Joern in the shipped image for every recorded result.
|
|
7. While an experiment is running, the driver work shall give every arm that includes an annotation the
|
|
same annotation bytes for the same example.
|
|
|
|
### Requirement 3: One page per example
|
|
|
|
**Objective:** As the maintainer, I want to see for any example what the driver was given, what it answered
|
|
and why it missed, so that a number never stands without its cases.
|
|
|
|
#### Acceptance Criteria
|
|
|
|
1. When a run finishes an example, the driver work shall write one page for it holding the annotation the
|
|
driver received with its byte count, every answer the driver gave, the labelled location, and hit or
|
|
miss.
|
|
2. When a vulnerable example is missed, the driver work shall record one cause from a closed list: no
|
|
annotation; annotation wrong; annotation right and not used; wrong family; wrong location.
|
|
3. When an ordinary example draws a suspicion, the driver work shall record the suspicion and what the
|
|
annotation said at that location.
|
|
4. If a miss cause cannot be set from the records alone, then the driver work shall mark it "to be read"
|
|
and the experiment's result shall count it separately until a person has set it.
|
|
5. When the maintainer names an example and a run, the driver work shall show that page with one command.
|
|
6. When the maintainer names an example and an arm, the driver work shall run that one example again with
|
|
one command and state what the run costs before it starts.
|
|
|
|
### Requirement 4: The rules of an experiment
|
|
|
|
**Objective:** As the maintainer, I want every change to the driver to be one measured comparison, so that
|
|
no strategy choice enters the engine on argument alone.
|
|
|
|
#### Acceptance Criteria
|
|
|
|
1. When an experiment is opened, the driver work shall record before any run: its question, the one thing
|
|
that differs between its arms, the examples, the model and its version, the number of samples per
|
|
question, the spend ceiling, and the rule that will read its result.
|
|
2. The driver work shall run every arm of an experiment over the same examples.
|
|
3. If two arms differ in more than the one recorded thing, then the driver work shall refuse the run.
|
|
4. When an experiment ends, the driver work shall report per arm the vulnerable examples found out of the
|
|
total, the suspicions per ordinary change, and the top-1, top-3 and top-5 hit counts, with the
|
|
per-example table beside them.
|
|
5. When an experiment runs on the example book alone, the driver work shall report counts and paired
|
|
differences, and shall not report a recall rate without its interval.
|
|
6. If the spend of an experiment reaches its ceiling, then the driver work shall stop, keep the finished
|
|
records, and report what remains undone.
|
|
7. If more than one example in ten of an arm ends in an instrument failure, then the driver work shall
|
|
report the experiment as not read and shall give no comparison.
|
|
8. When an experiment has been read, the driver work shall record its decision in one dated line: what was
|
|
chosen, on which examples, and what would reverse it.
|
|
|
|
### Requirement 5: The delivery check (E0)
|
|
|
|
**Objective:** As the maintainer, I want to know that the producers deliver before any model is called, so
|
|
that the first paid run does not measure an empty input.
|
|
|
|
#### Acceptance Criteria
|
|
|
|
1. When E0 runs, the driver work shall run both producers over every example of the book and shall make no
|
|
model call.
|
|
2. When E0 ends, the driver work shall report per family and per language the number of vulnerable examples
|
|
whose annotation is nonempty and covers the labelled function, and the causes for the rest.
|
|
3. When E0 ends, the driver work shall report the number of ordinary examples with a nonempty annotation.
|
|
4. If fewer than four of the five vulnerable examples of a family carry an annotation that covers the
|
|
labelled function, then the driver work shall report that family as not ready, and E1 shall not run for
|
|
it.
|
|
5. When a family is not ready, the driver work shall list the examples and causes that keep it so, as the
|
|
input for the engine work.
|
|
6. The driver work shall record the run time of each producer per example, with the engine's start-up time
|
|
apart from the query time.
|
|
|
|
### Requirement 6: The baseline (E1)
|
|
|
|
**Objective:** As the maintainer, I want to know whether abstract interpretation helps the driver find the
|
|
bugs of the book, so that the central bet of the engine has a result.
|
|
|
|
#### Acceptance Criteria
|
|
|
|
1. When E1 runs, the driver work shall run three arms over the example book with the driver as it is built
|
|
today: no annotation; the prover's trace; Joern's results.
|
|
2. The driver work shall report a family only under the arms whose annotation covers it, and under the
|
|
arm without annotation.
|
|
3. The driver work shall ask each question three times in every arm and shall count an example as found
|
|
when at least two of the three answers name the labelled location within ten lines.
|
|
4. When E1 ends, the driver work shall state for each family whether the annotated arm found at least two
|
|
more of the five vulnerable examples than the arm without annotation, with no more suspicions per
|
|
ordinary change.
|
|
5. If no family meets that mark, then the driver work shall stop the strategy experiments and report the
|
|
miss causes of Requirement 3 as the result, and the next step shall be the maintainer's decision.
|
|
6. When a family meets the mark, the driver work shall name the annotated arm as the starting point of the
|
|
next experiment for that family.
|
|
7. The driver work shall keep the spend of E1 within the maintainer's ceiling of 10 USD.
|
|
8. When E1 ends, the driver work shall publish its record under `benchmarks/measurements/` with the example
|
|
book's digest, the counts, the per-example pages and the proof that every input was read.
|
|
|
|
### Requirement 7: Later stages enter one at a time
|
|
|
|
**Objective:** As the maintainer, I want the spec to grow only from results, so that it cements nothing that
|
|
a later measurement would have to undo.
|
|
|
|
#### Acceptance Criteria
|
|
|
|
1. The driver work shall hold these questions as later stages, each without criteria until it is opened:
|
|
whether the tool loop earns its cost (E2); whether agreement across samples separates true suspects from
|
|
false ones (E3); how the question is cut (E4); whether compilation on training repositories carries to
|
|
held-out repositories (E5); whether the annotation is given up front or on demand (E6).
|
|
2. When a stage is opened, the driver work shall add its criteria to this document as a dated amendment
|
|
that cites the result it rests on.
|
|
3. If the experiment before a stage has no read result, then the driver work shall not open the stage and
|
|
shall not build for it.
|
|
4. The design of this spec shall cover the open stage and the stages already read, and nothing beyond.
|
|
5. When a later result contradicts a recorded decision, the driver work shall reverse the decision in a
|
|
dated line and shall keep the earlier line as history.
|
|
6. The driver work shall reuse the runner, the paired comparison, the proposer and the acceptance rule that
|
|
exist, and shall add a new shared contract or abstraction only when two read experiments have needed it.
|
|
7. Where a stage compiles the driver, the driver work shall compile on training repositories only, shall
|
|
accept a program only when it passes the reversed-surface probe, and shall tune nothing on an admission
|
|
label.
|
|
|
|
### Requirement 8: Populations and honesty
|
|
|
|
**Objective:** As the maintainer, I want the driver work unable to touch what later qualifies a release, so
|
|
that a good result here can still be tested fairly.
|
|
|
|
#### Acceptance Criteria
|
|
|
|
1. The driver work shall read no case, label or result of an admission or evaluation population.
|
|
2. If a run names a repository of such a population, then the driver work shall refuse the run before any
|
|
model call.
|
|
3. The driver work shall treat the example book as development data and shall quote no figure from it as a
|
|
detection rate of the tool.
|
|
4. The driver work shall record every model call with its model, version, sampling settings and cost.
|
|
5. While no paid run is in progress, the driver work shall run with both API keys unset.
|
|
|
|
## Amendments
|
|
|
|
- **2026-11-30, at approval.** The maintainer approved this document ("approved.") and raised memory:
|
|
"memory is key to save cycles, and it can improve. but we need a memory pruning and memory agent approach
|
|
here". Two changes. (a) Requirement 2 gains criterion 8 and Requirement 5 criterion 7, below: the cache
|
|
that saves cycles belongs to stage one. (b) The later stages of Requirement 7.1 gain two: whether
|
|
retrieval of verified cases from memory improves the driver on repositories the memory holds no case from
|
|
(M2), and whether a curator that prunes keeps that gain (M3). Like E2 to E6 they have no criteria until
|
|
the result before them is read. The thresholds of Requirements 5 and 6 are approved as proposed.
|
|
- Requirement 2, criterion 8: When a producer is asked for a result it already holds for the same
|
|
repository, revision, function content, engine version and query version, the driver work shall return
|
|
the stored result and shall record that it did.
|
|
- Requirement 5, criterion 7: When E0 is run a second time on the unchanged example book, the driver work
|
|
shall start no engine and shall report the same annotations byte for byte.
|
|
- **2026-11-30, the example book.** The search of the development data (same day) found that the book
|
|
cannot be filled with AI-written applications only: no path-traversal case exists in an AI-written
|
|
TypeScript application, and most AI-written fixes carry a label taken from a commit title that nobody
|
|
reviewed. The maintainer chose "Mixed, as proposed". Requirement 1.2 now reads: the example book shall
|
|
draw every change from web application repositories in TypeScript or Python, AI-written where a sound
|
|
case exists and advisory-backed otherwise, with at least three vulnerable changes in each language; it
|
|
shall record for each repository whether it shows a sign of being AI-written. The ten proposed
|
|
repositories are in `tasks.md`, task 1.1.
|
|
- **2026-11-30, a new machine.** The maintainer: "once we have spec'ed this out, I plan to move this to a
|
|
new machine". This machine had 2.1 GB free on that day and one of the ten repositories is 1.8 GB. So no
|
|
repository is cloned here. Requirement 1 gains criterion 8: When the example book is set up on a machine,
|
|
the driver work shall fetch every repository of the book from its recorded address and revisions with one
|
|
command, and shall need no file that is not in the repository of this project.
|