Skip to content

Bug: Secrets not detected when %%(...)s appears before line containing password keyword #944

@matthewblock

Description

@matthewblock

I'm submitting a ...

[x] bug report

What is the current behavior?

For the following file, test.cfg, detect-secrets doesn't detect the keyword password, even with all filters disabled:

[section_1]
a = "hello world"
b = %%(c)s
password = "w209029jd029jaljsj092" # fake password

Removing any of the first three lines causes the secret to be detected:

detect-secrets scan \
  --disable-filter detect_secrets.filters.heuristic.is_indirect_reference \
  --disable-filter detect_secrets.filters.heuristic.is_likely_id_string \
  --disable-filter detect_secrets.filters.heuristic.is_sequential_string \
  --disable-filter detect_secrets.filters.heuristic.is_not_alphanumeric_string \
  --disable-filter detect_secrets.filters.allowlist.is_line_allowlisted \
  --disable-filter detect_secrets.filters.common.is_ignored_due_to_verification_policies \
  --disable-filter detect_secrets.filters.heuristic.is_lock_file \
  --disable-filter detect_secrets.filters.heuristic.is_potential_uuid \
  --disable-filter detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign \
  --disable-filter detect_secrets.filters.heuristic.is_swagger_file \
  --disable-filter detect_secrets.filters.heuristic.is_templated_secret \
  test.cfg

.cfg files are used in Airflow.

What is the expected behavior?

detect-secrets should flag the fourth line containing password via KeywordDetector plugin.

Please tell us about your environment:

detect-secrets Version: 1.5.0
Python Version: 3.12.11
OS Version: Debian GNU/Linux 12 (bookworm) via Docker

Other information

n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions