@kirrosh/zond 0.23.0 → 0.26.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/CHANGELOG.md +164 -1
- package/README.md +8 -7
- package/package.json +2 -3
- package/src/CLAUDE.md +112 -0
- package/src/cli/commands/add-api.ts +19 -7
- package/src/cli/commands/api/annotate/index.ts +359 -4
- package/src/cli/commands/api/annotate/lifecycle.ts +1 -1
- package/src/cli/commands/api/annotate/overlay.ts +1 -1
- package/src/cli/commands/api/annotate/pagination.ts +10 -6
- package/src/cli/commands/api/annotate/prompts.ts +39 -2
- package/src/cli/commands/audit.ts +360 -54
- package/src/cli/commands/check.ts +15 -2
- package/src/cli/commands/checks.ts +352 -36
- package/src/cli/commands/cleanup.ts +4 -30
- package/src/cli/commands/coverage.ts +275 -57
- package/src/cli/commands/db.ts +311 -8
- package/src/cli/commands/discover.ts +281 -161
- package/src/cli/commands/doctor.ts +57 -3
- package/src/cli/commands/fixtures.ts +1 -1
- package/src/cli/commands/generate.ts +24 -7
- package/src/cli/commands/init/bootstrap.ts +4 -1
- package/src/cli/commands/init/index.ts +2 -2
- package/src/cli/commands/init/skills.ts +43 -0
- package/src/cli/commands/init/templates/agents.md +12 -3
- package/src/cli/commands/init/templates/skills/warm-up-target.md +122 -0
- package/src/cli/commands/init/templates/skills/zond-checks.md +268 -44
- package/src/cli/commands/init/templates/skills/zond-seed.md +114 -0
- package/src/cli/commands/init/templates/skills/zond-triage.md +88 -26
- package/src/cli/commands/init/templates/skills/zond.md +274 -64
- package/src/cli/commands/init/templates/zond-config.yml +1 -1
- package/src/cli/commands/prepare-fixtures.ts +14 -52
- package/src/cli/commands/probe/_seed-bodies.ts +52 -0
- package/src/cli/commands/probe/mass-assignment.ts +101 -10
- package/src/cli/commands/probe/security.ts +95 -12
- package/src/cli/commands/probe/webhooks.ts +2 -0
- package/src/cli/commands/probe.ts +87 -11
- package/src/cli/commands/refresh-api.ts +59 -1
- package/src/cli/commands/report-bundle.ts +3 -11
- package/src/cli/commands/request.ts +116 -0
- package/src/cli/commands/run.ts +33 -5
- package/src/cli/commands/schema-from-runs.ts +128 -0
- package/src/cli/commands/secrets.ts +133 -0
- package/src/cli/json-envelope.ts +0 -20
- package/src/cli/json-schemas.ts +51 -0
- package/src/cli/output.ts +17 -1
- package/src/cli/program.ts +5 -4
- package/src/cli/safe-live.ts +24 -0
- package/src/cli/status-filter.ts +0 -10
- package/src/core/audit/persist.ts +183 -0
- package/src/core/checks/budget.ts +59 -0
- package/src/core/checks/checks/cross_call_references.ts +17 -4
- package/src/core/checks/checks/cursor_boundary_fuzzing.ts +219 -0
- package/src/core/checks/checks/idempotency_replay.ts +1 -5
- package/src/core/checks/checks/ignored_auth.ts +44 -1
- package/src/core/checks/checks/index.ts +3 -0
- package/src/core/checks/checks/lifecycle_transitions.ts +169 -26
- package/src/core/checks/checks/negative_data_rejection.ts +119 -16
- package/src/core/checks/checks/not_a_server_error.ts +8 -0
- package/src/core/checks/checks/open_cors_on_sensitive.ts +47 -18
- package/src/core/checks/checks/pagination_invariants.ts +298 -117
- package/src/core/checks/checks/positive_data_acceptance.ts +1 -4
- package/src/core/checks/checks/status_code_conformance.ts +78 -7
- package/src/core/checks/mode.ts +3 -0
- package/src/core/checks/recommended-action.ts +5 -1
- package/src/core/checks/runner.ts +614 -27
- package/src/core/checks/spec-findings.ts +308 -0
- package/src/core/checks/types.ts +117 -1
- package/src/core/checks/zond-extensions.ts +73 -0
- package/src/core/classifier/recommended-action.ts +35 -6
- package/src/core/coverage/loader.ts +31 -0
- package/src/core/diagnostics/db-analysis.ts +200 -106
- package/src/core/diagnostics/failure-class.ts +21 -1
- package/src/core/diagnostics/failure-hints.ts +4 -208
- package/src/core/diagnostics/suggested-fixes.ts +2 -3
- package/src/core/generator/chunker.ts +1 -8
- package/src/core/generator/data-factory.ts +199 -61
- package/src/core/generator/fixtures-builder.ts +38 -31
- package/src/core/generator/index.ts +0 -2
- package/src/core/generator/openapi-reader.ts +98 -4
- package/src/core/generator/path-param-disambig.ts +30 -4
- package/src/core/generator/resources-builder.ts +276 -26
- package/src/core/generator/schema-utils.ts +22 -0
- package/src/core/generator/suite-generator.ts +168 -15
- package/src/core/generator/types.ts +6 -0
- package/src/core/identity/identity-file.ts +0 -0
- package/src/core/output/README.md +11 -29
- package/src/core/output/index.ts +1 -1
- package/src/core/output/run.ts +0 -35
- package/src/core/output/types.ts +0 -7
- package/src/core/parser/dynamic-values.ts +160 -0
- package/src/core/parser/variables.ts +0 -0
- package/src/core/probe/dry-run-envelope.ts +4 -0
- package/src/core/probe/mass-assignment/classify.ts +175 -0
- package/src/core/probe/mass-assignment/cleanup.ts +52 -0
- package/src/core/probe/mass-assignment/digest.ts +114 -0
- package/src/core/probe/mass-assignment/orchestrator.ts +459 -0
- package/src/core/probe/mass-assignment/regression.ts +141 -0
- package/src/core/probe/mass-assignment/suspects.ts +92 -0
- package/src/core/probe/mass-assignment/types.ts +135 -0
- package/src/core/probe/mass-assignment-probe.ts +23 -1118
- package/src/core/probe/mass-assignment-template.ts +32 -4
- package/src/core/probe/path-discovery.ts +3 -4
- package/src/core/probe/probe-harness.ts +21 -22
- package/src/core/probe/security/baseline.ts +174 -0
- package/src/core/probe/security/classify.ts +341 -0
- package/src/core/probe/security/cleanup.ts +125 -0
- package/src/core/probe/security/detectors.ts +71 -0
- package/src/core/probe/security/digest.ts +104 -0
- package/src/core/probe/security/orchestrator.ts +398 -0
- package/src/core/probe/security/regression.ts +103 -0
- package/src/core/probe/security/types.ts +151 -0
- package/src/core/probe/security-probe-class.ts +8 -2
- package/src/core/probe/security-probe.ts +28 -1449
- package/src/core/probe/shared.ts +26 -0
- package/src/core/probe/webhooks-probe.ts +5 -7
- package/src/core/runner/assertions.ts +1 -1
- package/src/core/runner/executor.ts +3 -18
- package/src/core/runner/form-encode.ts +8 -18
- package/src/core/runner/http-client.ts +38 -1
- package/src/core/runner/preflight-vars.ts +19 -15
- package/src/core/runner/rate-limiter.ts +11 -29
- package/src/core/runner/run-kind.ts +7 -1
- package/src/core/runner/schema-validator.ts +2 -6
- package/src/core/runner/send-request.ts +11 -6
- package/src/core/runner/types.ts +6 -0
- package/src/core/setup-api.ts +53 -15
- package/src/core/severity/index.ts +0 -63
- package/src/core/spec/infer-schema.ts +102 -0
- package/src/core/spec/merge-specs.ts +156 -0
- package/src/core/spec/schema-from-runs.ts +117 -0
- package/src/core/spec/schema-overlay.ts +130 -0
- package/src/core/util/ajv.ts +13 -0
- package/src/core/util/headers.ts +9 -0
- package/src/core/util/url.ts +24 -0
- package/src/core/workspace/fixture-gap-report.ts +84 -0
- package/src/core/workspace/fixture-gaps.ts +71 -0
- package/src/core/workspace/root.ts +13 -11
- package/src/db/migrate.ts +2 -0
- package/src/db/migrations/0002_run_kind_request.sql +59 -0
- package/src/db/queries/collections.ts +2 -2
- package/src/db/queries/results.ts +88 -0
- package/src/db/queries/runs.ts +56 -2
- package/src/db/queries.ts +3 -0
- package/src/db/schema.ts +7 -7
- package/src/cli/commands/bootstrap.ts +0 -710
- package/src/core/anti-fp/bootstrap.ts +0 -34
- package/src/core/anti-fp/index.ts +0 -33
- package/src/core/anti-fp/registry.ts +0 -44
- package/src/core/anti-fp/rules/baseline-echo.ts +0 -74
- package/src/core/anti-fp/rules/schemathesis/body_negation_becomes_valid.ts +0 -52
- package/src/core/anti-fp/rules/schemathesis/coverage_phase_boundary_positive.ts +0 -38
- package/src/core/anti-fp/rules/schemathesis/has_unverifiable_mutations.ts +0 -35
- package/src/core/anti-fp/rules/schemathesis/index.ts +0 -24
- package/src/core/anti-fp/rules/schemathesis/string_type_mutation_becomes_valid.ts +0 -53
- package/src/core/anti-fp/rules/subscription-gated/index.ts +0 -11
- package/src/core/anti-fp/rules/subscription-gated/paid-plan-403.ts +0 -75
- package/src/core/anti-fp/types.ts +0 -68
- package/src/core/generator/create-body.ts +0 -89
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { EndpointInfo, SecuritySchemeInfo } from "../../generator/types.ts";
|
|
2
|
+
import type { SeedBodyConfig } from "../../generator/resources-builder.ts";
|
|
3
|
+
import type { RecommendedAction } from "../../diagnostics/failure-hints.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Mass-assignment local severity. Includes the unified severity ladder
|
|
7
|
+
* (critical/high/medium/low/info — see core/severity) plus two
|
|
8
|
+
* outcome-style states specific to this probe (inconclusive-baseline,
|
|
9
|
+
* inconclusive-5xx) and probe-lifecycle markers (ok, skipped).
|
|
10
|
+
*
|
|
11
|
+
* 'medium' is retained in the type for backwards compat but ARV-250
|
|
12
|
+
* stopped emitting it — single-signal proof on absent-fields now caps
|
|
13
|
+
* to 'low' per the m-21 severity matrix.
|
|
14
|
+
*/
|
|
15
|
+
export type Severity =
|
|
16
|
+
| "high"
|
|
17
|
+
| "medium"
|
|
18
|
+
/** Baseline POST itself failed — we never reached extras-validation, so the
|
|
19
|
+
* 4xx-with-extras was a false signal. User must fix fixture / FK / scope
|
|
20
|
+
* before this endpoint can be probed (TASK-91). */
|
|
21
|
+
| "inconclusive-baseline"
|
|
22
|
+
/** Baseline POST returned ≥500 — the endpoint just crashes, mass-assignment
|
|
23
|
+
* semantics aren't observable here. Likely a duplicate of validation-probe's
|
|
24
|
+
* finding for the same endpoint (TASK-276). */
|
|
25
|
+
| "inconclusive-5xx"
|
|
26
|
+
| "low"
|
|
27
|
+
| "info"
|
|
28
|
+
| "ok"
|
|
29
|
+
| "skipped";
|
|
30
|
+
|
|
31
|
+
export interface FieldVerdict {
|
|
32
|
+
field: string;
|
|
33
|
+
injected: unknown;
|
|
34
|
+
/** "applied" | "ignored" | "echoed-but-overwritten" | "absent" | "unknown" */
|
|
35
|
+
outcome: "applied" | "ignored" | "echoed-overwritten" | "absent" | "unknown";
|
|
36
|
+
/** Value as seen in the response body (or follow-up GET if applicable). */
|
|
37
|
+
observed?: unknown;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface EndpointVerdict {
|
|
41
|
+
method: string;
|
|
42
|
+
path: string;
|
|
43
|
+
severity: Severity;
|
|
44
|
+
/** Canonical short reason (used in markdown header). */
|
|
45
|
+
summary: string;
|
|
46
|
+
request: {
|
|
47
|
+
url: string;
|
|
48
|
+
body: unknown;
|
|
49
|
+
injectedFields: string[];
|
|
50
|
+
};
|
|
51
|
+
response?: {
|
|
52
|
+
status: number;
|
|
53
|
+
body?: unknown;
|
|
54
|
+
};
|
|
55
|
+
followUpGet?: {
|
|
56
|
+
url: string;
|
|
57
|
+
status: number;
|
|
58
|
+
body?: unknown;
|
|
59
|
+
};
|
|
60
|
+
/** Result of the baseline (no-extras) probe — present whenever we sent it
|
|
61
|
+
* (always, except for skipped endpoints). Used to disambiguate
|
|
62
|
+
* «extras refused» from «baseline body invalid» (TASK-91). */
|
|
63
|
+
baseline?: {
|
|
64
|
+
status: number;
|
|
65
|
+
body?: unknown;
|
|
66
|
+
};
|
|
67
|
+
fields: FieldVerdict[];
|
|
68
|
+
/** True when request schema has additionalProperties:false (strict). */
|
|
69
|
+
strictContract: boolean;
|
|
70
|
+
cleanup?: {
|
|
71
|
+
attempted: boolean;
|
|
72
|
+
status?: number;
|
|
73
|
+
error?: string;
|
|
74
|
+
};
|
|
75
|
+
/** Reason this endpoint was skipped (only set when severity === "skipped"). */
|
|
76
|
+
skipReason?: string;
|
|
77
|
+
notes?: string[];
|
|
78
|
+
/** TASK-294: agent-routable action.
|
|
79
|
+
* high/medium → `report_backend_bug` (privilege escalation).
|
|
80
|
+
* inconclusive-baseline → `fix_fixture` (broken request body, retry).
|
|
81
|
+
* inconclusive-5xx → `report_backend_bug` (server crashed).
|
|
82
|
+
* low/ok/skipped → undefined. */
|
|
83
|
+
recommended_action?: RecommendedAction;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface MassAssignmentOptions {
|
|
87
|
+
endpoints: EndpointInfo[];
|
|
88
|
+
securitySchemes: SecuritySchemeInfo[];
|
|
89
|
+
/** Substituted variables (base_url, auth_token, api_key, path params). */
|
|
90
|
+
vars: Record<string, string>;
|
|
91
|
+
/** When true, do not issue cleanup-DELETE after 2xx responses. */
|
|
92
|
+
noCleanup?: boolean;
|
|
93
|
+
/** Per-request fetch timeout (ms). */
|
|
94
|
+
timeoutMs?: number;
|
|
95
|
+
/** When false, skip auto-discovery of path-param fixtures via GET-on-list (TASK-92).
|
|
96
|
+
* TASK-137: this flag now also controls body-FK discovery (required body
|
|
97
|
+
* fields named `*_id` / `*_slug` / `*_uuid` get filled from the matching
|
|
98
|
+
* collection list endpoint, eliminating most INCONCLUSIVE-baseline noise). */
|
|
99
|
+
discover?: boolean;
|
|
100
|
+
/** ARV-252: per-run extension to SUSPECTED_FIELDS (curated list of
|
|
101
|
+
* classic mass-assignment vectors). CLI surfaces this as repeatable
|
|
102
|
+
* `--suspect-field name=value`. Full per-api spec-extension support
|
|
103
|
+
* (x-zond-suspect-fields) is tracked in ARV-189. */
|
|
104
|
+
extraSuspectFields?: Record<string, unknown>;
|
|
105
|
+
/** ARV-269: agent-authored `seed_body` overlays from `.api-resources.local.yaml`,
|
|
106
|
+
* keyed by `"METHOD /path"` of the endpoint they apply to (typically the
|
|
107
|
+
* resource's create endpoint). When present for a probed endpoint, it
|
|
108
|
+
* replaces `generateFromSchema` as the baseline body source — same
|
|
109
|
+
* promotion stateful checks took via `resolveCreateBody`. Mass-assignment
|
|
110
|
+
* before ARV-269 ignored this overlay; on strict-validating APIs (Stripe)
|
|
111
|
+
* every baseline 400'd and the verdict collapsed to INCONCLUSIVE. */
|
|
112
|
+
seedBodies?: Map<string, SeedBodyConfig>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface MassAssignmentResult {
|
|
116
|
+
specProbed: number;
|
|
117
|
+
totalEndpoints: number;
|
|
118
|
+
verdicts: EndpointVerdict[];
|
|
119
|
+
warnings: string[];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** Internal: per-step options for probeEndpoint. */
|
|
123
|
+
export interface ProbeEndpointOpts {
|
|
124
|
+
noCleanup: boolean;
|
|
125
|
+
timeoutMs?: number;
|
|
126
|
+
bodyFkMisses?: Array<{ field: string; reason: string }>;
|
|
127
|
+
/** TASK-137: field→value pairs from body-FK discovery. Overlaid on baseline
|
|
128
|
+
* after generation so a real id/slug replaces the random sentinel. */
|
|
129
|
+
bodyFkOverlay?: Record<string, string>;
|
|
130
|
+
/** ARV-252: per-run extras for the suspect-fields list. */
|
|
131
|
+
extraSuspectFields?: Record<string, unknown>;
|
|
132
|
+
/** ARV-269: optional agent-authored body overlay for this endpoint
|
|
133
|
+
* (usually the resource's create endpoint). Wins over generator. */
|
|
134
|
+
seedBody?: SeedBodyConfig;
|
|
135
|
+
}
|