Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
193 lines (159 loc) · 5.44 KB
/
Copy pathjustfile
File metadata and controls
193 lines (159 loc) · 5.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
alias b := build
alias d := dev
alias ds := docs-serve
alias f := fix
alias t := test
alias vc := version-check
alias vu := version-update
alias xs := xssmaze-score
# List available tasks.
default:
@just --list
# Build release binary.
[group('build')]
build:
cargo build --release
# Build debug binary.
[group('build')]
dev:
cargo build
# Never committed — packaging generates it from the freshly built binary at
# release time. (`just --list` shows only the last comment line, so the
# one-line summary goes last.)
# Render the roff man page into target/ for local preview.
[group('build')]
man:
mkdir -p target/man
cargo run --quiet -- man > target/man/dalfox.1
@echo "wrote target/man/dalfox.1 — preview with: man target/man/dalfox.1"
# The flake pins its own Rust toolchain through rust-overlay, so a stale lock
# silently falls behind Cargo.toml's `rust-version` and breaks `nix build`.
# Update Nix flake lock.
[group('build')]
nix-update:
nix flake update
# Build the Nix package the way `nix build github:hahwul/dalfox` does.
[group('build')]
nix-build:
nix build .#default --print-build-logs
./result/bin/dalfox --version
# Evaluate every flake output for every supported system (fast, no build).
[group('build')]
nix-check:
nix flake check --no-build --all-systems
# Serve docs site locally.
[group('documents')]
docs-serve:
hwaro serve -i docs --base-url="http://localhost:3000"
# Install docs dependencies (macOS).
[group('documents')]
docs-dependencies:
brew install hahwul/hwaro/hwaro
# Format code and apply clippy suggestions.
[group('build')]
fix:
cargo fmt
cargo clippy --fix --allow-dirty
# Check formatting and lints without modifying files (matches CI).
[group('build')]
lint:
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
# Report dalfox version across all version-bearing files.
[group('release')]
version-check:
crystal run scripts/version_check.cr
# Bump dalfox version in lockstep across all version-bearing files.
[group('release')]
version-update:
crystal run scripts/version_update.cr
# Run unit tests.
[group('test')]
test:
cargo test
# Run all tests including ignored ones.
[group('test')]
test_all:
cargo test -- --include-ignored
# Benchmark detection against XSSMaze (main) and record the score in docs.
[group('benchmark')]
xssmaze-score: build
crystal run scripts/xssmaze_score.cr
# Re-render the XSSMaze score page from the committed snapshot (no scanning).
[group('benchmark')]
xssmaze-render:
XSSMAZE_RENDER_ONLY=1 crystal run scripts/xssmaze_score.cr
# ---------------------------------------------------------------------------
# Crystal harnesses (scripts/). Shared helpers live in scripts/lib; the
# disposable labs each harness scans live in scripts/labs. See scripts/README.md.
# ---------------------------------------------------------------------------
# Assert the five scanning surfaces (CLI, config, REST, MCP, skills+docs) agree.
[group('harness')]
surface-parity: build
crystal run scripts/surface_parity.cr
# Assert the output contract: every --format parses and nothing else reaches stdout.
[group('harness')]
output-conformance: build
crystal run scripts/output_conformance.cr
# Read-only docs lint: EN/KO pairing, front matter, links, CSP, generated markers.
[group('harness')]
docs-lint:
crystal run scripts/docs_lint.cr
# End-to-end smoke test of the REST and MCP servers, including their parity.
[group('harness')]
server-mcp-smoke: build
crystal run scripts/server_mcp_smoke.cr
# Assert dalfox survives hostile responses (crash / hang / memory gate).
[group('harness')]
hostile-scan: build
crystal run scripts/hostile_scan.cr
# Replay the benign corpus; any finding on these pages is a false positive.
[group('harness')]
replay-corpus: build
crystal run scripts/replay_corpus.cr
# Run every gate above, continuing past failures (exit non-zero if any failed).
[group('harness')]
harness: build
#!/usr/bin/env bash
rc=0
for h in docs_lint surface_parity output_conformance replay_corpus server_mcp_smoke hostile_scan; do
echo "::: $h"
crystal run "scripts/$h.cr" || rc=1
done
exit $rc
# Measure precision/recall against the labelled mock-case corpus (~10s).
[group('benchmark')]
effectiveness: build
crystal run scripts/effectiveness_snapshot.cr
# Re-report the committed effectiveness snapshot without scanning.
[group('benchmark')]
effectiveness-report:
EFFECTIVENESS_RENDER_ONLY=1 crystal run scripts/effectiveness_snapshot.cr
# Measure request volume and wall-clock per scenario, gated against the snapshot.
[group('benchmark')]
perf-budget: build
crystal run scripts/perf_budget.cr
# Accept the current cost numbers as the new baseline.
[group('benchmark')]
perf-budget-update: build
PERF_UPDATE_BASELINE=1 crystal run scripts/perf_budget.cr
# Diff findings between a baseline binary and the working build.
[group('benchmark')]
ab-diff old: build
AB_OLD_BIN={{old}} crystal run scripts/ab_diff.cr
# Serve the labelled mock-case corpus (Ctrl-C to stop).
[group('lab')]
lab-corpus:
crystal run scripts/labs/corpus_server.cr
# Serve the request-counting lab.
[group('lab')]
lab-counting:
crystal run scripts/labs/counting_server.cr
# Serve the adversarial-response lab.
[group('lab')]
lab-hostile:
crystal run scripts/labs/hostile_server.cr
# Serve the benign false-positive corpus.
[group('lab')]
lab-replay:
crystal run scripts/labs/replay_server.cr