CHORE: add shift-left secret scanning to PR validation (test)#674
Draft
bewithgaurav wants to merge 6 commits into
Draft
CHORE: add shift-left secret scanning to PR validation (test)#674bewithgaurav wants to merge 6 commits into
bewithgaurav wants to merge 6 commits into
Conversation
adds a SecretScan job to the pr-validation pipeline that runs the 1ES Secret Scanning (SEC101/SPMI) engine on every PR, so credential leaks like SEC101/037 SqlLegacyCredentials are caught pre-merge instead of at the GitHub->ADO sync. includes a clearly-fake planted probe fixture to verify detection end-to-end; both the fixture and (pending decision) the job are test scaffolding. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
📊 Code Coverage Report
Diff CoverageDiff: main...HEAD, staged and unstaged changesNo lines with coverage information in this diff. 📋 Files Needing Attention📉 Files with overall lowest coverage (click to expand)mssql_python.pybind.logger_bridge.cpp: 59.2%
mssql_python.pybind.ddbc_bindings.h: 59.9%
mssql_python.pybind.logger_bridge.hpp: 70.8%
mssql_python.pybind.connection.connection.cpp: 76.2%
mssql_python.pybind.ddbc_bindings.cpp: 76.2%
mssql_python.__init__.py: 77.3%
mssql_python.row.py: 77.6%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.connection.py: 83.6%
mssql_python.logging.py: 85.5%🔗 Quick Links
|
the previous PostAnalysis@2 step did not fail the build on 1ESSecretScanning findings (its break filter does not cover the secret scanner, and SPMI emits warnings not errors) - so the planted probe was detected but the run stayed green. replace it with a SARIF gate script that parses the SEC101 findings, ignores the sample-credential paths already excluded by .config/CredScanSuppressions.json (tests/benchmarks/eng/OneBranchPipelines), and fails the build on any remaining leak in shipping source. move the test probe to repo root so it is treated as a real (non-sample) leak. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
previous commit only captured the probe move; the pipeline edit (swap PostAnalysis@2 for the PowerShell gate) and the gate script itself were missed. add them so the SecretScan job actually references an existing script. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
the gate passed even though the scanner flagged the root probe: Get-ChildItem -Recurse skips the hidden .gdn results dir without -Force, so it matched an unrelated empty SARIF. target <BuildDir>/.gdn/.r directly with -Force (fallback to a forced recursive search) and add diagnostics on which SARIF files and how many SEC101 results are seen. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
the gate read the right SARIF but saw 0 SEC101: SPMI stores the rule id via ruleIndex into tool.driver.rules[], not always in result.ruleId. resolve the id from result.ruleId, result.rule.id, or the rules table, match SEC101 anywhere, and log each result's ids for diagnosis. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
detection proven (build failed on the root probe with SEC101/037 while ignoring the sample creds under tests/). remove the probe so the gate now passes on a clean tree, and drop the per-result debug line. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Work Item / Issue Reference
Summary
draft / test — do not merge. proving shift-left secret scanning on PR validation.
adds a
SecretScanjob toeng/pipelines/pr-validation-pipeline.ymlthat runs1ESSecretScanning@1(the SEC101 / SPMI engine, same family as the ADO push-protectionSEC101/037 SqlLegacyCredentialssignal) +PostAnalysis@2to fail the build on any finding. goal: catch credential leaks at PR time, pre-merge, instead of surfacing later at the GitHub→ADO sync push-protection gate.tests/_secretscan_probe.txtis a clearly-fake, non-live Azure-SQL-cred-shaped string planted only to verify detection end-to-end. expected result: theSecret Scanleg fails on this probe. once detection is confirmed, the probe file is removed and the scan should pass.both the probe and the placement of the job are test scaffolding for evaluation.