224 Commits

Author SHA1 Message Date
Dogan Can Bakir 9330f0186d Merge pull request #7414 from projectdiscovery/chore/deps-bump-and-govaluate-switch
chore(deps): bump pdsec modules + govaluate/aurora migration
2026-05-19 21:18:09 +03:00
Dogan Can Bakir 76bf0f3c16 Merge pull request #7393 from projectdiscovery/sdk-upload
feat(sdk): mirror -config, -report-config, -dashboard for SDK callers
2026-05-19 18:44:52 +03:00
Doğan Can Bakır 1ec64a3f95 chore(deps): bump pdsec modules; switch to projectdiscovery/govaluate and aurora v4
Bumps clistats, fastdialer, retryablehttp-go, dsl, networkpolicy,
ratelimit, sarif, utils, wappalyzergo, cdncheck. dsl v0.8.18 moves to
the projectdiscovery/govaluate fork, and utils v0.11.0 pulls aurora v4,
so the corresponding imports and type references are migrated.

Refs #7380.
2026-05-18 17:14:29 +03:00
Mzack9999 5675f513ea use local samba endpoint 2026-05-14 18:42:48 +02:00
shubhamrasal 609cf3daba refactor(sdk): replace goflags overlay with RuntimeConfig struct
WithConfigFile/Bytes now decode YAML directly into a typed RuntimeConfig
struct and apply it via MergeOptions(opts). The goflags-backed reflection
overlay had too much surface area (266-line flag inventory duplicate plus
a flag-default vs DefaultOptions diff) for the actual SDK use case, which
is accepting a known set of scan knobs from cloud-shipped YAML.

RuntimeConfig schema covers tags/severity filtering, headers/vars,
interactsh, socks5-proxy, plus rate-limit/bulk-size/concurrency/timeout/
retries/rate-limit-host. Scalar knobs use *int so omitted keys preserve
the engine's existing value.

Drops internal/runner/flags.go (266 lines) and lib/config_load.go (86
lines). Reverts internal/runner/runner.go to dev (no SetupPDCPUpload
export; SDK inlines its own PDCP wrap). Keeps the LoadReportingOptionsFromBytes
extract in internal/runner/options.go for WithReportingConfigFile/Bytes.
2026-05-12 18:29:24 +05:30
shubhamrasal f783605032 revert(sdk): keep CLI untouched, restore original PDCP disabled message
The BindOptionFlags refactor of readConfig() caused duplicate group
headers in `nuclei -h` (CLI-only flags appended new same-named groups
after the shared ones). Suppressing the disabled-message on the CLI
was also a behavior change.

Both are scope creep. This PR is for SDK additions, not CLI refactor.

- Revert cmd/nuclei/main.go to dev. `nuclei -h` byte-identical.
- Restore "Scan results upload to cloud is disabled." in SetupPDCPUpload.
- flags.go stays for SDK-only use via lib/config_load.go.
2026-05-12 17:43:36 +05:30
shubhamrasal 0fc90a6b87 docs(runner): tighten SetupPDCPUpload disabled-branch comment to one line 2026-05-12 16:25:47 +05:30
shubhamrasal f2c95ef887 fix(runner): suppress redundant "upload disabled" warning on default scans
SetupPDCPUpload returned a non-empty status string in the
upload-disabled branch, which displayExecutionInfo then logs as a
Warning on every nuclei run that doesn't request -dashboard. That
also suppresses the friendlier dashboard hint Info line.

Return empty for the default-disabled case so the Info hint fires.
The latent issue predates this PR; CodeRabbit surfaced it on the
refactor.
2026-05-12 16:21:52 +05:30
shubhamrasal 642887e985 fix(runner): restore nolint on deprecated ZTLS flag binding
Extracted into flags.go from cmd/nuclei/main.go but the trailing
//nolint:all was dropped — golangci-lint trips on SA1019 in the
SDK-shared path. Restoring matches the dev branch line.
2026-05-12 14:55:17 +05:30
shubhamrasal 44c63a84d8 docs(sdk): trim PR comments, fix two review nits
- L1: sdk_private.go references SetupPDCPUpload (was lowercase).
- L2: config_test.go test comment describes how tmpEngine is constructed
  rather than incorrectly claiming "inherits from parent".
- Trim godocs and inline comments across the PR — drop restated WHAT,
  keep WHY and limitations.
2026-05-12 14:41:25 +05:30
shubhamrasal db156370c4 refactor(sdk): dedupe config loaders, drop threadSafePerScan mode
- Inline (*Runner).setupPDCPUpload — wrapper just delegated to the
  package-level SetupPDCPUpload. Call site inlines the three lines.
- Dedupe reporting-config file load: WithReportingConfigFile and
  loadImplicitReportingConfig share loadReportingConfigFromPath.
- Move config-overlay/load helpers (newConfigFlagSet, overlayConfigFromFile,
  applyOverlay, loadReportingConfigFromPath, loadImplicitReportingConfig)
  out of lib/config.go into lib/config_load.go.
- Drop threadSafePerScan engine mode and isThreadSafe helper. The four
  new With* options no longer gate per-scan use. pd-agent doesn't enter
  thread-safe mode; reintroducing the gate ships as a follow-up PR with
  its own scope.
2026-05-12 14:01:30 +05:30
shubhamrasal f3308fa1f3 feat(sdk): mirror -config, -report-config, -dashboard for SDK callers
SDK consumers had to rebuild types.Options by hand or shell out to the
CLI to get config-file parity. This shares BindOptionFlags,
LoadReportingOptionsFromBytes, ApplyExporterOptionsFromTypes, and
SetupPDCPUpload between cmd/nuclei and lib/ so both paths produce
identical engine state.

WithConfigFile/Bytes apply only YAML-set fields (reflection diff against
goflags defaults) so prior With* and DefaultOptions() values survive
YAML that omits them. Per-scan ExecuteNucleiWithOpts rejects these
options via a new threadSafePerScan mode, matching the pattern for
options that only make sense at construction.
2026-05-11 18:54:48 +05:30
Dwi Siswanto ce50479fc3 test(js): add goexec tests
Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-05-11 03:58:16 +07:00
Dwi Siswanto 3e996ebc45 test(workflow): added unit tests for parent-to-child
propagation, sibling isolation, and same-step
refresh, plus an integration workflow test
covering the race path.

Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-05-08 02:59:10 +07:00
ChrisJr404 1f8dd03127 fix(runner): write unsigned-templates WRN to stderr
* fix(runner): write unsigned-templates WRN to stderr (#7314)

`r.Logger.Print()` is `gologger`'s LevelSilent helper — it bypasses
level filtering but routes to stdout. Using it for the unsigned-
templates "Use with caution" warning means the line collides with the
JSON / JSONL stream when the user runs with `-j`/`-jsonl`, breaking
downstream `jq` and any other consumer that expects clean JSON on
stdout.

Write the warning to os.Stderr directly (keeping the colorized [WRN]
prefix and the always-emitted semantics) so the JSON output stays
parseable. The integration suite's filterUnsignedTemplatesWarnings
helper already strips this message defensively, so no test churn is
needed.

Closes #7314.

* address review: route remaining Print() WRN sites to stderr too

CodeRabbit flagged that the rate-limit-deprecated, concurrency-vs-max-host-error,
and DAST-no-templates warnings have the same stdout-pollution problem the
unsigned-templates one had. Same fix — fmt.Fprintf to os.Stderr — applied to all
three so the stdout stream stays clean for -j / -jsonl consumers regardless of
which warning fires.

* address review: use Logger.Warning() per @dwisiswant0

Per the review on #7371, swap the four `fmt.Fprintf(os.Stderr, ...)`
WRN sites for `r.Logger.Warning().Msgf(...)`. Same stderr destination,
no duplicated WRN-prefix logic, follows the existing pattern used
across the runner package.

---------

Co-authored-by: Chris (ChrisJr404) <11917633+ChrisJr404@users.noreply.github.com>
2026-05-07 05:25:04 +07:00
Mzack9999 54f002db4a Merge pull request #7356 from projectdiscovery/feat-impacket
Adding impacket integration
2026-05-06 17:57:02 +05:30
Doğan Can Bakır 7926e22174 fix lint 2026-05-06 12:34:01 +03:00
Dwi Siswanto f893b6c0cb refactor: native tests (#7307)
Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-04-15 05:27:07 +07:00
Mzack9999 ab0199b410 fixing flow with auth 2026-03-24 21:57:03 +01:00
Harshada Gawas 658df54f48 feat: add honeypot detection to reduce scan noise (#6403) 2026-03-20 14:05:21 +05:30
Hussain Alsaibai 9caa62ebd5 fix: resolve auth secret file race condition using sync.Once (#6976)
This commit fixes a race condition where templates start executing before
the secret file's login flow completes when using -secret-file flag.

Changes:
- pkg/authprovider/authx/dynamic.go: Replace atomic.Bool-based synchronization
  with sync.Once to ensure fetch callback runs exactly once and all concurrent
  callers block until completion. This prevents the race where multiple goroutines
  would see fetching=true and return early with nil error before secrets were ready.

- internal/runner/runner.go: Always prefetch secrets when AuthProvider exists,
  removing the PreFetchSecrets flag check. This ensures authentication completes
  before scanning starts regardless of flag settings.

- lib/sdk_private.go: Same change as runner.go for SDK mode consistency.

- pkg/authprovider/file_test.go: Add test for concurrent dynamic secret access
  to verify fetch happens exactly once and all workers get authenticated.

- pkg/authprovider/authx/dynamic_test.go: Add concurrent fetch tests to verify
  proper synchronization behavior.

Fixes #6592

Co-authored-by: Mzack9999 <mzack9999@protonmail.com>
2026-03-20 01:16:28 +01:00
Mzack9999 f480e863c1 Merge pull request #7254 from Gengyscan/feat/pdf-export
feat(reporting): add PDF export option for scan results
2026-03-20 00:09:49 +01:00
Gengyscan 42b7a11f2c feat(reporting): add PDF export option for scan results 2026-03-17 14:58:40 +01:00
leo 63e5492ce3 ci: integrate typos spell checker into CI workflow
Add the crate-ci/typos GitHub Action to automatically catch spelling
errors in future PRs. This includes:

- New `.github/workflows/typos.yaml` workflow that runs on pushes to
  dev, pull requests, and manual dispatch
- `_typos.toml` configuration to suppress false positives from
  non-English READMEs, test fixtures, certificate data, CLI flag
  short names, and intentional identifiers
- Fix genuine typos found by the tool:
  - `PostReuestsHandlerRequest` -> `PostRequestsHandlerRequest`
  - `fiter` -> `filter`
  - `thant` -> `that`
  - `seperate` -> `separate`
  - `ExludedDastTmplStats` -> `ExcludedDastTmplStats`
  - `splitted` -> `split` (local variables)
  - `formated` -> `formatted` (local variables)
  - Rename `worflow_loader.go` -> `workflow_loader.go`

Fixes #6532
2026-03-08 22:11:26 -04:00
Dwi Siswanto 18b4981ca7 perf(runner): using a fastpath for tag listing (#7143)
Uses metadata caching via catalog index to reduce
runtime overhead.

Add `(*Store).LoadTemplateTags` for efficient tag
aggregation.

Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-03-07 13:14:24 +07:00
Dwi Siswanto b53ec96e99 fix(runner): use Print instead to listAvailableStoreTags
Tag listing (`-tgl`) output was moved to debug log
level, making it invisible during normal runs.
Restore tag output to default log level (Print)
for better usability.

Fixes #7142

Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-03-07 12:40:52 +07:00
Dogan Can Bakir 70ac8bf72b Merge pull request #7018 from projectdiscovery/dwisiswant0/chore/go-fix
chore: `golangci-lint run --fix ./...`
2026-03-04 16:39:33 +03:00
Dwi Siswanto c27c47420f chore: golangci-lint run --fix ./...
Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-02-26 22:03:14 +07:00
Doğan Can Bakır ef650defb6 Revert "fix(lint): use fmt.Fprintf for remaining WriteString(fmt.Sprintf(...)) calls"
This reverts commit 10421e9d00.
2026-02-26 14:45:25 +03:00
Doğan Can Bakır 10421e9d00 fix(lint): use fmt.Fprintf for remaining WriteString(fmt.Sprintf(...)) calls 2026-02-25 15:34:45 +03:00
bimakw 75525ed431 fix(loader): replace panic with error handling in template loader
Replace panic with proper error return when dialers are missing,
allowing callers to handle the situation gracefully.

Changes:
- Modify LoadTemplatesWithTags to return ([]*templates.Template, error)
- Modify LoadTemplates to return ([]*templates.Template, error)
- Modify Load to return error
- Replace panic("dialers with executionId...") with fmt.Errorf
- Replace panic("could not create wait group") with fmt.Errorf
- Update all callers to handle the new error return

Callers updated:
- internal/runner/lazy.go
- internal/runner/runner.go
- internal/server/nuclei_sdk.go
- lib/multi.go
- lib/sdk.go
- cmd/integration-test/library.go
- pkg/protocols/common/automaticscan/util.go
- pkg/catalog/loader/loader_bench_test.go

Fixes #6674
2026-02-06 17:10:21 +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
Dogan Can Bakir 528caa8831 Merge pull request #6542 from roiswd/feat-openapi-direct-fuzzing
feat(openapi/swagger): direct fuzzing using target url
2025-11-23 23:35:30 +09:00
Mzack9999 141f34a8ae Merge pull request #6610 from projectdiscovery/feat-result-upload
allow custom id for upload
2025-11-15 21:34:32 +05:30
Mzack9999 3c0b84b137 using clone options for auth store 2025-11-01 20:07:02 +04:00
Dwi Siswanto d2ae3521cc refactor(disk): templates catalog (#5914)
* refactor(disk): templates catalog

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

* feat(disk): drying err

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

* feat(disk): simplify `DiskCatalog.OpenFile` method

since `BackwardsCompatiblePaths` func is already
deprecated.

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

* test: update functional test cases

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

* feat: reuse error

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

* fix(disk): handle glob errors consistently

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

* fix(disk): use forward slashes for fs.FS path ops

to fix Windows compat.

The io/fs package requires forward slashes ("/")
as path separators regardless of the OS. Using
[filepath.Separator] or [os.PathSeparator] breaks
[fs.Open] and [fs.Glob] ops on Windows where the
separator is backslash ("\").

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

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-10-24 07:31:35 +07:00
tvroi 1684f4143e fix (openapi/swagger): improve error handling and tmpDir cleanup 2025-10-20 18:36:17 +07:00
tvroi c3750be380 feat(openapi/swagger): direct fuzzing using target url 2025-10-19 15:33:31 +07:00
Matej Smycka 427007cf5d fix: Implement coderabbit suggestion 2025-10-15 10:41:41 +02:00
Matej Smycka cd41cb9f4d feat: template list alphabetical order 2025-10-15 09:39:33 +02:00
Mzack9999 089e2a4ee0 centralizing ratelimiter logic 2025-09-12 17:46:42 +02:00
Tarun Koyalwar 19247ae74b Path-Based Fuzzing SQL fix (#6400)
* setup claude

* migrate to using errkit

* fix unused imports + lint errors

* update settings.json

* fix url encoding issue

* fix lint error

* fix the path fuzzing component

* fix lint error
2025-08-25 13:36:58 +05:30
Sandeep Singh b4644af80a Lint + test fixes after utils dep update (#6393)
* fix: remove undefined errorutil.ShowStackTrace

* feat: add make lint support and integrate with test

* refactor: migrate errorutil to errkit across codebase

- Replace deprecated errorutil with modern errkit
- Convert error declarations from var to func for better compatibility
- Fix all SA1019 deprecation warnings
- Maintain error chain support and stack traces

* fix: improve DNS test reliability using Google DNS

- Configure test to use Google DNS (8.8.8.8) for stability
- Fix nil pointer issue in DNS client initialization
- Keep production defaults unchanged

* fixing logic

* removing unwanted branches in makefile

---------

Co-authored-by: Mzack9999 <mzack9999@protonmail.com>
2025-08-20 05:28:23 +05:30
Dogan Can Bakir 44eeb5a60b enable templates for template listing and displaying (#6343) 2025-08-17 01:50:22 +05:30
Ice3man 1b6ae44bb7 Merge branch 'dev' of https://github.com/projectdiscovery/nuclei into loading-performance-improvements-v2 2025-08-06 01:57:41 +05:30
Ice3man 5ba21e272a feat: loading templates performance improvements 2025-08-02 15:58:18 +05:30
HD Moore f26996cb89 Remove singletons from Nuclei engine (continuation of #6210) (#6296)
* introducing execution id

* wip

* .

* adding separate execution context id

* lint

* vet

* fixing pg dialers

* test ignore

* fixing loader FD limit

* test

* fd fix

* wip: remove CloseProcesses() from dev merge

* wip: fix merge issue

* protocolstate: stop memguarding on last dialer delete

* avoid data race in dialers.RawHTTPClient

* use shared logger and avoid race conditions

* use shared logger and avoid race conditions

* go mod

* patch executionId into compiled template cache

* clean up comment in Parse

* go mod update

* bump echarts

* address merge issues

* fix use of gologger

* switch cmd/nuclei to options.Logger

* address merge issues with go.mod

* go vet: address copy of lock with new Copy function

* fixing tests

* disable speed control

* fix nil ExecuterOptions

* removing deprecated code

* fixing result print

* default logger

* cli default logger

* filter warning from results

* fix performance test

* hardcoding path

* disable upload

* refactor(runner): uses `Warning` instead of `Print` for `pdcpUploadErrMsg`

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

* Revert "disable upload"

This reverts commit 114fbe6663.

* Revert "hardcoding path"

This reverts commit cf12ca800e.

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
Co-authored-by: Mzack9999 <mzack9999@protonmail.com>
Co-authored-by: Dwi Siswanto <git@dw1.io>
Co-authored-by: Dwi Siswanto <25837540+dwisiswant0@users.noreply.github.com>
2025-07-10 01:17:26 +05:30
Dwi Siswanto 87ed0b2bb9 build: bump all direct modules (#6290)
* chore: fix non-constant fmt string in call

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

* build: bump all direct modules

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

* chore(hosterrorscache): update import path

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

* fix(charts): break changes

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

* build: pinned `github.com/zmap/zcrypto` to v0.0.0-20240512203510-0fef58d9a9db

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

* chore: golangci-lint auto fixes

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

* chore: satisfy lints

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

* build: migrate `github.com/xanzy/go-gitlab` => `gitlab.com/gitlab-org/api/client-go`

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

* feat(json): update build constraints

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

* chore: dont panicking on close err

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

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-07-01 00:40:44 +07:00
Sandeep Singh 4801cc65ef feat: fixed max-host-error blocking + progress mismatch + misc (#6193)
* feat: fixed max-host-error blocking wrong port for template with error

* feat: log total results with time taken at end of execution

* bugfix: skip non-executed requests with progress in flow protocol

* feat: fixed request calculation in http protocol for progress

* misc adjustments

---------

Co-authored-by: Ice3man <nizamulrana@gmail.com>
2025-05-07 17:22:15 +05:30
Dogan Can Bakir c4c1496ef8 print verbose output in case of -duc (#6195)
* print verbose output in case of -duc

* minor
2025-04-28 17:04:33 +05:30