Skip to content

ci(codeql): stop scanning tests/, the source of the recurring clear-text-logging false positives (#2130) - #2139

Merged
JarryShaw merged 1 commit into
mainfrom
ci/codeql-clear-text-logging
Oct 24, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
ci/codeql-clear-text-logging

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • ci — workflows or build tooling

Description of your pull request and other information

Closes #2130, taking option 1 as ruled there.

  • Config: a new .github/codeql/codeql-config.yml with paths-ignore: [tests], referenced from codeql-analysis.yml's Initialize CodeQL step with config-file:.
  • Why tests/: every recurring py/clear-text-logging-sensitive-data / -storage- alert in extraction.py and corekit/io.py traces, in main's SARIF, to a pcapkit test fixture's secrets names. Python is not built, so an ignored path is left out of the analysis. Both rules, and every other query, still run over pcapkit/.
  • Not covered: the warnings.py alert starts at the library's own secrets_length field, so it still needs one manual dismissal.
  • Tests: tests/project/test_codeql_config_2130.py pins that the init step passes exactly the config file and no inline config, and that the config holds only name and paths-ignore: ['tests']. It fails with the config removed, or with the earlier query-filters variant.
  • Docs: a "CodeQL Configuration" section in workflows.rst.
  • Unverified until it runs on main: that paths-ignore drops tests/ from the CodeQL database, and so closes the alerts. The GitHub docs say it excludes the files "from analysis"; the next analysis on main will show it.

…ext-logging false positives (#2130)

py/clear-text-logging-sensitive-data and py/clear-text-storage-sensitive-data
flagged pcapkit/ lines whose data flow began at a test fixture's `secrets`
name, and each dismissal was lost when a pull request moved the line.

- .github/codeql/codeql-config.yml: new; paths-ignore: [tests], nothing else.
- codeql-analysis.yml: Initialize CodeQL reads it through config-file.
- tests/project/test_codeql_config_2130.py: pins the input and the config.
- docs/source/contributing/workflows.rst: CodeQL Configuration section.
@JarryShaw JarryShaw added ci Pull requests that change CI or workflow configuration (ci: subject prefix) review: running A cross-review is in flight against the current head - no verdict yet labels Oct 24, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at 0b41a6b01 (Sonnet review).

  • Format: config-file: and paths-ignore are valid for github/codeql-action/init at the pinned sha (init/action.yml, db-config-schema.json). No step passes an inline config, which would override the file.
  • No real finding lost: no code-scanning alert in any state has ever been located under tests/. Every alert from these two rules sits in pcapkit/ and was dismissed as a false positive. The workflow-permission alerts are outside tests/.
  • Tests: 59 passed across the CodeQL, pin, hardening and doc-reference tests. The workflow diff is two lines, and the language autodetect is unchanged.
  • Unverified until the first analysis on main: the CodeQL CLI's translation of paths-ignore into the Python extractor's filters happens inside the closed-source CLI. The GitHub docs say the files are "excluded from analysis", and the extractor reads the filter. InfoClass instanciation calls os.stat, ruining performance #29 closing after the merge will confirm it; Remove .vscode once for good #27 still needs its one manual dismissal.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 24, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage: 91.55% (unit tier, Python 3.15, 0b41a6b01, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 19599 880 2618 866 92.12%
pcapkit/corekit 2589 75 816 37 96.48%
pcapkit/dumpkit 282 3 102 3 98.44%
pcapkit/foundation 2971 23 1036 25 98.80%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 17418 219 4574 185 98.14%
pcapkit/toolkit 869 36 298 10 95.20%
pcapkit/utilities 498 7 144 5 98.13%
pcapkit/vendor 4432 1988 1018 167 51.87%

Per-file detail: the coverage-html artifact of this run.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Ready to merge at 0b41a6b01.

  • Review: the Sonnet review is GOOD TO GO.
  • CI: every blocking check passed (Required checks passed SUCCESS). The 3.8–3.10 KTLO legs carry no warnings.
  • Ordering: the tests/project plain-unittest ordering leg passed on a scratch merge into main d7aa41535, with 2236 tests, 0 failures.

This closes #2130. Afterwards, the next CodeQL analysis on main should close #29. #27 still needs its one manual dismissal.

@JarryShaw
JarryShaw merged commit 73de3ff into main Oct 24, 2026
67 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 24, 2026
@JarryShaw
JarryShaw deleted the ci/codeql-clear-text-logging branch October 24, 2026 12:56
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 24, 2026
@JarryShaw JarryShaw added this to the PyPCAPKit v1.5 milestone Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

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

1 participant