Skip to content

ci(codeql): stop clear-text-logging false positives coming back each time a log line moves #2130

Closed

Description

@JarryShaw

CodeQL keeps re-raising the same py/clear-text-logging-sensitive-data false positive. Each time a PR moves one of the logger.debug lines in pcapkit/foundation/extraction.py, the alert comes back under a new number, so every dismissal is undone.

CodeQL's message is "logs sensitive data (secret)". No secret is involved: these are a capture's file name and stream.

Proposed: find which name or flow CodeQL's sensitive-data heuristic is matching, then fix it once rather than per alert. In order of preference:

  1. If the source is a misleading identifier, rename it.
  2. If not, add a CodeQL config whose query-filters exclude this one rule. The codeql-analysis.yml init step would point at that config.

In the meantime, #29 can be dismissed as a false positive, as #26 was.

Activity

  1. added
    ciPull requests that change CI or workflow configuration (ci: subject prefix)
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 24, 2026
  2. JarryShaw commented on Oct 24, 2026

    @JarryShaw
    OwnerAuthor

    Root cause, from main's SARIF (CodeQL 2.27.3): CodeQL flags data as "secret" by its name alone. The test is the regex (?is).*((?<!is|is_)secret|…trusted…|confidential).* in SensitiveDataHeuristics.qll.

    Which fix? I recommend option 1.

    1. paths-ignore: [tests] in a CodeQL config. This removes every test-sourced alert (Fixed minor bugs #19– New distribution [0.14.1] #26, New distribution [0.14.2] #28, InfoClass instanciation calls os.stat, ruining performance #29) and keeps both rules active for library code, which is where a real leak would matter. Remove .vscode once for good #27 needs one more dismissal; it only returns if that line moves.
    2. query-filters exclusions for py/clear-text-logging-sensitive-data (and -storage-). This covers Remove .vscode once for good #27 too, but turns those rules off for the whole repo.

    A prototype of option 2, with a test, is ready. Switching it to option 1 is small.

    Separately: the #1985 malformed-key-log warnings put the key-log line itself into the warning text. That is the one place real key material could reach a log, and CodeQL does not flag it. Should those warnings print only the line's position or length?

  3. added
    needs: decisionWaiting on the maintainer to decide — not blocked by other work
    and removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 24, 2026
  4. moved this from WIP to Needs decision in PyPCAPKiton Oct 24, 2026
  5. JarryShaw commented on Oct 24, 2026

    @JarryShaw
    OwnerAuthor

    your recommendation?

  6. JarryShaw commented on Oct 24, 2026

    @JarryShaw
    OwnerAuthor

    Recommendations:

    1. CodeQL: option 1. Add paths-ignore: [tests] in .github/codeql/codeql-config.yml, referenced from the Initialize CodeQL step.
    2. fix(pcapng): a malformed TLS key-log line in a Decryption Secrets Block aborts extraction #1985 warnings: yes, stop quoting the key-log line.
      • Report its position (line number within the block) and length instead.
      • A key-log line is the secret: it is a TLS client random plus the session key. A malformed one is still likely to carry real key material, and warnings land in logs and CI output.
      • This is a library change with a test, so it goes in its own PR.

    If you agree, I'll switch the prototype to option 1, file the #1985 change, and open both PRs.

  7. JarryShaw commented on Oct 24, 2026

    @JarryShaw
    OwnerAuthor

    sounds good. recommendation taken.

  8. JarryShaw commented on Oct 24, 2026

    @JarryShaw
    OwnerAuthor

    Thanks. Going ahead with both:

    1. CodeQL: a .github/codeql/codeql-config.yml with paths-ignore: [tests], referenced from the Initialize CodeQL step, plus a pinning test. It goes up as a PR under this issue.
    2. fix(pcapng): a malformed TLS key-log line in a Decryption Secrets Block aborts extraction #1985 key-log warnings: they will report the line's position and length instead of the line itself. That is a separate issue and PR.

    #27 (secrets_length in warnings.py) still needs one manual dismissal after the config lands.

  9. added
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    needs: decisionWaiting on the maintainer to decide — not blocked by other work
    on Oct 24, 2026
  10. JarryShaw commented on Oct 24, 2026

    @JarryShaw
    OwnerAuthor

    Correction to point 2 above: the #1985 warnings already do not quote the key-log line. I relayed an agent's claim without checking it. On main, _malformed_line_message in pcapkit/protocols/schema/misc/pcapng.py builds both the TLS and the WireGuard warning.

    • Known label: it names the label and says "values elided".
    • Unrecognised label: it says "line elided", since the label itself may be key material.

    So there is nothing to change there, and I'm not filing that follow-up. Only the CodeQL config (option 1) goes ahead.

  11. moved this from Needs decision to WIP in PyPCAPKiton Oct 24, 2026
  12. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 24, 2026
  13. added this to the PyPCAPKit v1.5 milestone on Oct 26, 2026
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

    ciPull requests that change CI or workflow configuration (ci: subject prefix)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions