Skip to content

Reject explicitly missing config files instead of silently using defaults #3706

Closed

Description

@romanlutz

Is your feature request related to a problem? Please describe.

An explicitly supplied config path that does not exist is silently omitted, so a typo can leave the CLI using unintended defaults. Existing unit tests intentionally codify this behavior; this is a proposed safety/UX change, not a claim that current behavior is an untested regression.

Describe the solution you'd like

Raise a ConfigError for a missing explicitly supplied --config-file while keeping the auto-discovered default config optional. Update the tests that currently assert silent omission.

Describe alternatives you've considered, if relevant

Alternatively, emit a prominent warning, but failing fast is less likely to apply surprising server settings.

Additional context

Reproduction: pyrit_scan list-targets --config-file /does/not/exist.yaml --server-url http://127.0.0.1:18741 --auth-mode none exits 0 without mentioning the absent file. References: config reader, current tests.

Tested commit d3446e0, PyRIT 1.2.0.dev0, offline Linux scope; the current behavior is intentionally tested. Recovery evidence: files/evidence/round1/scan-invalid-args.txt; local path is not an attachment.

Additional reproduction details

This is the exact observed command: pyrit_scan list-targets --config-file /does/not/exist.yaml --server-url http://127.0.0.1:18741 --auth-mode none; it prints No targets found in registry. and exits 0. The optional local config shape is memory_db_type: in_memory, env_files: [], initializers: [], with loopback URL and auth_mode: none; no credentials are needed. Current tests intentionally preserve omission of nonexistent config paths.

Activity

  1. added
    help wanted
    on Oct 31, 2026
  2. SpinachDigital commented on Nov 1, 2026

    @SpinachDigital
    Contributor

    Taking this up — will open a PR shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions