Commit Graph

759 Commits

Author SHA1 Message Date
Dwi Siswanto
f7f34e80a1 fix(http): race condition regression
The `race` condition directive was broken due to
a strict dependency on `threads > 0` for parallel
execution, causing templates with `race` directive
enabled but no explicit threads to fall back to
seq execution.

This regression was introduced in v3.2.0 (#4868),
which restricted parallel execution to only when
`payloads` were present.

Fixes #5713 to allow race conditions even w/o
explicit `payloads`, and add a default thread
count when race is enabled but threads is 0.

Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-01-03 21:58:27 +07:00
Mzack9999
dbeebdaa1d adding telnet login + crypto (#6419)
* adding telnet login + crypto

* smbauth lib porting + ntlm parsing over telnet

* gen lib

* adding telnet test

* adding breakout after max iterations

* fix(utils): broken pkt creation & impl `Create{LN,NT}Response`

Signed-off-by: Dwi Siswanto <git@dw1.io>

* chore(utils): satisfy lints

Signed-off-by: Dwi Siswanto <git@dw1.io>

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
Co-authored-by: Dwi Siswanto <git@dw1.io>
2026-01-02 06:28:46 +07:00
Mzack9999
891dffb4a1 feat(js): adds RSYNC module (#6410)
* adding min auth support

* adding unauth list modules + auth list files in module

* example

* adding rsync test

* bump go.mod

---------

Co-authored-by: Dwi Siswanto <git@dw1.io>
2026-01-01 02:02:48 +07:00
Dwi Siswanto
63aed75474 chore: bump version v3.6.2
Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-31 09:30:28 +07:00
Mzack9999
2d3168b79f Merge pull request #6735 from projectdiscovery/dwisiswant0/fix/js/mysql-panic-due-to-missing-executionId-in-ctx
fix(js): mysql panic due to missing `executionId` in ctx
2025-12-29 11:34:36 +04:00
Dwi Siswanto
592b689b15 Revert "chore(flow): disable global recover handler"
This reverts commit 0d4edc7841.
2025-12-26 14:24:47 +07:00
Dwi Siswanto
22b64b6702 fix(flow): segfault in hasMatchers
`hasMatchers` was not nil-safe when iterating over
the slice of operators. Check if the operator is
nil before accessing
`*operators.Operators.Matchers` to prevent a panic
when a protocol implementation returns a slice
containing a nil element.

This can happen when a request has no local
matchers/extractors but is processed in a flow
where global matchers are present.

Fixes #6738.

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-26 14:22:48 +07:00
Dwi Siswanto
8b3485abff test(flow): add util tests
Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-26 14:11:43 +07:00
Dwi Siswanto
0d4edc7841 chore(flow): disable global recover handler
Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-26 13:49:00 +07:00
Dwi Siswanto
49309b4ac8 chore(js): no staticcheck lint
Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-26 06:06:47 +07:00
Dwi Siswanto
22469bdc2f chore(js): update memoized functions
Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-26 01:08:06 +07:00
Dwi Siswanto
0eb87c2621 fix(js): mysql panic due to missing executionId in ctx
The `connectWithDSN` func used `db.Exec()` which
implicitly uses `context.Background()`[1]. This
caused the registered "nucleitcp" dialer
callback to receive a ctx missing the
`executionId`, leading to a panic during type
assertion.

Refactor `connectWithDSN` to accept `executionId`
explicitly and use it to create a `context` for
`db.PingContext()` (yeah, instead of `db.Exec()`).
And, add a defensive check in the dialer callback
to handle nil values gracefully.

Fixes #6733 regression introduced in #6296.

[1]: "Exec uses `context.Background` internally" -
     https://pkg.go.dev/database/sql#DB.Exec.

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-25 17:16:49 +07:00
Mzack9999
5d79201299 fix(js): incorrect postgres exec call signature (#6731)
Make sure postgres Exec/ExecContext are invoked with the correct
argument order, preventing context from being passed as the query.

* fixing pg syntax

* adding test
2025-12-24 03:20:50 +07:00
Dwi Siswanto
0c125e2224 test(generators): update maps & options benchmarks
Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-20 01:02:16 +07:00
Dwi Siswanto
0ab06cc4bf test: add maps, options, variables bench
Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-20 00:56:07 +07:00
Dwi Siswanto
bb79a061bc perf(generators): optimize MergeMaps to reduce allocs
`MergeMaps` accounts for 11.41% of allocs (13.8
GB) in clusterbomb mode. With 1,305 combinations
per target, this function is called millions of
times in the hot path.

RCA:
* Request generator calls `MergeMaps` with single
  arg on every payload combination, incurring
  variadic overhead.
* Build request merges same maps multiple times
  per request.
* `BuildPayloadFromOptions` recomputes static CLI
  options on every call.
* Variables calls `MergeMaps` $$2×N$$ times per
  variable evaluation (once in loop, once in
  `evaluateVariableValue`)

Changes:

Core optimizations in maps.go:
* Pre-size merged map to avoid rehashing (30-40%
  reduction)
* Add `CopyMap` for efficient single-map copy
  without variadic overhead.
* Add `MergeMapsInto` for in-place mutation when
  caller owns destination.

Hot path fixes:
* Replace `MergeMaps(r.currentPayloads)` with
  `CopyMap(r.currentPayloads)` to eliminates
  allocation on every combination iteration.
* Pre-allocate combined map once, extend in-place
  during `ForEach` loop instead of creating new
  map per variable (eliminates $$2×N$$ allocations
  per request).

Caching with concurrency safety:
* Cache `BuildPayloadFromOptions` computation in
  `sync.Map` keyed by `types.Options` ptr, but
  return copy to prevent concurrent modification.
* Cost: shallow copy of ~10-20 entries vs. full
  merge of vars + env (85-90% savings in typical
  case)
* Clear cache in `closeInternal()` to prevent
  memory leaks when SDK instances are created or
  destroyed.

Estimated impact: 40-60% reduction in `MergeMaps`
allocations (5.5-8.3 GB savings from original
13.8 GB). Safe for concurrent execution and SDK
usage with multiple instances.

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-19 20:19:43 +07:00
Ice3man
d48c2c38fa feat(trackers): add site-url to optionally provide jira server URL for oauth (#6716)
* feat: add site-url to optionally provide jira server URL for oauth

* chore(cmd): add `site-url` config option

Adds optional `site-url` field to JIRA issue
tracker configuration for specifying browsable URL
when it differs from the API endpoint. This is
particularly useful for OAuth-based JIRA Cloud
integrations where `issue.Self` contains
"api.atlassian.com" instead of the user-facing
domain.

Signed-off-by: Dwi Siswanto <git@dw1.io>

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
Co-authored-by: Dwi Siswanto <git@dw1.io>
2025-12-18 23:47:45 +07:00
Mzack9999
c80ac99a34 Merge pull request #6713 from projectdiscovery/dwisiswant0/feat/enable-TLS-session-cache-for-client-pool
feat: enable TLS session cache for client pool
2025-12-18 14:00:58 +04:00
Mzack9999
2d4459d050 Merge pull request #6712 from projectdiscovery/dwisiswant0/fix/trackers/add-gitlab-paginated-dup-issue-search
fix(trackers): add gitlab paginated dup issue search
2025-12-18 13:55:59 +04:00
Dwi Siswanto
e3d32584ff feat: enable TLS session cache for client pool
This patch enables TLS session resumption by
setting a shared LRU session cache
(`ClientSessionCache`) in all HTTP client TLS
configs. This reduces handshake overhead and CPU
usage for repeated conns to the same host,
improving throughput and efficiency in
clusterbomb/pitchfork modes.

This applied to HTTP-request-based and headless-
request-based protocols.

No runtime/compatibility impact.

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-18 05:39:02 +07:00
Dwi Siswanto
39a07ca15e fix(trackers): add gitlab paginated dup issue search
with configurable limits

This patch fixes duplicate issue detection for
GitLab trackers by implementing paginated search
with configurable page size and max pages. Adds
`duplicate-issue-page-size` and
`duplicate-issue-max-pages` options to the config.

Fixes #6711.

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-18 00:29:38 +07:00
Leon Jacobs
a7df69749e fix(trackers): paginate gitea to find all issues when searching for duplicates (#6707)
* (fix) paginate to find all issues when searching for duplicates

* (feat) add configurable limits for perpage and total pages
2025-12-18 00:26:19 +07:00
Dwi Siswanto
746a05dac5 fix(javascript): restore exec for templates w/o Port arg (#6709)
Restore backwards compat for JavaScript protocol
templates that omit the `Port` argument.
Regression was introduced in f4f2e9f2, which
removed the fallback for empty `Port` in
`(*Request).ExecuteWithResults`, causing templates
without `Port` to be silently skipped.

Now, if no `Port` is specified, the engine
executes the JavaScript block using the target
URL's port.

Fixes #6708.

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-17 22:07:14 +07:00
Dwi Siswanto
b3706070ab chore: bump version v3.6.1
Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-16 03:41:05 +07:00
Mzack9999
c73906b405 Merge pull request #6691 from stringscut/dev
chore: execute goimports to format the code
2025-12-15 14:37:56 +04:00
Mzack9999
8891d70d42 Merge pull request #6687 from projectdiscovery/dwisiswant0/fix/headless/data-race-when-reading-page-history
fix(headless): data race when reading page history
2025-12-15 13:13:23 +04:00
Mzack9999
b49beef554 improving update template + empty folder edge case (#6573)
* improving update template + empty folder edge case

* lint

* index cleanup

* cleaning path

* win fix

* fix

* chore(cmd): rm templates

Signed-off-by: Dwi Siswanto <git@dw1.io>

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
Co-authored-by: Dwi Siswanto <git@dw1.io>
2025-12-14 23:35:22 +07:00
Dwi Siswanto
cf3b5bf449 fix: body loss on retries/redirects in remaining paths (#6693)
Continue the fix from #6666 by converting
remaining direct Body assignments to use setter
methods:

* pkg/fuzz/component/body.go:139: use
  `SetBodyReader()` in transfer-encoding path.
* pkg/protocols/http/request.go:694: use
  `SetBodyString()` in fuzz component `Rebuild()`.

Fixes #6692.

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-13 22:37:39 +07:00
Dwi Siswanto
b63a23bd5c fix(http): pass dynamicValues to EvaluateWithInteractsh (#6685)
* fix(http): pass `dynamicValues` to `EvaluateWithInteractsh`

When `LazyEval` is true (triggered by `variables`
containing `BaseURL`, `Hostname`,
`interactsh-url`, etc.), variable expressions are not
eval'ed during YAML parsing & remain as raw exprs
like "{{rand_base(5)}}".

At request build time, `EvaluateWithInteractsh()`
checks if a variable already has a value in the
passed map before re-evaluating its expression.
But, `dynamicValues` (which contains the template
context with previously eval'ed values) was not
being passed, causing exprs like `rand_*` to be
re-evaluated on each request, producing different
values.

Fixes #6684 by including `dynamicValues` in the
map passed to `EvaluateWithInteractsh()`, so
variables evaluated in earlier requests retain
their values in subsequent requests.

Signed-off-by: Dwi Siswanto <git@dw1.io>

* chore(http): rm early eval in `(*Request).ExecuteWithResults()`

Signed-off-by: Dwi Siswanto <git@dw1.io>

* test: adds variables-threads-previous integration test

Signed-off-by: Dwi Siswanto <git@dw1.io>

* test: adds constants-with-threads integration test

Signed-off-by: Dwi Siswanto <git@dw1.io>

* test: adds race-with-variables integration test

Signed-off-by: Dwi Siswanto <git@dw1.io>

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-12 14:37:59 +07:00
stringscut
7fb1fe7bf2 chore: execute goimports to format the code
Signed-off-by: stringscut <stringscut@outlook.jp>
2025-12-12 15:10:22 +08:00
Dwi Siswanto
3e93996471 fix(headless): data race when reading page history
The `(*Page).HistoryData` was being read w/o
holding the mutex lock after
`(*Page).ExecuteActions()` returns, while the
background hijack goroutine could still be writing
to it via `(*Page).addToHistory()`.

Copy the first history item by value while holding
RLock to avoid racing with concurrent append ops.

Fixes #6686.

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-11 05:57:28 +07:00
Dwi Siswanto
8e535f625d fix(http): cache resp strings to reduce memory allocs (#6679)
Prev, `FullResponseString()`, `BodyString()`, and
`HeadersString()` were called multiple times per
HTTP response iteration, each call allocating a
new string copy of the response data.

For a 10MB response, this resulted in ~60MB of
redundant string allocs/response (6 calls x 10MB).

Cache the string representations once per `Fill()`
cycle and reuse them throughout the response
processing loop. This reduces allocs from 6 to 3
per response, cutting memory usage by ~50% for
response string handling.

Profiling showed these functions accounting for
~89% of heap allocs (5.7GB out of 6.17GB) during
large scans.

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-10 18:25:18 +07:00
Dwi Siswanto
df74ff3edf fix: enable all template types for template list/display (#6668)
* fix: enable all template types for template list/display

When using `-tl` or `-td`, explicitly enable all
template types (`code`, `file`, `self-contained`,
`global-matchers`, `headless`, `dast`) to ensure
all templates are listed w/o requiring extra flags.

Signed-off-by: Dwi Siswanto <git@dw1.io>

* chore: cleanup messy messy messy

Signed-off-by: Dwi Siswanto <git@dw1.io>

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-08 14:26:24 +07:00
copilot-swe-agent[bot]
3d60c9fdbe Fix all documentation errors
Co-authored-by: AaryanBansal-dev <192687837+AaryanBansal-dev@users.noreply.github.com>
2025-12-07 05:51:53 +00:00
Dwi Siswanto
56b6d42723 fix(http): lost request body on retries & redirects (#6666)
* fix(http): lost request body on retries & redirects

Updates the HTTP protocol to use
`(*retryablehttp.Request).SetBodyString` instead
of direct `Body` assignment.

This fixes #6665 where the request body was
dropped during retries or 307/308 redirects
because `GetBody` was not being populated.

Thanks to @zzyjsj for reporting the bug in the
upstream dependency and the hints!

Signed-off-by: Dwi Siswanto <git@dw1.io>

* empty: add co-author

Co-authored-by: zzy <zzyjsj@users.noreply.github.com>
Signed-off-by: Dwi Siswanto <git@dw1.io>

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
Co-authored-by: zzy <zzyjsj@users.noreply.github.com>
2025-12-06 16:27:57 +07:00
Mzack9999
0e498bcd76 improve volume name handling 2025-12-06 11:19:27 +04:00
Dwi Siswanto
f6af5216ba test(config): fix abs path on Windows plat
Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-06 02:27:50 +07:00
Dwi Siswanto
d9452011fc fix(config): template exclusion logic for paths with reserved names
Prev, the template exclusion logic checked if the
full file path contained any of the known
miscellaneous directory names (e.g., helpers,
.git). This caused false positives when valid
templates were stored in paths where a parent
directory matched one of these names (e.g.,
/path/to/somewhere/that/has/helpers/dir/name/).

This commit introduces `IsTemplateWithRoot`, which
checks for excluded directories relative to a
provided root directory. It splits the relative
path into components.

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-06 00:31:29 +07:00
Dwi Siswanto
2b9c985818 fix(lib): segfault when init engine with EnableHeadlessWithOpts (#6602)
* fix(lib): segfault when init engine with `EnableHeadlessWithOpts`

The panic was caused by attempting to log a
sandbox warning before the logger was initialized.

RCA:
* SDK option funcs were exec'd before logger init.
* `EnableHeadlessWithOpts()` attempted to create
  browser instance & log warnings during the
  config phase.
* `Logger` was only init'd later in `init()`
  phase.
* This caused nil pointer dereference when
  `MustDisableSandbox()` returned true (root on
  Linux/Unix or Windows).

Changes:
* Init `Logger` in `types.DefaultOptions()` to
  ensure it's always available before any option
  functions execute.
* Init `Logger` field in both
  `NewNucleiEngineCtx()` and
  `NewThreadSafeNucleiEngineCtx()` from
  `defaultOptions.Logger`.
* Move browser instance creation from
  `EnableHeadlessWithOpts()` to the `init()` phase
  where `Logger` is guaranteed to be available.
* Simplify logger sync logic in `init()` to only
  update if changed by `WithLogger` option.
* Add test case to verify headless initialization
  works without panic.

The fix maintains backward compatibility while
make sure the logger is always available when
needed by any SDK option function.

Fixes #6601.

Signed-off-by: Dwi Siswanto <git@dw1.io>

* build(make): adds `-timeout 30m -count 1` GOFLAGS in `test` cmd

Signed-off-by: Dwi Siswanto <git@dw1.io>

* Revert "fix(lib): segfault when init engine with `EnableHeadlessWithOpts`"

let see if this pass flaky test.

This reverts commit 63fcb6a1cbe7a4db7a78be766affc70eb237e57e.

* test(engine): let see if this pass flaky test

Signed-off-by: Dwi Siswanto <git@dw1.io>

* Revert "Revert "fix(lib): segfault when init engine with `EnableHeadlessWithOpts`""

This reverts commit 62b4223803ccb1e93593e2e08e39923d76aa20b1.

* test(engine): increase `TestActionNavigate` timeout

Signed-off-by: Dwi Siswanto <git@dw1.io>

* Revert "test(engine): let see if this pass flaky test"

This reverts commit d27cd985cff1b06aa1965ea11f8aa32f00778ab5.

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-05 21:55:41 +07:00
Didier Durand
6384399375 Merge remote-tracking branch 'origin/fix-typos-b' into fix-typos-b 2025-12-05 07:36:42 +01:00
Didier Durand
c994bba249 [Doc] fixing adding errors on classifier spelling as per CodeRabbit suggestions 2025-12-05 07:36:15 +01:00
Didier Durand
9eede47dbd Update pkg/js/CONTRIBUTE.md
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-05 07:32:39 +01:00
Didier Durand
7f56dc27c1 Update pkg/protocols/http/http.go
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-05 07:32:13 +01:00
Didier Durand
3edd5d956f [Doc] reverting 1 incorrect change 2025-12-05 07:22:31 +01:00
Didier Durand
3447f09c9f [Doc] Fixing typos in various files 2025-12-05 07:17:14 +01:00
Didier Durand
9ec2e995d0 docs: fixing typos in multiple files (#6653)
* [Doc] Fixing typos in multiple files

* [Doc] Fixing js.go based in review suggestion
2025-12-05 12:29:19 +07:00
Dwi Siswanto
f181a691b2 chore: bump version
Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-04 22:20:38 +07:00
Dwi Siswanto
9102f333a9 feat(loader): implement persistent metadata cache (#6630)
* feat(loader): implement persistent metadata cache

for template filtering optimization.

Introduce a new template metadata indexing system
with persistent caching to dramatically improve
template loading perf when filters are applied.
The implementation adds a new index pkg that
caches lightweight template metadata (ID, tags,
authors, severity, .etc) and enables filtering
templates before expensive YAML parsing occurs.

The index uses an in-memory LRU cache backed by
`otter` pkg for efficient memory management with
adaptive sizing based on entry weight, defaulting
to approx. 40MB for 50K templates.
Metadata is persisted to disk using gob encoding
at "~/.cache/nuclei/index.gob" with atomic writes
to prevent corruption. The cache automatically
invalidates stale entries using `ModTime` to
detect file modifications, ensuring metadata
freshness w/o manual intervention.

Filtering has been refactored from the previous
`TagFilter` and `PathFilter` approach into a
unified `index.Filter` type that handles all basic
filtering ops including severity, authors, tags,
template IDs with wildcard support, protocol
types, and path-based inclusion and exclusion. The
filter implements OR logic within each field type
and AND logic across different field types, with
exclusion filters taking precedence over inclusion
filters and forced inclusion via
`IncludeTemplates` and `IncludeTags` overriding
exclusions.

The `loader` integration creates an index filter
from store configuration via `buildIndexFilter`
and manages the cache lifecycle through
`loadTemplatesIndex` and `saveTemplatesIndex`
methods. When `LoadTemplatesOnlyMetadata` or
`LoadTemplatesWithTags` is called, the system
first checks the metadata cache for each template
path. If cached metadata exists and passes
validation, the filter is applied directly against
the metadata without parsing. Only templates
matching the filter criteria proceed to full YAML
parsing, resulting in significant performance
gains.

Advanced filtering via "-tc" flag
(`IncludeConditions`) still requires template
parsing as these are expression-based filters that
cannot be evaluated from metadata alone. The
`TagFilter` has been simplified to handle only
`IncludeConditions` while all other filtering ops
are delegated to the index-based filtering system.

Cache management is fully automatic with no user
configuration required. The cache gracefully
handles errors by logging warnings & falling back
to normal op w/o caching. Cache files use schema
versioning to invalidate incompatible cache
formats across nuclei updates (well, specifically
`Index` and `Metadata` changes).

This optimization particularly benefits repeated
scans with the same filters, CI/CD pipelines
running nuclei regularly, development and testing
workflows with frequent template loading, and any
scenario with large template collections where
filtering would exclude most templates.

* test(loader): adds `BenchmarkLoadTemplates{,OnlyMetadata}` benchs

Signed-off-by: Dwi Siswanto <git@dw1.io>

* ci: cache nuclei-templates index

Signed-off-by: Dwi Siswanto <git@dw1.io>

* chore(index): satisfy lints

Signed-off-by: Dwi Siswanto <git@dw1.io>

* fix(index): correct metadata filter logic

for proper template matching.

The `filter.matchesIncludes()` was using OR logic
across different filter types, causing incorrect
template matching. Additionally, ID matching was
case-sensitive, failing to match patterns like
'CVE-2021-*'.

The filter now correctly implements: (author1 OR
author2) AND (tag1 OR tag2) AND (severity1 OR
severity2) - using OR within each filter type and
AND across different types.

Signed-off-by: Dwi Siswanto <git@dw1.io>

* test(index): resolve test timing issue

in CI environments.

Some test was failing in CI due to filesystem
timestamp resolution limitations. On filesystems
with 1s ModTime granularity (common in CI),
modifying a file immediately after capturing its
timestamp resulted in identical ModTime values,
causing IsValid() to incorrectly return true.

Signed-off-by: Dwi Siswanto <git@dw1.io>

* ci: cache nuclei with composite action

Signed-off-by: Dwi Siswanto <git@dw1.io>

* fix(index): file locking issue on Windows

during cache save/load.

Explicitly close file handles before performing
rename/remove ops in `Save` and `Load` methods.

* In `Save`, close temp file before rename.
* In `Load`, close file before remove during error
  handling/version mismatch.

Signed-off-by: Dwi Siswanto <git@dw1.io>

* test(index): flaky index tests on Windows

Fix path separator mismatch in `TestCacheSize`
and `TestCachePersistenceWithLargeDataset` by
using `filepath.Join` consistently instead of
hardcoded forward slashes.

Signed-off-by: Dwi Siswanto <git@dw1.io>

* test(cmd): init logger to prevent nil pointer deref

The integration tests were panicking with a nil
pointer dereference in `pkg/catalog/loader`
because the logger was not init'ed.

When `store.saveMetadataIndexOnce` attempted to
log the result of the metadata cache op, it
dereferenced the nil logger, causing a crash.

Signed-off-by: Dwi Siswanto <git@dw1.io>

* fix(loader): resolve include/exclude paths

for metadata cache filter.

The `indexFilter` was previously init'ed using raw
relative paths from the config for
`IncludeTemplates` and `ExcludeTemplates`.
But the persistent metadata cache stores templates
using their absolute paths. This mismatch caused
the `matchesPath` check to fail, leading to
templates being incorrectly excluded even when
explicitly included via flags
(e.g., "-include-templates
loader/excluded-template.yaml").

This commit updates `buildIndexFilter` to resolve
these paths to their absolute versions using
`store.config.Catalog.GetTemplatesPath` before
creating the filter, ensuring consistent path
matching against the metadata cache.

Signed-off-by: Dwi Siswanto <git@dw1.io>

* feat(index): adds `NewMetadataFromTemplate` func

Signed-off-by: Dwi Siswanto <git@dw1.io>

* refactor(index): return metadata when `(*Index).cache` is nil

Signed-off-by: Dwi Siswanto <git@dw1.io>

* refactor(loader): restore pre‑index behavior semantics

Signed-off-by: Dwi Siswanto <git@dw1.io>

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-04 21:35:51 +07:00
dependabot[bot]
7e151de8a3 chore: bump PD modules & update httputil calls (#6629)
* chore(deps): bump the modules group across 1 directory with 11 updates

Bumps the modules group with 11 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [github.com/projectdiscovery/fastdialer](https://github.com/projectdiscovery/fastdialer) | `0.4.16` | `0.4.17` |
| [github.com/projectdiscovery/hmap](https://github.com/projectdiscovery/hmap) | `0.0.95` | `0.0.96` |
| [github.com/projectdiscovery/retryabledns](https://github.com/projectdiscovery/retryabledns) | `1.0.108` | `1.0.109` |
| [github.com/projectdiscovery/retryablehttp-go](https://github.com/projectdiscovery/retryablehttp-go) | `1.0.131` | `1.0.132` |
| [github.com/projectdiscovery/gologger](https://github.com/projectdiscovery/gologger) | `1.1.60` | `1.1.61` |
| [github.com/projectdiscovery/networkpolicy](https://github.com/projectdiscovery/networkpolicy) | `0.1.28` | `0.1.29` |
| [github.com/projectdiscovery/tlsx](https://github.com/projectdiscovery/tlsx) | `1.2.1` | `1.2.2` |
| [github.com/projectdiscovery/useragent](https://github.com/projectdiscovery/useragent) | `0.0.102` | `0.0.103` |
| [github.com/projectdiscovery/utils](https://github.com/projectdiscovery/utils) | `0.6.1` | `0.7.1` |
| [github.com/projectdiscovery/wappalyzergo](https://github.com/projectdiscovery/wappalyzergo) | `0.2.55` | `0.2.56` |
| [github.com/projectdiscovery/cdncheck](https://github.com/projectdiscovery/cdncheck) | `1.2.10` | `1.2.11` |



Updates `github.com/projectdiscovery/fastdialer` from 0.4.16 to 0.4.17
- [Release notes](https://github.com/projectdiscovery/fastdialer/releases)
- [Commits](https://github.com/projectdiscovery/fastdialer/compare/v0.4.16...v0.4.17)

Updates `github.com/projectdiscovery/hmap` from 0.0.95 to 0.0.96
- [Release notes](https://github.com/projectdiscovery/hmap/releases)
- [Commits](https://github.com/projectdiscovery/hmap/compare/v0.0.95...v0.0.96)

Updates `github.com/projectdiscovery/retryabledns` from 1.0.108 to 1.0.109
- [Release notes](https://github.com/projectdiscovery/retryabledns/releases)
- [Commits](https://github.com/projectdiscovery/retryabledns/compare/v1.0.108...v1.0.109)

Updates `github.com/projectdiscovery/retryablehttp-go` from 1.0.131 to 1.0.132
- [Release notes](https://github.com/projectdiscovery/retryablehttp-go/releases)
- [Commits](https://github.com/projectdiscovery/retryablehttp-go/compare/v1.0.131...v1.0.132)

Updates `github.com/projectdiscovery/gologger` from 1.1.60 to 1.1.61
- [Release notes](https://github.com/projectdiscovery/gologger/releases)
- [Commits](https://github.com/projectdiscovery/gologger/compare/v1.1.60...v1.1.61)

Updates `github.com/projectdiscovery/networkpolicy` from 0.1.28 to 0.1.29
- [Release notes](https://github.com/projectdiscovery/networkpolicy/releases)
- [Commits](https://github.com/projectdiscovery/networkpolicy/compare/v0.1.28...v0.1.29)

Updates `github.com/projectdiscovery/tlsx` from 1.2.1 to 1.2.2
- [Release notes](https://github.com/projectdiscovery/tlsx/releases)
- [Changelog](https://github.com/projectdiscovery/tlsx/blob/main/.goreleaser.yml)
- [Commits](https://github.com/projectdiscovery/tlsx/compare/v1.2.1...v1.2.2)

Updates `github.com/projectdiscovery/useragent` from 0.0.102 to 0.0.103
- [Release notes](https://github.com/projectdiscovery/useragent/releases)
- [Commits](https://github.com/projectdiscovery/useragent/compare/v0.0.102...v0.0.103)

Updates `github.com/projectdiscovery/utils` from 0.6.1 to 0.7.1
- [Release notes](https://github.com/projectdiscovery/utils/releases)
- [Changelog](https://github.com/projectdiscovery/utils/blob/main/CHANGELOG.md)
- [Commits](https://github.com/projectdiscovery/utils/compare/v0.6.1...v0.7.1)

Updates `github.com/projectdiscovery/wappalyzergo` from 0.2.55 to 0.2.56
- [Release notes](https://github.com/projectdiscovery/wappalyzergo/releases)
- [Commits](https://github.com/projectdiscovery/wappalyzergo/compare/v0.2.55...v0.2.56)

Updates `github.com/projectdiscovery/cdncheck` from 1.2.10 to 1.2.11
- [Release notes](https://github.com/projectdiscovery/cdncheck/releases)
- [Changelog](https://github.com/projectdiscovery/cdncheck/blob/main/.goreleaser.yaml)
- [Commits](https://github.com/projectdiscovery/cdncheck/compare/v1.2.10...v1.2.11)

---
updated-dependencies:
- dependency-name: github.com/projectdiscovery/fastdialer
  dependency-version: 0.4.17
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: modules
- dependency-name: github.com/projectdiscovery/hmap
  dependency-version: 0.0.96
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: modules
- dependency-name: github.com/projectdiscovery/retryabledns
  dependency-version: 1.0.109
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: modules
- dependency-name: github.com/projectdiscovery/retryablehttp-go
  dependency-version: 1.0.132
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: modules
- dependency-name: github.com/projectdiscovery/gologger
  dependency-version: 1.1.61
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: modules
- dependency-name: github.com/projectdiscovery/networkpolicy
  dependency-version: 0.1.29
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: modules
- dependency-name: github.com/projectdiscovery/tlsx
  dependency-version: 1.2.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: modules
- dependency-name: github.com/projectdiscovery/useragent
  dependency-version: 0.0.103
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: modules
- dependency-name: github.com/projectdiscovery/utils
  dependency-version: 0.7.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: modules
- dependency-name: github.com/projectdiscovery/wappalyzergo
  dependency-version: 0.2.56
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: modules
- dependency-name: github.com/projectdiscovery/cdncheck
  dependency-version: 1.2.11
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: modules
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: update utils.httputil calls

Signed-off-by: Dwi Siswanto <git@dw1.io>

* chore(deps): bump github.com/projectdiscovery/utils => v0.7.3

Signed-off-by: Dwi Siswanto <git@dw1.io>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Dwi Siswanto <git@dw1.io>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dwi Siswanto <git@dw1.io>
2025-12-01 02:07:25 +07:00
ledigang
29977358d7 chore: omit unnecessary reassignment (#6622)
Signed-off-by: ledigang <shuangcui@msn.com>
2025-11-24 19:01:30 +07:00