Skip to content

Commit 68fe316

Browse files
committed
Harden scan security probes and workspace writes
1 parent 4973ded commit 68fe316

9 files changed

Lines changed: 692 additions & 26 deletions

File tree

docs/guides/auto.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ For security-oriented triage, keep the same API and opt into trust-boundary bias
5050
result = scan_module("myapp.scoring", mode="candidate", security_focus=True)
5151
```
5252

53+
With `security_focus=True`, scan also synthesizes small artifact/config mutations for deserialization- and IPC-shaped parameters, so the same call can surface trust-boundary bugs beyond path-only shapers.
54+
5355
## fuzz
5456

5557
!!! quote "What this unlocks"

docs/guides/cli.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Use `--save-artifacts` when you want the full handoff package. In addition to th
8181

8282
`scan` is evidence-first. In `--mode evidence`, it surfaces replayable crashes, weaker exploratory properties, and expected precondition failures without flattening them into one verdict. `--mode candidate` keeps the same search but ranks only the strongest contract-valid issue candidates at the top. If `[[scan]]` or `[[objects]]` leave fixture completeness too low for the module, `scan` will report that as a block instead of pretending it has real leverage. In that case, add a factory, `state_factory`, or `harness = "stateful"` before expecting useful output. If you need stronger validation for a mature codebase, prefer `ordeal audit` for coverage and mutation comparison, and `ordeal mutate` for direct mutation scoring.
8383

84-
`--security-focus` is the opt-in trust-boundary bias for scan. It expands sink inference beyond shell/path/env to import loading, deserialization, filesystem writes, symlink handling, and checkpoint/IPC paths, then adds deterministic low-side-effect probes for pure path/symlink shapers. Saved proof bundles keep that context under `impact.critical_sinks`, `impact.trust_boundary_signal`, and `contract_basis.security_focus`.
84+
`--security-focus` is the opt-in trust-boundary bias for scan. It expands sink inference beyond shell/path/env to import loading, deserialization, filesystem writes, symlink handling, and checkpoint/IPC paths, then adds deterministic low-side-effect probes for pure path/symlink shapers plus small artifact/config mutations for deserialization- and IPC-shaped inputs. Saved proof bundles keep that context under `impact.critical_sinks`, `impact.trust_boundary_signal`, and `contract_basis.security_focus`.
8585

8686
Promoted crash findings now carry a proof bundle in Markdown, JSON, and agent output: witness input, contract basis, confidence breakdown, minimal reproduction, failure path, and likely impact. Demoted crashes keep the same structure plus an explicit demotion reason.
8787

@@ -126,6 +126,8 @@ By default, `init` does not install the bundled skill and does not write draft a
126126

127127
`init` now also reads `[init]` from `ordeal.toml` when present. That lets you keep bootstrap defaults like `target`, `output_dir`, `close_gaps`, and CI generation in versioned config instead of repeating flags in scripts.
128128

129+
For safety, `audit.save_generated`, `audit.write_gaps_dir`, `init.output_dir`, and `init.gap_output_dir` must stay inside the current workspace root.
130+
129131
| Flag | Default | Description |
130132
|---|---|---|
131133
| `target` | auto-detect | Package path such as `myapp`; omit to detect from the current directory |

docs/guides/configuration.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ relation_overrides = { normalize = ["equivalent"] }
129129

130130
When you run `pytest --chaos`, ordeal auto-discovers these entries and smoke-tests every public function in each module. Functions without type hints are skipped unless fixtures are provided or a registry supplies them. Known preconditions stay separate from candidate issue ranking so the output stays epistemic.
131131

132-
`security_focus = true` is the opt-in trust-boundary review setting. It widens the sink taxonomy to include import/deserialization/filesystem-write/IPC paths and adds deterministic probes for pure path/symlink shapers without creating a second scan command.
132+
`security_focus = true` is the opt-in trust-boundary review setting. It widens the sink taxonomy to include import/deserialization/filesystem-write/IPC paths, adds deterministic probes for pure path/symlink shapers, and synthesizes small artifact/config mutations for deserialization- and IPC-shaped parameters without creating a second scan command.
133133

134134
`targets` now acts as a first-class selector list, not just an exact-callable allowlist. Exact names still work, and glob patterns let package-root scans focus on a subset of exported callables without rewriting the module target.
135135

@@ -250,6 +250,8 @@ min_fixture_completeness = 0.5
250250

251251
Use `[[audit.targets]]` when one class needs an audit-specific factory or a narrower method subset:
252252

253+
`save_generated` and `write_gaps_dir` are workspace-local output paths. Ordeal rejects values that escape the current repo root.
254+
253255
```toml
254256
[[audit.targets]]
255257
target = "myapp.envs:ComposableEnv"
@@ -286,6 +288,8 @@ gap_output_dir = "tests/gaps"
286288
scan_max_examples = 12
287289
```
288290

291+
`output_dir` and `gap_output_dir` are also workspace-local output paths; values outside the current repo root are rejected.
292+
289293
## Tuning guide
290294

291295
!!! quote "Why this matters"

ordeal.toml.example

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ verbose = true
122122
# module = "myapp.scoring"
123123
# max_examples = 50
124124
# mode = "evidence" # or "candidate" for stricter ranking
125-
# security_focus = true # opt in to trust-boundary-biased sink detection/probes
125+
# security_focus = true # opt in to trust-boundary-biased sink detection, path probes,
126+
# # and small artifact/config mutations for deserialize/IPC inputs
126127
# include_private = false
127128
#
128129
# # Optional: focus scan on a subset of callables instead of the whole module
@@ -244,8 +245,8 @@ verbose = true
244245
#
245246
# # Optional outputs / gates.
246247
# show_generated = false
247-
# # save_generated = "tests/test_migrated.py"
248-
# # write_gaps_dir = "tests/gaps"
248+
# # save_generated = "tests/test_migrated.py" # must stay under the current workspace root
249+
# # write_gaps_dir = "tests/gaps" # must stay under the current workspace root
249250
# # min_fixture_completeness = 0.5
250251
# include_exploratory_function_gaps = false
251252
# require_direct_tests = false
@@ -255,14 +256,14 @@ verbose = true
255256
#
256257
# [init]
257258
# target = "myapp"
258-
# output_dir = "tests"
259+
# output_dir = "tests" # must stay under the current workspace root
259260
# ci = false
260261
# ci_name = "ordeal"
261262
# install_skill = false
262263
# close_gaps = false
263264
#
264265
# # Optional deeper defaults for the bootstrap loop.
265-
# # gap_output_dir = "tests/gaps"
266+
# # gap_output_dir = "tests/gaps" # must stay under the current workspace root
266267
# mutation_preset = "essential"
267268
# scan_max_examples = 10
268269

0 commit comments

Comments
 (0)