DocsWorkflows
Pull-request gate in CI
A dry-run scan in the pull-request build blocks any human or AI-written secret from merging. It exits 2 on findings and publishes the report either way.
Where it lives
In the pull-request validation (build) pipeline, not the post-merge release pipeline. The build agent checks the feature branch before it can merge into main or develop. If a secret is present, the pull request is blocked.
Azure DevOps
trigger: none # pull requests only
pr:
branches:
include:
- main
- develop
jobs:
- job: SecretScan
displayName: 'IronForge Secret Sleuth Validation'
pool:
vmImage: 'windows-latest' # or ubuntu-latest / self-hosted
steps:
- task: UseDotNet@2
displayName: 'Use .NET 10 SDK'
inputs:
packageType: 'sdk'
version: '10.x'
- script: |
dotnet tool install --global --add-source "$(Build.SourcesDirectory)/packaging" IronForge-SecretSleuth
displayName: 'Install Secret Sleuth CLI'
# Exits 2 if secrets are found, 0 if clean
- script: |
SecretSleuth --dry-run --no-open --no-git-protection --report "$(Build.ArtifactStagingDirectory)/secrets-report.html"
displayName: 'Scan for hard-coded credentials'
- task: PublishBuildArtifacts@1
displayName: 'Publish Secret Sleuth report'
condition: always()
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/secrets-report.html'
ArtifactName: 'SecurityReports'
publishLocation: 'Container'
Point --add-source at wherever your pipeline can reach the .nupkg: a folder in the repo, or an Azure Artifacts feed.
Behavior
| Result | Exit code | Pipeline |
|---|---|---|
| Clean | 0 | Passes |
| Findings | 2 | Fails; the offending files and lines are printed and the pull request cannot merge |
| Argument, path or runtime error | 1 | Fails |
Reviewers download the SecurityReports artifact to open the interactive HTML report.
Pipeline tokens are safe
The rules recognise Azure DevOps FileTransform@2 tokens ($(VariableName)) and legacy double-underscore tokens (__Token__) and ignore them. The scan never flags or rewrites your deployment tokens.