Repository navigation
Conversation
Merge dev into main: bump subfinder pin to v2.16.0 (#1062)
reconftw.sh runs `set +e`, so the ~20 suites that source it from their own
setup() lost errexit and only a test's LAST command decided the verdict (an
explicit `return 1` mid-test still reported ok). With --source-only the
script now restores the caller's errexit. 33 tests went red. Five were real
bugs in production bash:
- osint: `if ! msftrecon; then rc=$?` always recorded 0.
- core: the missing-tool warn-once check compared " ${missing[*]} " under
the global IFS, so it never matched and warned every time.
- utils: run_command stored the axiom-disabled command with one argument
per line ("${cmd[*]}" under IFS=$'\n\t').
- web/vulns: grep -P is not available in BSD grep (macOS).
- common: run_with_heartbeat_shell used `bash -lc`; the login shell rebuilt
PATH with BSD tools ahead of GNU ones.
The rest were hidden test defects (stale interlace mocks, real tools
reached through ~/go/bin, arrays declared local from setup(), negated
commands that errexit ignores, after_each instead of teardown) and the
sanitize_domain injection tests, which asserted on stderr; they now assert
stdout is exactly the neutralised host with no metacharacter.
Also:
- cached_download_typed no longer copies a file that dry-run never
downloaded; the cp error broke --log-format jsonl-strict (the weekly
integration-full job has failed on this since March).
- test_resolvers_hardening re-pins CACHE_DIR, tools and resolver paths
after sourcing reconftw.cfg; it was overwriting the operator's real
~/Tools/resolvers.txt with a one-line mock.
- Tests no longer leave files in the repository root.
The modules assume GNU behaviour (`wc -l` without padding, `stat -c`, GNU `sed -i`, `grep -P`), but the Homebrew gnubin PATH setup sat *after* the --source-only early return, so the bats suites loaded the modules and then ran them against the BSD userland. CI's macos-smoke job puts gnubin on PATH itself, so this diverged in both directions: a GNU-only assumption could fail on the maintainer's Mac and pass in CI, or pass locally and fail there. The block is now a function called from both paths. Sourcing callers get a warning instead of `exit 1`, because killing the caller's shell is worse than running with whatever is on PATH. Exposed by this, and fixed: incremental_diff built its INFO line from `wc -l <file`, which BSD wc pads, so macOS reported "test: 1 new (previous: 1, total: 2)". It now uses count_lines(), which already strips the padding.
An out-of-scope entry was deleted with an unanchored `sed "/${escaped}/d"`,
so "dev.example.com" in the out-of-scope list also removed every line that
merely CONTAINED it: xdev.example.com, api.dev.example.com,
dev.example.com.cdn.net, and any URL with it in the path. In-scope assets
disappeared from subdomains.txt and webs.txt with nothing in the log to say
why, and wildcard entries had the same problem with a `$` anchor on the tail
only.
Entries are now anchored to the whole hostname with an ERE that tolerates
the optional scheme, port and path the callers pass (subdomains.txt is a
host list, webs.txt and arjun are URL lists). "*.example.com" keeps its
suffix semantics. Matching is case-insensitive, and a file emptied of every
line is a valid outcome rather than a grep failure.
The three anchoring cases in tests/security/test_injection.bats cover it;
they came in with the assertion restore and were red until now.
Slack retired `files.upload` on November 12, 2025, so `sendToNotify()` now uploads files to Slack in three steps. It calls `files.getUploadURLExternal` with the filename and byte length, POSTs the raw bytes to the returned `upload_url`, and finishes with `files.completeUploadExternal` (sending `files`, `channels` and `initial_comment`). If no upload URL comes back it prints a warning, and it skips that warning in dry-run mode. I also added a CHANGELOG entry. Nothing was run: no `make lint`, `shellcheck` or bats tests, and no live Slack upload. Notice slack-files-upload-sunset about slack.com's API describes the change. It was read from a file and is not signed by the provider.
…e keys Adapting #1065 (thanks @juanmill4). Three things the PR's own 15 tests could not see, because reconftw.sh's `set +e` had made every bats assertion but a test's last command inert: - The target guard enumerated bad characters as [/?*@:], which omits ';'. "example.com;echo" therefore passed it, sanitize_domain quietly rewrote it to "example.comecho", validate_domain accepted that, and the lookup queried DarkEye for a domain the operator never named. The guard now requires sanitization to be a no-op against the lower-cased input, which covers ';', '&', '|', '$', backticks and spaces without enumerating any of them, while still accepting "EXAMPLE.COM". This is what the "wildcards, URLs and IPs are rejected" case actually asserts now; it was red before this change. - darkeye_exposure's body is a subshell, so its register_secret() call never reached REGISTERED_SECRETS in the parent and the API keys were not redacted from logs or dry-run previews. Both names are now in REDACT_VARS, which resolves by name and so works regardless of the subshell. - curl's stderr went to /dev/null instead of $LOGFILE, unlike every other tool call in the tree. Also: comments translated to English to match the rest of the codebase, and the README section moved out from under "Star History" into its own section before the license, with a table-of-contents entry. Note for later: because the body is a subshell, end_func's record_func_timing write is lost, so darkeye_exposure will not appear in the verbose timing summary. The checkpoint itself is a file, so resume is unaffected.
Adapting #1063 (thanks @torrresagus). The three-step replacement for the sunset files.upload matches Slack's documented contract -- verified against docs.slack.dev: getUploadURLExternal takes filename and length and returns upload_url and file_id, and completeUploadExternal accepts files, channels (comma-separated, alongside the singular channel_id) and initial_comment. Two gaps closed: - Only the first step's result was checked. If completeUploadExternal failed, the file had uploaded but was never shared to the channel, and the run said nothing -- the exact failure an operator relying on these notifications would not notice. Its `ok` is now checked and the API's error reported. The upload-URL warning also names the error Slack returned. - The PR carried no test, because there was no Slack mock to extend. There is one now: tests/unit/test_slack_upload.bats pins which endpoints are called and in what order, that the sunset endpoint is not among them, the real byte length and basename, the raw-octet-stream body rather than a multipart form, the returned file_id/channel/comment on the final step, both failure paths, that a dry run issues no request, and that the bot token is redacted. All nine cases are mutation-checked: pointing step one back at files.upload, dropping the ok-check, renaming channels=, sending a wrong length, swapping the raw POST for -F, or ignoring the returned file_id each turn the suite red.
…on errors - GOTATOR_FLAGS, NUCLEI_EXTRA_ARGS, NUCLEI_DAST_EXTRA_ARGS and AXIOM_EXTRA_ARGS are arrays. Under the global IFS=$'\n\t' the old strings reached the tools as ONE argument. _as_array keeps old string configs working. - deleteOutScoped matches whole hostnames, so dev.example.com no longer removes xdev.example.com. - interlace inputs are sanitised and the ffuf header is passed through the environment instead of the -c string. - install.sh exits non-zero when any tool failed to install. - tests/security runs with --unit and in CI; shellcheck runs at -S warning. - Dead helpers and unused cfg variables removed.
…iftool The setup comment claimed "empty PATH dir first so no real nuclei/testssl/ exifray is reachable", but prepending an empty directory hides nothing: ~/go/bin/nuclei stayed on PATH, so the "binary not found" branch never ran and "nuclei_check runs again when DIFF=true" only passed on CI's toolless runner. It was red on a provisioned box. Every PATH entry that actually provides one of the three tools is now dropped, and setup fails loudly if one is still reachable afterwards rather than letting the file go quietly green against the real binaries.
…g` array shellcheck tracks a name across the whole file, so a local string called `missing` inside _init_gnu_path collided with the `missing` array used by the dependency check and produced six SC2178/SC2128 warnings. Harmless at runtime, but the CI gate is now -S warning, so it would have been red. Renaming is the fix; a disable comment would only have hidden a genuinely confusing name reuse. shellcheck -S warning is clean on reconftw.sh, modules/, lib/ and install.sh.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Integrates the two open contributor PRs and back-ports the v1 bash fixes that were sitting on
dev-go, where v1 users never get them.devwas 2 commits behindmainwith an identical tree, so this branch is based onmainand merges cleanly intodev.The reason this is more than two PRs
reconftw.shran a bareset +e, and ~20 bats suites source it from their ownsetup(). Errexit was therefore off inside every test body, so only a test's last command decided the verdict — every earlier assertion was inert. Both PRs arrived with green suites that were not actually asserting.Restoring errexit (back-ported from
dev-go) turned up one real defect in each area, and a second root cause behind both.Contributor PRs
#1063 — Slack
files.uploadsunset (@torrresagus)Verified the three-step flow against docs.slack.dev:
getUploadURLExternaltakesfilename+lengthand returnsupload_url+file_id;completeUploadExternalacceptsfiles,channels(comma-separated, alongside the singularchannel_id) andinitial_comment. The PR matches the documented contract.Two gaps closed:
okis now checked and Slack'serrorreported.tests/unit/test_slack_upload.batsadds nine cases, all mutation-checked: pointing step one back atfiles.upload, dropping the ok-check, renamingchannels=, sending a wrong byte length, swapping the raw POST for-F, or ignoring the returnedfile_ideach turn the suite red.#1065 — DarkEye domain exposure (@juanmill4)
Opt-in, metadata-only, off by default, with good docs and an honest "not run against the live APIs". Three fixes:
[/?*@:], which omits;.example.com;echopassed it,sanitize_domainquietly rewrote it toexample.comecho,validate_domainaccepted that, and the lookup queried DarkEye for a domain the operator never named. The guard now requires sanitization to be a no-op against the lower-cased input, which covers;,&,|,$, backticks and spaces without enumerating any of them, and still acceptsEXAMPLE.COM. This is what the "wildcards, URLs and IPs are rejected" case asserts now — it was red before the fix.darkeye_exposure's body is a subshell (it needs its ownumaskand EXIT trap), so itsregister_secret()call never reachedREGISTERED_SECRETSin the parent. Both names are now inREDACT_VARS, which resolves by name and so works regardless./dev/nullinstead of$LOGFILE, unlike every other tool call in the tree.Also: comments translated to English, and the README section moved out from under "Star History" into its own section with a ToC entry.
#1048 — already merged, should be closed
Both of its commits (
cece45fd,6cbabe06) are ancestors ofmainvia merge6324bddb, and thePROXYCHAINS_EXCLUDEfollow-upca86b6a7is in too. Its base branchfix/main-open-issueswent in as #1047. Nothing left to merge.Back-ported from dev-go
7be831c9— the errexit restore plus the five production bash bugs it exposed (msftrecon rc always 0, warn-once compared under the global IFS,run_commandstored axiom commands one argument per line,grep -Pon BSD,bash -lcrebuilding PATH with BSD tools first), thecached_download_typeddry-runcpthat brokejsonl-strict, and thetest_resolvers_hardeningcase that was overwriting the operator's real~/Tools/resolvers.txtwith a one-line mock.fbdd5620—GOTATOR_FLAGS,NUCLEI_EXTRA_ARGS,NUCLEI_DAST_EXTRA_ARGSandAXIOM_EXTRA_ARGSas arrays. Under the globalIFS=$'\n\t'the old strings reached the tools as one argument, so those flags silently did nothing;_as_arraykeeps existing string configs working. Also interlace input sanitisation, the ffuf header via the environment,install.shexiting non-zero when a tool failed to install, and the CI shellcheck gate at-S warning.New in this branch
macos: put the GNU userland on PATH for --source-only too— the root cause behind two of the failures above. The Homebrew gnubin setup sat after the--source-onlyearly return, so the suites loaded the modules and then ran them against the BSD userland, while CI'smacos-smokejob puts gnubin on PATH itself. A GNU-only assumption could fail on a maintainer's Mac and pass in CI, or the reverse. Sourcing callers now get a warning instead ofexit 1.incremental_diffbuilt its INFO line fromwc -l <file, which BSD wc pads, so macOS reportedtest: 1 new (previous: 1, total: 2).scope: anchor deleteOutScoped to the whole host— an out-of-scopedev.example.comwas deleted with an unanchoredsed, so it also removedxdev.example.com,api.dev.example.com,dev.example.com.cdn.netand any URL with it in the path. In-scope assets vanished fromsubdomains.txtandwebs.txtwith nothing in the log. (fbdd5620carries the same fix; this commit has the detailed rationale and landed first, so that hunk was already applied.)tests: make the checkpoint guard actually hide nuclei, testssl and exiftool— its setup claimed an empty PATH dir made the real binaries unreachable. It does not:~/go/bin/nucleistayed on PATH, the "binary not found" branch never ran, and the file only passed on CI's toolless runner. Setup now drops every PATH entry that provides one and fails loudly if one survives.Verification
Run on macOS (Darwin 27.2) against the final tree:
make lint(shellcheck -S error)shellcheck -S warning(the gatefbdd5620raises CI to)--unit, which now includestests/security)@test~/go/bin,.pdtm,.cargo,osmedeusstripped (toolless-runner emulation)~/Tools/resolvers.txt/resolvers_trusted.txtThe nine Slack cases and the DarkEye target guard are mutation-checked, not just green.