reconFTW is a tool designed to perform automated recon on a target domain by running the best set of tools to perform scanning and finding out vulnerabilities
id: 02-03 phase: 02 plan: 03 type: execute wave: 1 depends_on: [] requirements: [SEC-03, SEC-04] files_modified:
- reconftw.sh
- modules/subdomains.sh
- modules/web.sh
- install.sh
- tools.lock
autonomous: true
must_haves:
truths:
- "D-07: reconftw.sh declares
declare -a AXIOM_EXTRA_ARGS_ARR=()and parses it once viaread -r -a AXIOM_EXTRA_ARGS_ARR <<<\"${AXIOM_EXTRA_ARGS}\"(with defensive IFS save/restore) — the parse runs AFTERsecrets.cfgsource (line 503) AND AFTERline 511) AND BEFORE theCUSTOM_CONFIGsource (CLI_*re-apply block (~line 513)" - "D-07:
AXIOM_EXTRA_ARGS_ARRisUPPER_SNAKE_CASE(matches CONVENTIONS.md:60-63 for globals likeAXIOM,AXIOM_EXTRA_ARGS,AXIOM_FLEET_COUNT)" - "D-07: When
AXIOM_EXTRA_ARGSis unset or empty,AXIOM_EXTRA_ARGS_ARRis an empty array; expanding\"${AXIOM_EXTRA_ARGS_ARR[@]}\"produces zero arguments" - "D-07: When
AXIOM_EXTRA_ARGS=\"--rate-limit 100 --threads 50\", sourcing reconftw.sh producesAXIOM_EXTRA_ARGS_ARRwith exactly 4 tokens (--rate-limit,100,--threads,50)" - "D-08: 21 call sites in modules/subdomains.sh that reference
AXIOM_EXTRA_ARGS(lines 672, 737, 745, 768, 962, 1100, 1107, 1233, 1366, 1570, 1587, 1666, 1742, 1825, 1838, 1905, 1926, 1944, 1990, 2068, 2197) all become\"${AXIOM_EXTRA_ARGS_ARR[@]}\"" - "D-08: 15 axiom-scan call sites in modules/web.sh (lines 340, 431, 506, 786, 1008, 1152, 1537, 1988, 1990, 2257, 2280, 2341, 2479, 2925, 2927) all become
\"${AXIOM_EXTRA_ARGS_ARR[@]}\"" - "D-09: The
local -a axiom_extra_args=()declaration at modules/web.sh:144 and theif/then/read/fiblock at modules/web.sh:150-155 are entirely removed fromwebprobe_full()" - "D-09: The expansion at modules/web.sh:200 (
axiom_cmd+=(\"${axiom_extra_args[@]}\")) becomesaxiom_cmd+=(\"${AXIOM_EXTRA_ARGS_ARR[@]}\"); the surrounding guard at :199 also references the global array" - "D-10: Verification sweep after AXIOM_EXTRA_ARGS_ARR migration runs three independent checks (D-10a/b/c below) — no new bats test is added in this phase (test coverage deferred to Phase 4 TEST-03 per CONTEXT.md)"
- "D-10a:
grep -nE 'AXIOM_EXTRA_ARGS([^_]|$)' modules/subdomains.sh modules/web.shreturns 0 hits — every legacy reference has migrated to the_ARRform (the[^_]|$pattern excludes the newAXIOM_EXTRA_ARGS_ARRreads)" - "D-10b: Sourcing smoke-test demonstrates correct tokenisation —
bash -c 'AXIOM_EXTRA_ARGS=\"--rate-limit 100 --threads 50\" source reconftw.sh --source-only; echo \"${#AXIOM_EXTRA_ARGS_ARR[@]}\"'outputs4" - "D-10c:
shellcheck -s bash --severity=error modules/subdomains.sh modules/web.sh reconftw.shexits 0 with no NEW error-level findings tied to the migration" - "D-11: install.sh
install_rust_uv()(lines 159-188) wiresverify_sha256calls behindRUSTUP_INSTALLER_SHA256andUV_INSTALLER_SHA256env vars — when set, the script verifies the downloaded tempfile and aborts withmsg_err+return 1on mismatch; when unset, behaviour is unchanged" - "D-11: install.sh documentation comment block at lines ~1228-1239 is extended to list
RUSTUP_INSTALLER_SHA256andUV_INSTALLER_SHA256alongside the existingGETJSWORDS_SHA256example" - "D-12: A new file
tools.lockexists at the repo root with exactly 5 entries fornuclei,httpx,ffuf,puredns,subfinderin<binary>=<module>@<version>format with#-comment-line tolerance" - "D-12: install.sh
install_tools()(lines ~489-521) readstools.lockinto apinned_toolsassociative array BEFORE thefor gotool in \"${!gotools[@]}\"loop; when${pinned_tools[$gotool]}is non-empty,go install -vuses that pinned<module>@<version>string; otherwise falls back to the existing${gotools[$gotool]}@latestbehaviour" - "D-12: Each
tools.lockentry's left-hand side matches a key in thegotoolsassociative array at install.sh:293-355 (case-sensitive); each right-hand side matches the correspondinggotoolsmodule path" - "D-13:
tools.lockdoes NOT pin any tool outside the 5 named — the file contains exactly 5 non-comment, non-blank entries" - "Backwards-compatible: a user with no
tools.lock(or noRUSTUP_INSTALLER_SHA256/UV_INSTALLER_SHA256env vars set) sees identical install behaviour to pre-Plan-02-03" - "bash -n passes on reconftw.sh, lib/common.sh, modules/core.sh, modules/web.sh, modules/subdomains.sh, install.sh after all edits" artifacts:
- path: "reconftw.sh" provides: "Global AXIOM_EXTRA_ARGS_ARR parse inserted between CUSTOM_CONFIG source and CLI_* re-apply" pattern: "AXIOM_EXTRA_ARGS_ARR"
- path: "modules/subdomains.sh" provides: "21 axiom-scan call sites migrated to "${AXIOM_EXTRA_ARGS_ARR[@]}"" pattern_absent: 'AXIOM_EXTRA_ARGS([^_]|$)'
- path: "modules/web.sh" provides: "15 axiom-scan call sites migrated + local axiom_extra_args block in webprobe_full removed (lines 144, 150-155, 199-200)" pattern_absent: 'AXIOM_EXTRA_ARGS([^_]|$)'
- path: "install.sh" provides: "install_rust_uv() wires verify_sha256 behind RUSTUP_INSTALLER_SHA256 / UV_INSTALLER_SHA256; install_tools() reads tools.lock before iterating gotools; comment block at :1228-1239 documents new env vars" pattern: "RUSTUP_INSTALLER_SHA256|UV_INSTALLER_SHA256|tools.lock"
- path: "tools.lock" provides: "5 pinned Go tool entries (nuclei, httpx, ffuf, puredns, subfinder); plain-text key=value with # comments" contains: "nuclei=" key_links:
- from: "reconftw.sh AXIOM_EXTRA_ARGS_ARR parse" to: "modules/subdomains.sh + modules/web.sh axiom-scan call sites" via: "global UPPER_SNAKE_CASE array expansion" pattern: 'AXIOM_EXTRA_ARGS_ARR[@]'
- from: "install.sh install_rust_uv()" to: "install.sh verify_sha256() helper (:82-102)" via: "env-var-driven optional verification (RUSTUP_INSTALLER_SHA256, UV_INSTALLER_SHA256)" pattern: 'verify_sha256 "$_tmpfile" "$_expected"'
- from: "install.sh install_tools()" to: "tools.lock file at SCRIPTPATH root" via: "while-read parse into pinned_tools associative array, lookup per gotool" pattern: 'pinned_tools[$gotool]'
- "D-07: reconftw.sh declares
Three independent supply-chain hardening changes bundled in one plan:
- AXIOM_EXTRA_ARGS array refactor (SEC-03) — Replace 38 inconsistent
$AXIOM_EXTRA_ARGS/"$AXIOM_EXTRA_ARGS"call sites acrossmodules/subdomains.sh(21 sites) andmodules/web.sh(15 sites + 1 local-pattern block) with a single globalAXIOM_EXTRA_ARGS_ARR=()array parsed once inreconftw.sh. Eliminate the per-functionaxiom_extra_args=()local pattern inwebprobe_full(D-09). - Installer SHA256 verification (SEC-04 part 1) — Wire env-var-driven
verify_sha256checks intoinstall_rust_uv()behindRUSTUP_INSTALLER_SHA256andUV_INSTALLER_SHA256. Backwards-compatible: unset env vars preserve pre-change behaviour. tools.lockmanifest (SEC-04 part 2) — Pin exactly 5 stability-critical Go tools (nuclei,httpx,ffuf,puredns,subfinder) in a new repo-roottools.lockfile.install.shreads the manifest before the Go install loop; pinned tools install at the recorded version, unpinned tools fall through to@latest.
Purpose: SEC-03 closes a "word-splitting an unquoted variable" anti-pattern that breaks when AXIOM_EXTRA_ARGS="--rate-limit 100 --threads 50" is set as intended (the "$AXIOM_EXTRA_ARGS" quoted form makes the whole string a single token; the bare form works but is indistinguishable from accidental unquoting). SEC-04 addresses the audit finding that the installer downloads and executes upstream scripts without integrity verification AND that commit 71653984 ("remove pinned versions") removed all Go-tool version pins, leaving every install at the mercy of @latest. Env-var-driven pinning + a 5-tool lock manifest matches the existing GETJSWORDS_SHA256/AXIOM_CONFIG_SHA256 precedent and keeps maintenance surface small (D-13).
Output: One global parse in reconftw.sh + 36 mechanical token substitutions across 2 modules + 1 local-block deletion in webprobe_full; install_rust_uv extended with verification gates; install_tools extended to consult tools.lock before the Go install loop; one new file tools.lock with 5 pinned entries.
From reconftw.sh:497-513 (TARGET REGION for the AXIOM_EXTRA_ARGS_ARR parse insertion):
. "${SCRIPTPATH}"/reconftw.cfg || {
_print_error "Error importing reconftw.cfg"
exit 1
}
# Source optional secrets file (gitignored, for API keys and tokens)
[[ -f "${SCRIPTPATH}/secrets.cfg" ]] && . "${SCRIPTPATH}/secrets.cfg"
if [[ -s $CUSTOM_CONFIG ]]; then
# shellcheck source=/home/six2dez/Tools/reconftw/custom_config.cfg
. "${CUSTOM_CONFIG}" || {
_print_error "Error importing custom config"
exit 1
}
fi
# Re-apply CLI overrides after config load (config defaults should not clobber CLI flags)
From modules/web.sh:144-202 (THE LOCAL BLOCK TO DELETE / EXPANSIONS TO REPLACE in webprobe_full):
local probe_out=".tmp/web_full_info_probe.txt"
local common_json_tmp=".tmp/web_full_info_common_current.txt"
local uncommon_json_tmp=".tmp/web_full_info_uncommon_current.txt"
local -a axiom_extra_args=() # ← DELETE
: >"$probe_out" 2>/dev/null || true
: >"$common_json_tmp" 2>/dev/null || true
: >"$uncommon_json_tmp" 2>/dev/null || true
if [[ $AXIOM == true ]] && [[ -n "${AXIOM_EXTRA_ARGS:-}" ]]; then # ← DELETE block 150-155
local _ifs="$IFS"
IFS=' '
read -r -a axiom_extra_args <<<"$AXIOM_EXTRA_ARGS"
IFS="$_ifs"
fi # ← end DELETE
...
if [[ ${#axiom_extra_args[@]} -gt 0 ]]; then # ← :199 REPLACE
axiom_cmd+=("${axiom_extra_args[@]}") # ← :200 REPLACE
fi
From install.sh:82-102 (verify_sha256 helper — REUSE, do not modify):
verify_sha256() {
local file="$1"
local expected="$2"
local actual=""
[[ -n "$expected" ]] || return 0 # nothing to verify
[[ -s "$file" ]] || return 1
if command -v sha256sum >/dev/null 2>&1; then
actual=$(sha256sum "$file" | awk '{print $1}')
elif command -v shasum >/dev/null 2>&1; then
actual=$(shasum -a 256 "$file" | awk '{print $1}')
else
return 0 # no hashing tool available; skip (don't block install)
fi
[[ -n "$actual" && "$actual" == "$expected" ]]
}
From install.sh:159-188 (install_rust_uv body — TARGET for SHA wiring):
install_rust_uv() {
local _tmpfile
_tmpfile=$(mktemp "${TMPDIR:-/tmp}/rustup_install.XXXXXX")
if curl -sSf https://sh.rustup.rs -o "$_tmpfile" 2>/dev/null; then
sh "$_tmpfile" -y >/dev/null 2>&1
else
msg_warn "[!] Failed to download rustup installer"
fi
rm -f "$_tmpfile"
...
_tmpfile=$(mktemp "${TMPDIR:-/tmp}/uv_install.XXXXXX")
if curl -LsSf https://astral.sh/uv/install.sh -o "$_tmpfile" 2>/dev/null; then
sh "$_tmpfile" &>/dev/null
else
msg_warn "[!] Failed to download uv installer"
fi
rm -f "$_tmpfile"
...
}
From install.sh:1240-1290 (download_sha256 PRECEDENT — env-var-driven optional pin pattern to mirror):
declare -A download_sha256=(
["getjswords"]="${GETJSWORDS_SHA256:-}"
["axiom_config"]="${AXIOM_CONFIG_SHA256:-}"
)
...
local _expected="${download_sha256[$key]:-}"
if [[ -n "$_expected" ]]; then
if verify_sha256 "$destination" "$_expected"; then
msg_ok "[$dl_step/$total_dl] $key fetched (sha256 verified)"
else
msg_err "[$dl_step/$total_dl] $key sha256 mismatch for $url; refusing to install"
rm -f "$destination"
continue
fi
else
msg_ok "[$dl_step/$total_dl] $key fetched"
fi
From install.sh:489-521 (install_tools — TARGET for tools.lock consumer wiring):
function install_tools() {
header "Installing Golang tools (${#gotools[@]})"
export GOFLAGS="-mod=mod"
export GO111MODULE="on"
local go_step=0
local failed_tools=()
local total_go=${#gotools[@]}
local go_ok=0 go_skip=0 go_fail=0
for gotool in "${!gotools[@]}"; do
((++go_step))
if q go install -v "${gotools[$gotool]}@latest"; then
((++go_ok))
msg_ok "[$go_step/$total_go] ${gotool} installed"
else
...
fi
done
From install.sh:293-355 (gotools associative array — module paths to match in tools.lock RHS):
["nuclei"]="github.com/projectdiscovery/nuclei/v3/cmd/nuclei"["httpx"]="github.com/projectdiscovery/httpx/cmd/httpx"["ffuf"]="github.com/ffuf/ffuf/v2"["puredns"]="github.com/d3mondev/puredns/v2"["subfinder"]="github.com/projectdiscovery/subfinder/v2/cmd/subfinder"
```bash
# Global parse of AXIOM_EXTRA_ARGS once after config load — single source of truth.
# Consumed via "${AXIOM_EXTRA_ARGS_ARR[@]}" in modules/subdomains.sh and modules/web.sh.
# Empty/unset env → empty array → expands to nothing at the call sites.
declare -a AXIOM_EXTRA_ARGS_ARR=()
if [[ -n "${AXIOM_EXTRA_ARGS:-}" ]]; then
_axiom_ifs_saved="$IFS"
IFS=' '
read -r -a AXIOM_EXTRA_ARGS_ARR <<<"${AXIOM_EXTRA_ARGS}"
IFS="$_axiom_ifs_saved"
unset _axiom_ifs_saved
fi
```
Rationale for IFS-save/restore: reconftw.sh ships `IFS=$'\n\t'` (top of file, CONVENTIONS.md:11). Forcing `IFS=' '` for the `read -r -a` ensures space-separated values like `"--rate-limit 100"` tokenise as expected, and restoring `IFS` keeps downstream behaviour identical. Per CONVENTIONS.md, no `set -u` is used, so expanding `"${AXIOM_EXTRA_ARGS_ARR[@]}"` against an empty array is safe.
Per D-08: In `modules/subdomains.sh`, perform 21 mechanical token substitutions. For each line listed below, replace the trailing token only (NOT surrounding whitespace, NOT line-continuation `\`, NOT trailing redirects `2>>"$LOGFILE" >/dev/null`):
| Line | Replace | With |
|------|---------|------|
| 672 | `$AXIOM_EXTRA_ARGS` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 737 | `$AXIOM_EXTRA_ARGS` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 745 | `$AXIOM_EXTRA_ARGS` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 768 | `$AXIOM_EXTRA_ARGS` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 962 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 1100 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 1107 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 1233 | `$AXIOM_EXTRA_ARGS` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 1366 | `$AXIOM_EXTRA_ARGS` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 1570 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 1587 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 1666 | `$AXIOM_EXTRA_ARGS` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 1742 | `$AXIOM_EXTRA_ARGS` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 1825 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 1838 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 1905 | `$AXIOM_EXTRA_ARGS` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 1926 | `$AXIOM_EXTRA_ARGS` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 1944 | `$AXIOM_EXTRA_ARGS` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 1990 | `$AXIOM_EXTRA_ARGS` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 2068 | `$AXIOM_EXTRA_ARGS` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 2197 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
Line numbers above are from PATTERNS.md (verified `grep -nE` audit). If the executor's local `grep -nE 'AXIOM_EXTRA_ARGS' modules/subdomains.sh` shows different line numbers (e.g., a prior phase 1 commit shifted them), use the grep output as the source of truth — the substitution rule is: every occurrence of bare `$AXIOM_EXTRA_ARGS` or quoted `"$AXIOM_EXTRA_ARGS"` becomes `"${AXIOM_EXTRA_ARGS_ARR[@]}"`.
Per D-08: In `modules/web.sh`, perform the same substitution at these axiom-scan call sites (15 sites — note lines 144, 150, 153, 199, 200 are NOT in this list; they are handled by D-09 below):
| Line | Replace | With |
|------|---------|------|
| 340 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 431 | `$AXIOM_EXTRA_ARGS` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 506 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 786 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 1008 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 1152 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 1537 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 1988 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 1990 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 2257 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 2280 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 2341 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 2479 | `"$AXIOM_EXTRA_ARGS"` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 2925 | `$AXIOM_EXTRA_ARGS` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
| 2927 | `$AXIOM_EXTRA_ARGS` | `"${AXIOM_EXTRA_ARGS_ARR[@]}"` |
Preserve `&>/dev/null` at line 2341 (bash combined-redirect) verbatim — only the token changes. Preserve all line-continuation `\` characters and trailing redirects.
Per D-09: In `modules/web.sh` (inside `webprobe_full`):
1. Line 144: DELETE the line ` local -a axiom_extra_args=()` (entire line, including the leading indentation).
2. Lines 150-155 inclusive: DELETE the entire 6-line block:
```bash
if [[ $AXIOM == true ]] && [[ -n "${AXIOM_EXTRA_ARGS:-}" ]]; then
local _ifs="$IFS"
IFS=' '
read -r -a axiom_extra_args <<<"$AXIOM_EXTRA_ARGS"
IFS="$_ifs"
fi
```
3. Line 199: REPLACE `if [[ ${#axiom_extra_args[@]} -gt 0 ]]; then` with `if [[ ${#AXIOM_EXTRA_ARGS_ARR[@]} -gt 0 ]]; then`.
4. Line 200: REPLACE `axiom_cmd+=("${axiom_extra_args[@]}")` with `axiom_cmd+=("${AXIOM_EXTRA_ARGS_ARR[@]}")`.
PATTERNS.md notes that the `if [[ ${#...[@]} -gt 0 ]]` guard at :199 is now redundant (because `axiom_cmd+=("${AXIOM_EXTRA_ARGS_ARR[@]}")` against an empty array is a no-op in bash 4.3+). The guard MAY be dropped for simplicity, but doing so is OPTIONAL. Recommendation: keep the guard for defensive symmetry with the rest of the function — fewer diff lines, easier review. Either choice is acceptable.
Line numbers in the action above are from PATTERNS.md; deleting lines 144 and 150-155 in `modules/web.sh` will shift subsequent line numbers in that file by 7 lines. Apply the deletions BEFORE the line-by-line substitutions in `modules/web.sh`, OR perform all `web.sh` edits via a single targeted-text substitution pass (e.g., per-line `sed` invocations keyed on the surrounding text rather than line numbers). The substitution targets (`"$AXIOM_EXTRA_ARGS"`, `$AXIOM_EXTRA_ARGS`) are unique to the axiom-scan-call context within their lines, so text-keyed substitution is reliable.
bash -n reconftw.sh && bash -n modules/subdomains.sh && bash -n modules/web.sh && grep -cE 'AXIOM_EXTRA_ARGS([^_]|$)' modules/subdomains.sh modules/web.sh | awk -F: '{sum+=$2} END {print sum}' && grep -c 'AXIOM_EXTRA_ARGS_ARR' reconftw.sh
- `bash -n reconftw.sh` exits 0
- `bash -n modules/subdomains.sh` exits 0
- `bash -n modules/web.sh` exits 0
- `grep -cE 'AXIOM_EXTRA_ARGS([^_]|$)' modules/subdomains.sh modules/web.sh | awk -F: '{sum+=$2} END {print sum}'` returns `0` (no legacy references; the `[^_]|$` pattern excludes the new `AXIOM_EXTRA_ARGS_ARR` reads)
- `grep -c 'AXIOM_EXTRA_ARGS_ARR' reconftw.sh` returns at least `2` (the `declare -a` line plus the `read -r -a` line)
- `grep -c '"${AXIOM_EXTRA_ARGS_ARR\[@\]}"' modules/subdomains.sh` returns `21` (one per migrated site)
- `grep -c '"${AXIOM_EXTRA_ARGS_ARR\[@\]}"' modules/web.sh` returns at least `16` (15 call sites + 1 in the webprobe_full axiom_cmd append at :200; allow 17 if the executor opted to drop the `if [[ ${#...[@]} -gt 0 ]]` guard and inlined)
- `grep -n 'local -a axiom_extra_args=()' modules/web.sh` returns 0 hits (D-09)
- `grep -nE 'read -r -a axiom_extra_args' modules/web.sh` returns 0 hits (D-09)
- `grep -c '"${axiom_extra_args\[@\]}"' modules/web.sh` returns 0 hits (D-09 — the local-pattern expansion is gone)
- Sourcing smoke test: `bash -c 'AXIOM_EXTRA_ARGS="--rate-limit 100 --threads 50" source reconftw.sh --source-only; echo "${#AXIOM_EXTRA_ARGS_ARR[@]}"'` outputs exactly `4`
- Empty-env smoke test: `bash -c 'unset AXIOM_EXTRA_ARGS; source reconftw.sh --source-only; echo "${#AXIOM_EXTRA_ARGS_ARR[@]}"'` outputs exactly `0`
- `shellcheck -s bash --severity=error modules/subdomains.sh modules/web.sh reconftw.sh` exits 0 (no NEW error-level findings caused by this migration)
reconftw.sh has the global parse; modules/subdomains.sh has 21 migrated sites; modules/web.sh has 15 migrated call sites + the `webprobe_full` local block removed and `axiom_cmd+=` updated to use the global; both bare and quoted legacy forms are gone (`grep -nE 'AXIOM_EXTRA_ARGS([^_]|$)'` returns 0); sourcing smoke test demonstrates correct tokenisation.
Task 2: Wire verify_sha256 into install_rust_uv() + extend env-var documentation block
install.sh
- install.sh:82-102 (the existing `verify_sha256` helper — read its signature: skip-don't-block on missing tool, skip-on-empty-hash via `[[ -n "$expected" ]] || return 0`)
- install.sh:159-188 (the current `install_rust_uv` body — read the curl + sh tempfile pattern for both rustup and uv blocks)
- install.sh:1228-1240 (the existing env-var-driven SHA pin documentation comment block referencing `GETJSWORDS_SHA256` and `AXIOM_CONFIG_SHA256`)
- install.sh:1251-1290 (the `download_sha256` map iteration that demonstrates the env-var-driven pinning pattern — D-11's analog)
- .planning/phases/02-security-quoting-supply-chain-hygiene/02-CONTEXT.md section "D-11"
- .planning/phases/02-security-quoting-supply-chain-hygiene/02-PATTERNS.md section "install.sh:159-188 (install_rust_uv) — WIRE verify_sha256 calls"
Per D-11: In `install.sh`, modify `install_rust_uv()` (lines 159-188) to gate the `sh "$_tmpfile"` execution behind an optional SHA256 verification. Mirror the `download_sha256[$key]:-` env-var-driven pattern from install.sh:1240-1289 (the canonical precedent).
Target post-edit shape of `install_rust_uv`:
```bash
install_rust_uv() {
local _tmpfile
local _expected
# Install rustup via downloaded script (verify before executing)
_tmpfile=$(mktemp "${TMPDIR:-/tmp}/rustup_install.XXXXXX")
if curl -sSf https://sh.rustup.rs -o "$_tmpfile" 2>/dev/null; then
_expected="${RUSTUP_INSTALLER_SHA256:-}"
if [[ -n "$_expected" ]]; then
if verify_sha256 "$_tmpfile" "$_expected"; then
msg_ok "[!] rustup installer sha256 verified"
sh "$_tmpfile" -y >/dev/null 2>&1
else
msg_err "[!] rustup installer sha256 mismatch; refusing to execute"
rm -f "$_tmpfile"
return 1
fi
else
sh "$_tmpfile" -y >/dev/null 2>&1
fi
else
msg_warn "[!] Failed to download rustup installer"
fi
rm -f "$_tmpfile"
# shellcheck source=/dev/null
source "${HOME}/.cargo/env" 2>/dev/null || true
cargo install smugglex &>/dev/null
# Install uv via downloaded script (verify before executing)
_tmpfile=$(mktemp "${TMPDIR:-/tmp}/uv_install.XXXXXX")
if curl -LsSf https://astral.sh/uv/install.sh -o "$_tmpfile" 2>/dev/null; then
_expected="${UV_INSTALLER_SHA256:-}"
if [[ -n "$_expected" ]]; then
if verify_sha256 "$_tmpfile" "$_expected"; then
msg_ok "[!] uv installer sha256 verified"
sh "$_tmpfile" &>/dev/null
else
msg_err "[!] uv installer sha256 mismatch; refusing to execute"
rm -f "$_tmpfile"
return 1
fi
else
sh "$_tmpfile" &>/dev/null
fi
else
msg_warn "[!] Failed to download uv installer"
fi
rm -f "$_tmpfile"
# shellcheck source=/dev/null
source "${HOME}/.local/bin/env" 2>/dev/null || export PATH="${HOME}/.local/bin:$PATH"
uv tool update-shell &>/dev/null || true
# Install shodan CLI via uv
uv tool install shodan --force &>/dev/null || uv tool upgrade shodan &>/dev/null || true
}
```
Per D-11 documentation: Extend the comment block at install.sh:1228-1239 to mention the new env vars. Locate the existing block (the one that introduces `GETJSWORDS_SHA256` and `AXIOM_CONFIG_SHA256` as `export VAR=<sha>` examples) and append two lines:
```
# export RUSTUP_INSTALLER_SHA256=<64 hex chars> # rustup-init.sh from https://sh.rustup.rs
# export UV_INSTALLER_SHA256=<64 hex chars> # uv installer from https://astral.sh/uv/install.sh
```
Notes:
- `verify_sha256` returns 0 when no hash tool is available (skip-don't-block semantics, install.sh:98). The new path inherits this behaviour — the `msg_ok "[!] rustup installer sha256 verified"` line may fire even on systems without `sha256sum`/`shasum`, which is acceptable for opt-in pinning.
- `return 1` aborts `install_rust_uv` but does NOT abort `install.sh` overall (install.sh's `ERR` trap is log-and-continue). Per CONTEXT.md D-11: "aborts with a clear error message before executing it" — abort the bootstrapping function, not the whole install.
- `msg_ok`, `msg_warn`, `msg_err` are existing install.sh UI helpers — do NOT introduce new helper names.
- `local _expected` is declared once at the top of the function (after `local _tmpfile`); re-using the variable name across both rustup and uv branches is intentional (Bash locals shadow correctly).
bash -n install.sh && grep -c 'RUSTUP_INSTALLER_SHA256' install.sh && grep -c 'UV_INSTALLER_SHA256' install.sh && grep -c 'verify_sha256 "\$_tmpfile"' install.sh
- `bash -n install.sh` exits 0
- `grep -c 'RUSTUP_INSTALLER_SHA256' install.sh` returns at least `2` (one in `install_rust_uv` reading the env var + one in the documentation comment block)
- `grep -c 'UV_INSTALLER_SHA256' install.sh` returns at least `2`
- `grep -c 'verify_sha256 "\$_tmpfile"' install.sh` returns exactly `2` (one rustup call, one uv call)
- `grep -n 'rustup installer sha256 mismatch' install.sh` returns at least 1 hit (the abort path message)
- `grep -n 'uv installer sha256 mismatch' install.sh` returns at least 1 hit
- `grep -n 'rustup installer sha256 verified' install.sh` returns at least 1 hit (the OK-path message)
- `grep -n 'uv installer sha256 verified' install.sh` returns at least 1 hit
- Backwards-compatibility smoke: `bash -c 'unset RUSTUP_INSTALLER_SHA256 UV_INSTALLER_SHA256; declare -f install_rust_uv >/dev/null && echo OK'` — the function must remain definable (i.e., bash parses install.sh cleanly with no env vars set)
- `shellcheck -s bash --severity=error install.sh` exits 0 (no NEW error-level findings caused by this change)
install.sh has `verify_sha256 "$_tmpfile" "$_expected"` calls for both rustup and uv blocks; both calls are env-var-driven via `RUSTUP_INSTALLER_SHA256` and `UV_INSTALLER_SHA256`; the comment block at :1228-1239 documents both env vars; behaviour with env vars unset is identical to pre-change.
Task 3: Create tools.lock + wire install.sh install_tools() to consume it
tools.lock, install.sh
- install.sh:293-355 (the `gotools` associative array — verify the exact module paths for `nuclei`, `httpx`, `ffuf`, `puredns`, `subfinder` so tools.lock RHS values match exactly)
- install.sh:489-525 (the current `install_tools()` body — the `for gotool in "${!gotools[@]}"; do ... go install -v "${gotools[$gotool]}@latest" ...` loop that will be extended)
- install.sh:1258-1290 (the `download_sha256` map iteration — the canonical env-var-driven optional lookup pattern that mirrors what `pinned_tools` will do)
- .planning/phases/02-security-quoting-supply-chain-hygiene/02-CONTEXT.md sections "D-12" and "D-13"
- .planning/phases/02-security-quoting-supply-chain-hygiene/02-PATTERNS.md sections "tools.lock (new file, repo root)" and "install.sh:489-521 — Read tools.lock before iterating"
Per D-12 and D-13: Create a new file at the repo root `/Users/six2dez/Tools/reconftw/tools.lock` with exactly 5 pinned-tool entries plus header comments.
File contents:
```text
# tools.lock — pinned Go tool versions for stability-critical tools.
# Format: <binary>=<go-module>@<version>
# - Comment lines start with '#'
# - Blank lines tolerated
# - Tools not listed here fall through to `go install <module>@latest` in install.sh
# - Update by running `go install <module>@latest` once and recording the resolved tag
nuclei=github.com/projectdiscovery/nuclei/v3/cmd/[email protected]
httpx=github.com/projectdiscovery/httpx/cmd/[email protected]
ffuf=github.com/ffuf/ffuf/[email protected]
puredns=github.com/d3mondev/puredns/[email protected]
subfinder=github.com/projectdiscovery/subfinder/v2/cmd/[email protected]
```
Per CONTEXT.md D-12: the example version tags above are illustrative. The executor MUST verify the actual latest stable version tag at execution time and record the resolved value. Acceptable approaches:
- Run `go install -v <module>@latest` once for each of the 5 tools and read the resolved `@vX.Y.Z` tag from `go list -m -versions <module> | awk '{print $NF}'` or from the installed binary's `--version` output.
- Browse the upstream release page (e.g., https://github.com/projectdiscovery/nuclei/releases) and record the latest non-prerelease tag.
The exact module paths on the RHS MUST match the `gotools[<name>]` value in install.sh:293-355 character-for-character (verified path: `nuclei` → `github.com/projectdiscovery/nuclei/v3/cmd/nuclei`, etc., per PATTERNS.md). Mismatched paths will silently fall through to `@latest`.
Per D-13: ONLY these 5 tools are pinned. Do NOT add `anew`, `unfurl`, `qsreplace`, or any other Go tool. Commit `71653984` explicitly removed wholesale pinning; this plan re-introduces it only for the 5 stability-critical tools named in the success criterion.
File ends with a trailing newline.
Per D-12: In `install.sh`, extend `install_tools()` (lines 489-521) to read `tools.lock` into an associative array BEFORE the existing `for gotool in "${!gotools[@]}"; do ... done` loop. Target post-edit shape:
```bash
function install_tools() {
header "Installing Golang tools (${#gotools[@]})"
export GOFLAGS="-mod=mod"
export GO111MODULE="on"
# Load optional tool pins from ./tools.lock (D-12 / SEC-04).
# Each line: <binary>=<module>@<version>. Comments (#) and blank lines ignored.
# If a tool listed here is also in $gotools, the lock entry wins; otherwise
# `go install @latest` is used. Errors loading tools.lock are non-fatal.
declare -A pinned_tools=()
local _lockfile="${SCRIPTPATH:-$(pwd)}/tools.lock"
if [[ -f "$_lockfile" ]]; then
local _key _val
while IFS='=' read -r _key _val; do
# Strip surrounding whitespace; skip blanks/comments
_key="${_key#"${_key%%[![:space:]]*}"}"
_key="${_key%"${_key##*[![:space:]]}"}"
[[ -z "$_key" || "$_key" == \#* ]] && continue
_val="${_val#"${_val%%[![:space:]]*}"}"
_val="${_val%"${_val##*[![:space:]]}"}"
[[ -z "$_val" ]] && continue
pinned_tools["$_key"]="$_val"
done < "$_lockfile"
msg_ok "Loaded ${#pinned_tools[@]} pin(s) from tools.lock"
fi
local go_step=0
local failed_tools=()
local total_go=${#gotools[@]}
local go_ok=0 go_skip=0 go_fail=0
for gotool in "${!gotools[@]}"; do
((++go_step))
# Pinned version wins; otherwise fall through to @latest.
local _module_at_version
if [[ -n "${pinned_tools[$gotool]:-}" ]]; then
_module_at_version="${pinned_tools[$gotool]}"
else
_module_at_version="${gotools[$gotool]}@latest"
fi
if q go install -v "$_module_at_version"; then
((++go_ok))
msg_ok "[$go_step/$total_go] ${gotool} installed"
else
# ... existing else branch unchanged ...
if command -v "$gotool" >/dev/null 2>&1; then
((++go_skip))
msg_warn "[$go_step/$total_go] ${gotool} upgrade failed (existing binary kept)"
else
failed_tools+=("$gotool")
((++go_fail))
double_check=true
msg_err "[$go_step/$total_go] ${gotool} failed"
fi
fi
done
# ... rest of install_tools (the failed_tools summary etc.) unchanged ...
```
Notes:
- `SCRIPTPATH` is set by `reconftw.sh` but `install.sh` may run before reconftw.sh sources it; the fallback `${SCRIPTPATH:-$(pwd)}` covers both standalone-install and post-reconftw-load contexts.
- The lock value already includes the `@version` suffix from the file format, so `_module_at_version="${pinned_tools[$gotool]}"` directly contains the full `<module>@<version>` string. Do NOT append `@latest` to a pinned value.
- Whitespace stripping uses pure-Bash parameter expansion (no `sed`/`tr` dependency).
- Comment / blank line handling: `[[ -z "$_key" || "$_key" == \#* ]] && continue` covers `# comment`, empty lines, and whitespace-only lines.
- The `if [[ -n "${pinned_tools[$gotool]:-}" ]]` lookup is safe against unset keys (the `:-` default fallback works on associative-array reads in bash 4+).
- Unpinned tools (~50 of them) fall through to the existing `@latest` behaviour — no regression for tools outside the manifest.
- The "Loaded ${#pinned_tools[@]} pin(s) from tools.lock" `msg_ok` is informational; if the lockfile is missing the message is silently absent.
test -f tools.lock && bash -n install.sh && grep -cE '^[a-z][a-z_]*=github\.com' tools.lock && grep -c 'pinned_tools' install.sh && grep -c 'tools.lock' install.sh
- `test -f tools.lock` exits 0 (file exists at repo root)
- `wc -l < tools.lock` returns at least 11 (6 comment lines + 1 blank + 5 entries; trailing newline allowed)
- `grep -cE '^[a-z][a-z_]*=github\.com' tools.lock` returns exactly `5` (5 entries, no extras per D-13)
- `grep -E '^nuclei=' tools.lock` returns 1 hit and the value matches `nuclei=github.com/projectdiscovery/nuclei/v3/cmd/nuclei@v[0-9.]+`
- `grep -E '^httpx=' tools.lock` returns 1 hit and the value matches `httpx=github.com/projectdiscovery/httpx/cmd/httpx@v[0-9.]+`
- `grep -E '^ffuf=' tools.lock` returns 1 hit and the value matches `ffuf=github.com/ffuf/ffuf/v2@v[0-9.]+`
- `grep -E '^puredns=' tools.lock` returns 1 hit and the value matches `puredns=github.com/d3mondev/puredns/v2@v[0-9.]+`
- `grep -E '^subfinder=' tools.lock` returns 1 hit and the value matches `subfinder=github.com/projectdiscovery/subfinder/v2/cmd/subfinder@v[0-9.]+`
- `bash -n install.sh` exits 0
- `grep -c 'pinned_tools' install.sh` returns at least `4` (declaration + lookup + value-read + the if-guard)
- `grep -c 'tools.lock' install.sh` returns at least `1` (the `_lockfile=` path)
- Parse smoke test: `bash -c 'declare -A pinned_tools=(); while IFS="=" read -r _k _v; do _k="${_k#"${_k%%[![:space:]]*}"}"; [[ -z "$_k" || "$_k" == \#* ]] && continue; pinned_tools["$_k"]="$_v"; done < tools.lock; echo "${#pinned_tools[@]}"'` outputs `5`
- Each LHS in `tools.lock` must match a key in `install.sh:gotools`: `for k in nuclei httpx ffuf puredns subfinder; do grep -qE "^\s*\\[\"$k\"\\]=" install.sh && echo OK || echo MISMATCH; done` outputs `OK` 5 times
- `shellcheck -s bash --severity=error install.sh` exits 0
tools.lock exists at repo root with exactly 5 pinned entries; install.sh install_tools() reads the file into `pinned_tools` and consults it before the `for gotool` loop; pinned tools install at the recorded version; unpinned tools fall through to `@latest`; behaviour is backwards-compatible when tools.lock is absent.
## Trust Boundaries
| Boundary | Description |
|---|---|
| user config → bash word-split | AXIOM_EXTRA_ARGS value from reconftw.cfg enters the shell as a string; legacy code path unquoted it for word-split. Intent invisible to readers. |
| upstream HTTPS → executed shell | install_rust_uv() downloads scripts from sh.rustup.rs and astral.sh/uv/install.sh and pipes them to sh "$_tmpfile" — TLS protects transit but not source integrity. |
upstream Go module proxy → go install |
go install ...@latest resolves to whatever the proxy returns at install time; a compromised upstream tag or a typo-squat could install attacker code. |
STRIDE Threat Register
| Threat ID | Category | Component | Disposition | Mitigation Plan |
|---|---|---|---|---|
| T-02-03-01 | T (Tampering) | $AXIOM_EXTRA_ARGS unquoted word-split call sites |
mitigate | Migration to "${AXIOM_EXTRA_ARGS_ARR[@]}" (D-08) makes tokenisation explicit and predictable. A future contributor cannot accidentally introduce a single-token value that breaks (--rate-limit 100 would split correctly under the old bare form but break under the old quoted form). The array form has one tokenisation point (D-07 global parse) and one consumption shape ("${...[@]}") — uniform across the codebase. |
| T-02-03-02 | I (Information Disclosure) | Empty AXIOM_EXTRA_ARGS causing accidental empty-string arg |
mitigate | D-07 guards the parse with [[ -n "${AXIOM_EXTRA_ARGS:-}" ]]; expanding "${AXIOM_EXTRA_ARGS_ARR[@]}" against an empty array produces zero arguments. No more axiom-scan ... -o output.txt "" empty-string positional injection. |
| T-02-03-03 | T (Tampering) | Future re-introduction of axiom_extra_args=() local pattern |
mitigate | D-09 explicitly removes the only existing local copy of this pattern; CONVENTIONS.md UPPER_SNAKE_CASE rules + PATTERNS.md make "${AXIOM_EXTRA_ARGS_ARR[@]}" the documented canonical form, steering future contributors away from per-function locals. |
| T-02-03-04 | T (Tampering) | MITM / DNS hijack of sh.rustup.rs or astral.sh/uv/install.sh downloads |
mitigate (opt-in) | RUSTUP_INSTALLER_SHA256 and UV_INSTALLER_SHA256 env vars (D-11) enable verification when set. Unset = legacy behaviour preserved (HTTPS-trust). CI / security-conscious users opt in. Hard-pinning was explicitly rejected per D-11 reasoning ("breaks on every upstream release without an opt-out"). |
| T-02-03-05 | S (Spoofing) | Compromised upstream Go module replacing tagged release | mitigate (partial) | tools.lock pins 5 tools (D-12) by <module>@<version>. Go's module proxy verifies module-path-to-sha checksum on first download (go.sum-style), so a re-tag attack would be caught by Go's own verification — tools.lock makes the version explicit and re-installable. Tools outside the 5 named (D-13 scope cap) remain at @latest and inherit the unmitigated risk; this is accepted because re-introducing wholesale pinning was explicitly reverted in commit 71653984. |
| T-02-03-06 | R (Repudiation) | "Was the install bit-for-bit reproducible?" question for the 5 critical tools | mitigate | tools.lock makes the 5 critical tool versions auditable in git history; git log -- tools.lock shows the version-change trail. |
| T-02-03-07 | D (Denial of Service) | Stale tools.lock version causing go install failure |
accept | Pinned tools may break if the recorded tag is yanked or if a transitive dependency goes missing. install.sh:518-520 (the failed_tools collector + command -v "$gotool" skip) provides the same graceful-degradation path that exists today. CI alerting on install.sh failure is the canonical fix. |
| T-02-03-08 | E (Elevation of Privilege) | Malformed tools.lock line causing go install to receive attacker-controlled module path |
accept | tools.lock is in the repo and edited by trusted contributors; the same trust applies as for install.sh itself. The parser uses pure-Bash parameter expansion (no eval); a malformed line silently skips. No new privilege surface. |
Residual risk: Tools outside the 5 pinned (50+ of them) still install @latest — this is accepted per D-13. The install_rust_uv SHA verification is opt-in — users who don't set the env vars get pre-change behaviour. Both gaps are documented and have explicit user-driven mitigation paths.