From eb56d5180326801e1876bf0b227198c1d0190153 Mon Sep 17 00:00:00 2001 From: Rob Hofmann Date: Sat, 7 Nov 2026 14:27:32 +0100 Subject: [PATCH 1/7] Let a repository exclude paths that hold secrets on purpose from the secret scan secretScan.allowPaths in aisdlc.json holds regular expressions on file paths. GitleaksConfig.psm1 adds them as a second allowlist, and the pre-flight, the C03 gate and Create-GitleaksBaseline.ps1 pass the repository root, so all three skip the same paths. Create-GitleaksBaseline.ps1 now also uses the allowlist of the AI-SDLC. Refs #12 --- .../ai-sdlc-gates/scripts/AiSdlcConfig.psm1 | 3 ++ .../scripts/Create-GitleaksBaseline.Tests.ps1 | 7 +-- .../scripts/Create-GitleaksBaseline.ps1 | 9 +++- .../scripts/GitleaksConfig.Tests.ps1 | 42 ++++++++++++++++++ .../ai-sdlc-gates/scripts/GitleaksConfig.psm1 | 35 +++++++++++++-- .../scripts/Invoke-Preflight.ps1 | 2 +- .../scripts/Test-GitleaksBaseline.ps1 | 2 +- .../skills/ai-sdlc-gates/sync-manifest.json | 16 +++---- .../ai-sdlc-handbook/references/layout.md | 1 + CHANGELOG.md | 7 +++ apm.lock.yaml | 44 +++++++++---------- .../ai-sdlc-gates/scripts/AiSdlcConfig.psm1 | 3 ++ .../scripts/Create-GitleaksBaseline.Tests.ps1 | 7 +-- .../scripts/Create-GitleaksBaseline.ps1 | 9 +++- .../scripts/GitleaksConfig.Tests.ps1 | 42 ++++++++++++++++++ .../ai-sdlc-gates/scripts/GitleaksConfig.psm1 | 35 +++++++++++++-- .../scripts/Invoke-Preflight.ps1 | 2 +- .../scripts/Test-GitleaksBaseline.ps1 | 2 +- .../skills/ai-sdlc-gates/sync-manifest.json | 16 +++---- .../ai-sdlc-handbook/references/layout.md | 1 + core/apm.yml | 2 +- docs/packages/core.md | 2 +- packs/bicep/apm.yml | 2 +- packs/blazor/apm.yml | 2 +- packs/discovery/apm.yml | 2 +- packs/dotnet/apm.yml | 2 +- packs/github-issues/apm.yml | 2 +- packs/github/apm.yml | 2 +- packs/knowledge/apm.yml | 2 +- packs/sonarcloud/apm.yml | 2 +- 30 files changed, 239 insertions(+), 66 deletions(-) diff --git a/.claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.psm1 b/.claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.psm1 index 070882e..afaad1b 100644 --- a/.claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.psm1 +++ b/.claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.psm1 @@ -115,6 +115,9 @@ $script:Defaults = [ordered]@{ build = '' test = '' } + secretScan = [ordered]@{ + allowPaths = @() + } tracker = [ordered]@{ repository = '' keyPattern = '' diff --git a/.claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.Tests.ps1 b/.claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.Tests.ps1 index a081348..dbe0ba9 100644 --- a/.claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.Tests.ps1 +++ b/.claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.Tests.ps1 @@ -97,17 +97,18 @@ Describe 'Create-GitleaksBaseline' { Should -Invoke Invoke-WebRequest -Times 0 -Exactly } - It 'scans with the downloaded configuration and redacts the findings' { + It 'scans with the downloaded rules plus the allowlists, and redacts the findings' { Invoke-Create | Out-Null - Should -Invoke gitleaks -Times 1 -Exactly -ParameterFilter { $args[0] -eq 'git' -and ($args -contains '--redact') -and (($args -join ' ') -match 'gitleaks\.toml') } + Should -Invoke gitleaks -Times 1 -Exactly -ParameterFilter { $args[0] -eq 'git' -and ($args -contains '--redact') -and (($args -join ' ') -match 'gitleaks-ai-sdlc-[0-9a-f]{32}\.toml') } } - It 'removes the downloaded configuration and the temporary clone afterwards' { + It 'removes the downloaded configuration, the scan config and the temporary clone afterwards' { $r = Invoke-Create Test-Path -LiteralPath (Join-Path $r.Work 'gitleaks.toml') | Should -BeFalse Test-Path -LiteralPath (Join-Path $r.Temp 'gitleaksbaseline') | Should -BeFalse + @(Get-ChildItem -LiteralPath $r.Temp -Filter 'gitleaks-ai-sdlc-*.toml') | Should -BeNullOrEmpty } It 'downloads the rule set that names from its pinned URL' -ForEach @( diff --git a/.claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1 b/.claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1 index 6908189..4f0712b 100644 --- a/.claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1 +++ b/.claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1 @@ -125,13 +125,17 @@ if (Test-Path -LiteralPath $tempDirectory) { } $failed = $false +$scanConfig = $null try { Write-Host "Clone a fresh copy of the repository to $tempDirectory" git clone --quiet $remoteUrl $tempDirectory if ($LASTEXITCODE -ne 0 -or -not (Test-Path -LiteralPath $tempDirectory)) { throw "git clone of $remoteUrl failed with exit code $LASTEXITCODE" } + # The pinned rules plus both allowlists: the one of the AI-SDLC and secretScan.allowPaths of aisdlc.json. + Import-Module (Join-Path $PSScriptRoot 'GitleaksConfig.psm1') -Force + $scanConfig = New-GitleaksConfig -Path (Join-Path $tempDrive ('gitleaks-ai-sdlc-' + [guid]::NewGuid().ToString('n') + '.toml')) -RulesPath $gitleakconfigurationFile -RepoRoot $currentDirectory Write-Host "Running gitleaks on the clone to create baseline file: $gitleaksBaselinePath" - gitleaks git $tempDirectory --config "$gitleakconfigurationFile" --report-format=json --redact --report-path "$gitleaksBaselinePath" --exit-code=99 + gitleaks git $tempDirectory --config "$scanConfig" --report-format=json --redact --report-path "$gitleaksBaselinePath" --exit-code=99 $scanExit = $LASTEXITCODE if ($scanExit -ne 0 -and $scanExit -ne 99) { throw "gitleaks failed with exit code $scanExit, so no baseline was written" } } @@ -147,6 +151,9 @@ finally { if (Test-Path -LiteralPath $gitleakconfigurationFile) { Remove-Item -LiteralPath $gitleakconfigurationFile -Force -ProgressAction SilentlyContinue } + if ($scanConfig -and (Test-Path -LiteralPath $scanConfig)) { + Remove-Item -LiteralPath $scanConfig -Force -ProgressAction SilentlyContinue + } } if ($failed) { exit 1 } diff --git a/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 b/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 index 8434930..354ee83 100644 --- a/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 +++ b/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 @@ -78,4 +78,46 @@ Describe 'GitleaksConfig' { $findings | Should -HaveCount 1 $findings[0].File | Should -Match 'other\.json$' } + + Context 'the paths a repository names in secretScan.allowPaths' { + BeforeEach { + $script:Repo = Join-Path $TestDrive ([guid]::NewGuid().ToString('n')) + New-Item -ItemType Directory -Path $script:Repo -Force | Out-Null + } + + It 'adds them as an allowlist of their own, next to the allowlist of the AI-SDLC' { + Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "^\\.storage/", "(^|/)secrets\\.yaml$" ] } }' + + $text = Get-Content -LiteralPath (New-GitleaksConfig -Path (Join-Path $TestDrive 'repo.toml') -RepoRoot $script:Repo) -Raw + + ([regex]::Matches($text, '(?m)^\[\[allowlists\]\]')).Count | Should -Be 2 + $text | Should -Match ([regex]::Escape("'''^\.storage/'''")) + $text | Should -Match ([regex]::Escape("'''(^|/)secrets\.yaml$'''")) + } + + It 'writes the same config as before when aisdlc.json names no paths' { + Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "repository": "contoso" }' + + $with = Get-Content -LiteralPath (New-GitleaksConfig -Path (Join-Path $TestDrive 'none.toml') -RepoRoot $script:Repo) -Raw + $without = Get-Content -LiteralPath (New-GitleaksConfig -Path (Join-Path $TestDrive 'plain.toml')) -Raw + + $with | Should -Be $without + } + + It 'makes gitleaks skip a named path, and still find the same secret elsewhere' -Skip:(-not (Get-Command gitleaks -ErrorAction SilentlyContinue)) { + Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "(^|/)secrets\\.yaml$" ] } }' + $scan = Join-Path $script:Repo 'scan' + New-Item -ItemType Directory -Path $scan -Force | Out-Null + Set-Content -LiteralPath (Join-Path $scan 'secrets.yaml') -Value (New-ManifestLine) + Set-Content -LiteralPath (Join-Path $scan 'other.json') -Value (New-ManifestLine) + $config = New-GitleaksConfig -Path (Join-Path $TestDrive 'repo-scan.toml') -RepoRoot $script:Repo + $report = Join-Path $TestDrive 'repo-report.json' + + gitleaks dir $scan --config $config --no-banner --report-format json --report-path $report *> $null + + $findings = @(Get-Content -LiteralPath $report -Raw | ConvertFrom-Json) + $findings | Should -HaveCount 1 + $findings[0].File | Should -Match 'other\.json$' + } + } } diff --git a/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 b/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 index 1496061..4d2c508 100644 --- a/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 +++ b/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 @@ -11,6 +11,10 @@ request of a consumer would fail its secret scan. The allowlist here skips that one file, in the shared pull request job (Test-GitleaksBaseline.ps1) and in the pre-flight (Invoke-Preflight.ps1). + A repository can name more paths in secretScan.allowPaths of aisdlc.json: files that hold secrets + on purpose, because the application needs them there. With -RepoRoot, New-GitleaksConfig adds + them as a second allowlist. Without the field, the config is the same as without -RepoRoot. + New-GitleaksConfig writes a small TOML file that extends a rule set and adds the allowlist. With -RulesPath it extends that file, for example a pinned rule set from gitleaks-rules.json. Without it, it extends the default rules that gitleaks carries. @@ -30,6 +34,8 @@ Test-GitleaksRulesFile -Path $file -Pin $pin #> +Import-Module (Join-Path $PSScriptRoot 'AiSdlcConfig.psm1') + # Each entry is a regular expression on the path of a file, relative to the scanned folder. $script:AllowedPaths = @( '(^|/)skills/ai-sdlc-gates/sync-manifest\.json$' @@ -67,11 +73,22 @@ function Get-GitleaksAllowedPath { return $script:AllowedPaths } +function Get-GitleaksRepoAllowedPath { + # The paths a repository names in secretScan.allowPaths of aisdlc.json: files that hold secrets on + # purpose, such as the secrets file of an application. A scan never reads them. + [CmdletBinding()] + param([Parameter(Mandatory)][string]$RepoRoot) + + $config = Get-AiSdlcConfig -RepoRoot $RepoRoot + return @($config.secretScan.allowPaths | Where-Object { $_ }) +} + function New-GitleaksConfig { [CmdletBinding()] param( [Parameter(Mandatory)][string]$Path, - [string]$RulesPath + [string]$RulesPath, + [string]$RepoRoot ) $extend = if ($RulesPath) { @@ -91,9 +108,21 @@ function New-GitleaksConfig { $paths ']' '' - ) -join "`n" + ) + $repoPaths = if ($RepoRoot) { @(Get-GitleaksRepoAllowedPath -RepoRoot $RepoRoot) } else { @() } + if ($repoPaths.Count -gt 0) { + $toml += @( + '[[allowlists]]' + 'description = "Paths the repository holds secrets in on purpose: secretScan.allowPaths in aisdlc.json."' + 'paths = [' + (($repoPaths | ForEach-Object { " '''$_'''" }) -join ",`n") + ']' + '' + ) + } + $toml = $toml -join "`n" [IO.File]::WriteAllText($Path, $toml, [Text.UTF8Encoding]::new($false)) return $Path } -Export-ModuleMember -Function Get-GitleaksAllowedPath, New-GitleaksConfig, Get-GitleaksRulesPin, Test-GitleaksRulesFile +Export-ModuleMember -Function Get-GitleaksAllowedPath, Get-GitleaksRepoAllowedPath, New-GitleaksConfig, Get-GitleaksRulesPin, Test-GitleaksRulesFile diff --git a/.claude/skills/ai-sdlc-gates/scripts/Invoke-Preflight.ps1 b/.claude/skills/ai-sdlc-gates/scripts/Invoke-Preflight.ps1 index 046eb99..d126656 100644 --- a/.claude/skills/ai-sdlc-gates/scripts/Invoke-Preflight.ps1 +++ b/.claude/skills/ai-sdlc-gates/scripts/Invoke-Preflight.ps1 @@ -164,7 +164,7 @@ try { $reportPath = Join-Path ([System.IO.Path]::GetTempPath()) ('preflight-gitleaks-' + [guid]::NewGuid().ToString('n') + '.json') $range = (git rev-parse --verify --quiet "$TargetBranch" 2>$null) ? "$TargetBranch..HEAD" : 'HEAD~1..HEAD' # The pinned rules of CI plus the allowlist of the AI-SDLC: the blob hashes in sync-manifest.json look like keys. - $glConfig = New-GitleaksConfig -Path (Join-Path ([System.IO.Path]::GetTempPath()) ('gitleaks-ai-sdlc-' + [guid]::NewGuid().ToString('n') + '.toml')) -RulesPath $rulesFile + $glConfig = New-GitleaksConfig -Path (Join-Path ([System.IO.Path]::GetTempPath()) ('gitleaks-ai-sdlc-' + [guid]::NewGuid().ToString('n') + '.toml')) -RulesPath $rulesFile -RepoRoot $RepoRoot $glArgs = @('git', '--no-banner', '--redact', '--config', $glConfig, '--report-format', 'json', '--report-path', $reportPath, '--log-opts', $range) if (Test-Path -LiteralPath $baseline) { $glArgs += @('--baseline-path', $baseline) } Remove-Item -LiteralPath $reportPath -ErrorAction SilentlyContinue diff --git a/.claude/skills/ai-sdlc-gates/scripts/Test-GitleaksBaseline.ps1 b/.claude/skills/ai-sdlc-gates/scripts/Test-GitleaksBaseline.ps1 index f81d05d..d90af9f 100644 --- a/.claude/skills/ai-sdlc-gates/scripts/Test-GitleaksBaseline.ps1 +++ b/.claude/skills/ai-sdlc-gates/scripts/Test-GitleaksBaseline.ps1 @@ -173,7 +173,7 @@ if (-not (Test-GitleaksRulesFile -Path $gitleakconfigurationFile -Pin $pin)) { # The pinned rules plus the allowlist of the AI-SDLC: the blob hashes in sync-manifest.json look like keys. $scanConfig = Join-Path ([IO.Path]::GetTempPath()) ('gitleaks-ai-sdlc-' + [guid]::NewGuid().ToString('n') + '.toml') -$null = New-GitleaksConfig -Path $scanConfig -RulesPath $gitleakconfigurationFile +$null = New-GitleaksConfig -Path $scanConfig -RulesPath $gitleakconfigurationFile -RepoRoot $currentDirectory # A repository without a baseline is scanned in full: every finding counts. $gitleaksArgs = @('detect', "--source=$currentDirectory", '--config', $scanConfig, '--redact', '--exit-code=99') diff --git a/.claude/skills/ai-sdlc-gates/sync-manifest.json b/.claude/skills/ai-sdlc-gates/sync-manifest.json index 9a2648e..53deae5 100644 --- a/.claude/skills/ai-sdlc-gates/sync-manifest.json +++ b/.claude/skills/ai-sdlc-gates/sync-manifest.json @@ -21,7 +21,7 @@ ".claude/skills/ai-sdlc-gates/assets/actions/ai-sdlc-pr/action.yml": "f80ed84d896859668d74cd47bf327a714d383f8a", ".claude/skills/ai-sdlc-gates/assets/agents-core.md": "4170c4291b02cb6515f3860b23716d2069fd528b", ".claude/skills/ai-sdlc-gates/gates.json": "cf6f5a2d284f0b22f0f4a89292037caed3e53c19", - ".claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.psm1": "070882e537cb4f7d46276e3a6650e89e179f99cf", + ".claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.psm1": "afaad1b3853d71d4f1016e2f9f9df4a1ffdbc03d", ".claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.Tests.ps1": "2ad1609653980ca3bada51c7cd470e4ba6ffcbe9", ".claude/skills/ai-sdlc-gates/scripts/apm-version.json": "fbbd8a51e60e3a7e653a35bc9b959f2bf332ab74", ".claude/skills/ai-sdlc-gates/scripts/Build-DocsIndex.ps1": "64c6d651e638b0fe15d20cde02418e8021a5cdfc", @@ -60,8 +60,8 @@ ".claude/skills/ai-sdlc-gates/scripts/Check-SkillHygiene.Tests.ps1": "870de5ec3bd461267325f02e09a657780a5b2e32", ".claude/skills/ai-sdlc-gates/scripts/Check-SyncManifest.ps1": "ebe73f4ced6ee337e8d7f78e2afbdebc59c7274f", ".claude/skills/ai-sdlc-gates/scripts/Check-SyncManifest.Tests.ps1": "f780c435e15a095b4ed8c29fc03aacbac435f557", - ".claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1": "69081893599800422a17cb2a5e2535719d5f43a3", - ".claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.Tests.ps1": "a0813488e6ec7e68d752366061a30e874e24446c", + ".claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1": "4f0712b2b023d5cf8d0dc631a16646e9e3a6f5e1", + ".claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.Tests.ps1": "dbe0ba9cedb0dd413c06ca14a192ea45e7636298", ".claude/skills/ai-sdlc-gates/scripts/data/cefrj-vocabulary-profile-1.5.csv": "1a9cee97a531d04c67751eb4049127c4227bd26a", ".claude/skills/ai-sdlc-gates/scripts/data/octanove-vocabulary-profile-c1c2-1.0.csv": "4c44a971b4fb7b51da472b1dd8370cb64ff4234a", ".claude/skills/ai-sdlc-gates/scripts/data/reading-level-allowlist.txt": "af857f2957355719361953d507cbf289468db814", @@ -74,8 +74,8 @@ ".claude/skills/ai-sdlc-gates/scripts/GateAnnotation.Tests.ps1": "beb01f71d8706bd86de7bcc6a7bf583ba9ab6e5a", ".claude/skills/ai-sdlc-gates/scripts/gitleaks-rules.json": "27587aa74bfdd86b48ad9c50309b2b8521289c78", ".claude/skills/ai-sdlc-gates/scripts/gitleaks-version.json": "e77769fb5c7760c211010a6b48c01280b4ed7e44", - ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1": "1496061cc6f7233e2e45c69e232ce908dfd52fa2", - ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1": "843493058e08b645219e454da8e2095a573e841e", + ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1": "4d2c50872983f657a38a7d3bc1c9775ca427ec1d", + ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1": "354ee83c563550c58d763f2c99e5491148270e08", ".claude/skills/ai-sdlc-gates/scripts/Install-Apm.ps1": "63ea5061301759e7fb77d69fdbbc2c0fa9c5ff27", ".claude/skills/ai-sdlc-gates/scripts/Install-Apm.Tests.ps1": "b3188b0357d1b1ffa4252f4f78ce24338cdc2ab7", ".claude/skills/ai-sdlc-gates/scripts/Install-Gitleaks.ps1": "39083d99bb0c76ec3a0c2942582629cf4311a54f", @@ -86,7 +86,7 @@ ".claude/skills/ai-sdlc-gates/scripts/Invoke-LocalGates.Tests.ps1": "d4b40927c4a082145cb3948db8e4fb3d98af094b", ".claude/skills/ai-sdlc-gates/scripts/Invoke-PesterGate.ps1": "a265c27173a0bf2f5386d95ed64d1b5d6891b40f", ".claude/skills/ai-sdlc-gates/scripts/Invoke-PesterGate.Tests.ps1": "e0235955d187d956cc6a5fb3cf6ed2f6f2aa5d75", - ".claude/skills/ai-sdlc-gates/scripts/Invoke-Preflight.ps1": "046eb9978b912391af102fa96208b9e326a2df40", + ".claude/skills/ai-sdlc-gates/scripts/Invoke-Preflight.ps1": "d126656dbadaa0e508d3701e9c3e70197d8b48e5", ".claude/skills/ai-sdlc-gates/scripts/Invoke-Preflight.Tests.ps1": "cf8362c453d1f942a1d52244e191eaadf8ebcebe", ".claude/skills/ai-sdlc-gates/scripts/PreflightReceipt.psm1": "5c5c6b5c9a9ddf6c5a4fdaa1c5f5a55e026c5656", ".claude/skills/ai-sdlc-gates/scripts/PreflightReceipt.Tests.ps1": "629fb63e5e0389d072fbc96e7bc8f2b87f061075", @@ -95,7 +95,7 @@ ".claude/skills/ai-sdlc-gates/scripts/Sync-AgentsFile.Tests.ps1": "87533e139944a9dcc50eb45a5109e2ff5f16e63b", ".claude/skills/ai-sdlc-gates/scripts/Sync-AllowRules.ps1": "0466893efb2128502dfe5367058d70231a1c14c3", ".claude/skills/ai-sdlc-gates/scripts/Sync-AllowRules.Tests.ps1": "93de3d86a94954e2a57b6ab417454018efebf041", - ".claude/skills/ai-sdlc-gates/scripts/Test-GitleaksBaseline.ps1": "f81d05d23851892f5575f18afaa902eb7bf28b08", + ".claude/skills/ai-sdlc-gates/scripts/Test-GitleaksBaseline.ps1": "d90af9f6881677ca4308cd4b67f7e0cd8a628533", ".claude/skills/ai-sdlc-gates/scripts/Test-GitleaksBaseline.Tests.ps1": "ce362cbde96a8fcf61eb8793f075fe5f58ac9c3a", ".claude/skills/ai-sdlc-gates/scripts/Test-PushReceipt.ps1": "54ec6a3e42d488994ee91d0f4993ba5d3366d96a", ".claude/skills/ai-sdlc-gates/scripts/Test-PushReceipt.Tests.ps1": "74968692c13e072622dcc86e75759a5de35a62b4", @@ -114,7 +114,7 @@ ".claude/skills/ai-sdlc-handbook/references/docs-wiki.md": "038477c9b704a5b545decfe5e3f3f9970d8d1f9d", ".claude/skills/ai-sdlc-handbook/references/first-story.md": "be899eb395dafb2d704b8f0cb46bac1fb5e593c8", ".claude/skills/ai-sdlc-handbook/references/language.md": "b4ce85e8325cd5e59c13cb31564d6ff81ea71c7a", - ".claude/skills/ai-sdlc-handbook/references/layout.md": "d8d96770c46719c2ce9cdf14e12267cd607c1c4c", + ".claude/skills/ai-sdlc-handbook/references/layout.md": "2c96fa03da2a79f19e31769fe454e5c7f105a086", ".claude/skills/ai-sdlc-handbook/references/node-templates.md": "580c9c92c470a6abbaa0145cc3060ff1a11d247c", ".claude/skills/ai-sdlc-handbook/references/orchestration.md": "5b6c8c38a5d17ca59cc38794a7750355c508d262", ".claude/skills/ai-sdlc-handbook/references/pattern.md": "f0f2a8cf3dac267cda0fd3783d86bddba5afc7c0", diff --git a/.claude/skills/ai-sdlc-handbook/references/layout.md b/.claude/skills/ai-sdlc-handbook/references/layout.md index d8d9677..2c96fa0 100644 --- a/.claude/skills/ai-sdlc-handbook/references/layout.md +++ b/.claude/skills/ai-sdlc-handbook/references/layout.md @@ -128,6 +128,7 @@ installs. `AiSdlcConfig.psm1` takes each dependency whose path ends in `packs/ names from its pinned URL' -ForEach @( diff --git a/core/.apm/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1 b/core/.apm/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1 index 6908189..4f0712b 100644 --- a/core/.apm/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1 +++ b/core/.apm/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1 @@ -125,13 +125,17 @@ if (Test-Path -LiteralPath $tempDirectory) { } $failed = $false +$scanConfig = $null try { Write-Host "Clone a fresh copy of the repository to $tempDirectory" git clone --quiet $remoteUrl $tempDirectory if ($LASTEXITCODE -ne 0 -or -not (Test-Path -LiteralPath $tempDirectory)) { throw "git clone of $remoteUrl failed with exit code $LASTEXITCODE" } + # The pinned rules plus both allowlists: the one of the AI-SDLC and secretScan.allowPaths of aisdlc.json. + Import-Module (Join-Path $PSScriptRoot 'GitleaksConfig.psm1') -Force + $scanConfig = New-GitleaksConfig -Path (Join-Path $tempDrive ('gitleaks-ai-sdlc-' + [guid]::NewGuid().ToString('n') + '.toml')) -RulesPath $gitleakconfigurationFile -RepoRoot $currentDirectory Write-Host "Running gitleaks on the clone to create baseline file: $gitleaksBaselinePath" - gitleaks git $tempDirectory --config "$gitleakconfigurationFile" --report-format=json --redact --report-path "$gitleaksBaselinePath" --exit-code=99 + gitleaks git $tempDirectory --config "$scanConfig" --report-format=json --redact --report-path "$gitleaksBaselinePath" --exit-code=99 $scanExit = $LASTEXITCODE if ($scanExit -ne 0 -and $scanExit -ne 99) { throw "gitleaks failed with exit code $scanExit, so no baseline was written" } } @@ -147,6 +151,9 @@ finally { if (Test-Path -LiteralPath $gitleakconfigurationFile) { Remove-Item -LiteralPath $gitleakconfigurationFile -Force -ProgressAction SilentlyContinue } + if ($scanConfig -and (Test-Path -LiteralPath $scanConfig)) { + Remove-Item -LiteralPath $scanConfig -Force -ProgressAction SilentlyContinue + } } if ($failed) { exit 1 } diff --git a/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 b/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 index 8434930..354ee83 100644 --- a/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 +++ b/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 @@ -78,4 +78,46 @@ Describe 'GitleaksConfig' { $findings | Should -HaveCount 1 $findings[0].File | Should -Match 'other\.json$' } + + Context 'the paths a repository names in secretScan.allowPaths' { + BeforeEach { + $script:Repo = Join-Path $TestDrive ([guid]::NewGuid().ToString('n')) + New-Item -ItemType Directory -Path $script:Repo -Force | Out-Null + } + + It 'adds them as an allowlist of their own, next to the allowlist of the AI-SDLC' { + Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "^\\.storage/", "(^|/)secrets\\.yaml$" ] } }' + + $text = Get-Content -LiteralPath (New-GitleaksConfig -Path (Join-Path $TestDrive 'repo.toml') -RepoRoot $script:Repo) -Raw + + ([regex]::Matches($text, '(?m)^\[\[allowlists\]\]')).Count | Should -Be 2 + $text | Should -Match ([regex]::Escape("'''^\.storage/'''")) + $text | Should -Match ([regex]::Escape("'''(^|/)secrets\.yaml$'''")) + } + + It 'writes the same config as before when aisdlc.json names no paths' { + Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "repository": "contoso" }' + + $with = Get-Content -LiteralPath (New-GitleaksConfig -Path (Join-Path $TestDrive 'none.toml') -RepoRoot $script:Repo) -Raw + $without = Get-Content -LiteralPath (New-GitleaksConfig -Path (Join-Path $TestDrive 'plain.toml')) -Raw + + $with | Should -Be $without + } + + It 'makes gitleaks skip a named path, and still find the same secret elsewhere' -Skip:(-not (Get-Command gitleaks -ErrorAction SilentlyContinue)) { + Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "(^|/)secrets\\.yaml$" ] } }' + $scan = Join-Path $script:Repo 'scan' + New-Item -ItemType Directory -Path $scan -Force | Out-Null + Set-Content -LiteralPath (Join-Path $scan 'secrets.yaml') -Value (New-ManifestLine) + Set-Content -LiteralPath (Join-Path $scan 'other.json') -Value (New-ManifestLine) + $config = New-GitleaksConfig -Path (Join-Path $TestDrive 'repo-scan.toml') -RepoRoot $script:Repo + $report = Join-Path $TestDrive 'repo-report.json' + + gitleaks dir $scan --config $config --no-banner --report-format json --report-path $report *> $null + + $findings = @(Get-Content -LiteralPath $report -Raw | ConvertFrom-Json) + $findings | Should -HaveCount 1 + $findings[0].File | Should -Match 'other\.json$' + } + } } diff --git a/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 b/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 index 1496061..4d2c508 100644 --- a/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 +++ b/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 @@ -11,6 +11,10 @@ request of a consumer would fail its secret scan. The allowlist here skips that one file, in the shared pull request job (Test-GitleaksBaseline.ps1) and in the pre-flight (Invoke-Preflight.ps1). + A repository can name more paths in secretScan.allowPaths of aisdlc.json: files that hold secrets + on purpose, because the application needs them there. With -RepoRoot, New-GitleaksConfig adds + them as a second allowlist. Without the field, the config is the same as without -RepoRoot. + New-GitleaksConfig writes a small TOML file that extends a rule set and adds the allowlist. With -RulesPath it extends that file, for example a pinned rule set from gitleaks-rules.json. Without it, it extends the default rules that gitleaks carries. @@ -30,6 +34,8 @@ Test-GitleaksRulesFile -Path $file -Pin $pin #> +Import-Module (Join-Path $PSScriptRoot 'AiSdlcConfig.psm1') + # Each entry is a regular expression on the path of a file, relative to the scanned folder. $script:AllowedPaths = @( '(^|/)skills/ai-sdlc-gates/sync-manifest\.json$' @@ -67,11 +73,22 @@ function Get-GitleaksAllowedPath { return $script:AllowedPaths } +function Get-GitleaksRepoAllowedPath { + # The paths a repository names in secretScan.allowPaths of aisdlc.json: files that hold secrets on + # purpose, such as the secrets file of an application. A scan never reads them. + [CmdletBinding()] + param([Parameter(Mandatory)][string]$RepoRoot) + + $config = Get-AiSdlcConfig -RepoRoot $RepoRoot + return @($config.secretScan.allowPaths | Where-Object { $_ }) +} + function New-GitleaksConfig { [CmdletBinding()] param( [Parameter(Mandatory)][string]$Path, - [string]$RulesPath + [string]$RulesPath, + [string]$RepoRoot ) $extend = if ($RulesPath) { @@ -91,9 +108,21 @@ function New-GitleaksConfig { $paths ']' '' - ) -join "`n" + ) + $repoPaths = if ($RepoRoot) { @(Get-GitleaksRepoAllowedPath -RepoRoot $RepoRoot) } else { @() } + if ($repoPaths.Count -gt 0) { + $toml += @( + '[[allowlists]]' + 'description = "Paths the repository holds secrets in on purpose: secretScan.allowPaths in aisdlc.json."' + 'paths = [' + (($repoPaths | ForEach-Object { " '''$_'''" }) -join ",`n") + ']' + '' + ) + } + $toml = $toml -join "`n" [IO.File]::WriteAllText($Path, $toml, [Text.UTF8Encoding]::new($false)) return $Path } -Export-ModuleMember -Function Get-GitleaksAllowedPath, New-GitleaksConfig, Get-GitleaksRulesPin, Test-GitleaksRulesFile +Export-ModuleMember -Function Get-GitleaksAllowedPath, Get-GitleaksRepoAllowedPath, New-GitleaksConfig, Get-GitleaksRulesPin, Test-GitleaksRulesFile diff --git a/core/.apm/skills/ai-sdlc-gates/scripts/Invoke-Preflight.ps1 b/core/.apm/skills/ai-sdlc-gates/scripts/Invoke-Preflight.ps1 index 046eb99..d126656 100644 --- a/core/.apm/skills/ai-sdlc-gates/scripts/Invoke-Preflight.ps1 +++ b/core/.apm/skills/ai-sdlc-gates/scripts/Invoke-Preflight.ps1 @@ -164,7 +164,7 @@ try { $reportPath = Join-Path ([System.IO.Path]::GetTempPath()) ('preflight-gitleaks-' + [guid]::NewGuid().ToString('n') + '.json') $range = (git rev-parse --verify --quiet "$TargetBranch" 2>$null) ? "$TargetBranch..HEAD" : 'HEAD~1..HEAD' # The pinned rules of CI plus the allowlist of the AI-SDLC: the blob hashes in sync-manifest.json look like keys. - $glConfig = New-GitleaksConfig -Path (Join-Path ([System.IO.Path]::GetTempPath()) ('gitleaks-ai-sdlc-' + [guid]::NewGuid().ToString('n') + '.toml')) -RulesPath $rulesFile + $glConfig = New-GitleaksConfig -Path (Join-Path ([System.IO.Path]::GetTempPath()) ('gitleaks-ai-sdlc-' + [guid]::NewGuid().ToString('n') + '.toml')) -RulesPath $rulesFile -RepoRoot $RepoRoot $glArgs = @('git', '--no-banner', '--redact', '--config', $glConfig, '--report-format', 'json', '--report-path', $reportPath, '--log-opts', $range) if (Test-Path -LiteralPath $baseline) { $glArgs += @('--baseline-path', $baseline) } Remove-Item -LiteralPath $reportPath -ErrorAction SilentlyContinue diff --git a/core/.apm/skills/ai-sdlc-gates/scripts/Test-GitleaksBaseline.ps1 b/core/.apm/skills/ai-sdlc-gates/scripts/Test-GitleaksBaseline.ps1 index f81d05d..d90af9f 100644 --- a/core/.apm/skills/ai-sdlc-gates/scripts/Test-GitleaksBaseline.ps1 +++ b/core/.apm/skills/ai-sdlc-gates/scripts/Test-GitleaksBaseline.ps1 @@ -173,7 +173,7 @@ if (-not (Test-GitleaksRulesFile -Path $gitleakconfigurationFile -Pin $pin)) { # The pinned rules plus the allowlist of the AI-SDLC: the blob hashes in sync-manifest.json look like keys. $scanConfig = Join-Path ([IO.Path]::GetTempPath()) ('gitleaks-ai-sdlc-' + [guid]::NewGuid().ToString('n') + '.toml') -$null = New-GitleaksConfig -Path $scanConfig -RulesPath $gitleakconfigurationFile +$null = New-GitleaksConfig -Path $scanConfig -RulesPath $gitleakconfigurationFile -RepoRoot $currentDirectory # A repository without a baseline is scanned in full: every finding counts. $gitleaksArgs = @('detect', "--source=$currentDirectory", '--config', $scanConfig, '--redact', '--exit-code=99') diff --git a/core/.apm/skills/ai-sdlc-gates/sync-manifest.json b/core/.apm/skills/ai-sdlc-gates/sync-manifest.json index 9a2648e..53deae5 100644 --- a/core/.apm/skills/ai-sdlc-gates/sync-manifest.json +++ b/core/.apm/skills/ai-sdlc-gates/sync-manifest.json @@ -21,7 +21,7 @@ ".claude/skills/ai-sdlc-gates/assets/actions/ai-sdlc-pr/action.yml": "f80ed84d896859668d74cd47bf327a714d383f8a", ".claude/skills/ai-sdlc-gates/assets/agents-core.md": "4170c4291b02cb6515f3860b23716d2069fd528b", ".claude/skills/ai-sdlc-gates/gates.json": "cf6f5a2d284f0b22f0f4a89292037caed3e53c19", - ".claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.psm1": "070882e537cb4f7d46276e3a6650e89e179f99cf", + ".claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.psm1": "afaad1b3853d71d4f1016e2f9f9df4a1ffdbc03d", ".claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.Tests.ps1": "2ad1609653980ca3bada51c7cd470e4ba6ffcbe9", ".claude/skills/ai-sdlc-gates/scripts/apm-version.json": "fbbd8a51e60e3a7e653a35bc9b959f2bf332ab74", ".claude/skills/ai-sdlc-gates/scripts/Build-DocsIndex.ps1": "64c6d651e638b0fe15d20cde02418e8021a5cdfc", @@ -60,8 +60,8 @@ ".claude/skills/ai-sdlc-gates/scripts/Check-SkillHygiene.Tests.ps1": "870de5ec3bd461267325f02e09a657780a5b2e32", ".claude/skills/ai-sdlc-gates/scripts/Check-SyncManifest.ps1": "ebe73f4ced6ee337e8d7f78e2afbdebc59c7274f", ".claude/skills/ai-sdlc-gates/scripts/Check-SyncManifest.Tests.ps1": "f780c435e15a095b4ed8c29fc03aacbac435f557", - ".claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1": "69081893599800422a17cb2a5e2535719d5f43a3", - ".claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.Tests.ps1": "a0813488e6ec7e68d752366061a30e874e24446c", + ".claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1": "4f0712b2b023d5cf8d0dc631a16646e9e3a6f5e1", + ".claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.Tests.ps1": "dbe0ba9cedb0dd413c06ca14a192ea45e7636298", ".claude/skills/ai-sdlc-gates/scripts/data/cefrj-vocabulary-profile-1.5.csv": "1a9cee97a531d04c67751eb4049127c4227bd26a", ".claude/skills/ai-sdlc-gates/scripts/data/octanove-vocabulary-profile-c1c2-1.0.csv": "4c44a971b4fb7b51da472b1dd8370cb64ff4234a", ".claude/skills/ai-sdlc-gates/scripts/data/reading-level-allowlist.txt": "af857f2957355719361953d507cbf289468db814", @@ -74,8 +74,8 @@ ".claude/skills/ai-sdlc-gates/scripts/GateAnnotation.Tests.ps1": "beb01f71d8706bd86de7bcc6a7bf583ba9ab6e5a", ".claude/skills/ai-sdlc-gates/scripts/gitleaks-rules.json": "27587aa74bfdd86b48ad9c50309b2b8521289c78", ".claude/skills/ai-sdlc-gates/scripts/gitleaks-version.json": "e77769fb5c7760c211010a6b48c01280b4ed7e44", - ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1": "1496061cc6f7233e2e45c69e232ce908dfd52fa2", - ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1": "843493058e08b645219e454da8e2095a573e841e", + ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1": "4d2c50872983f657a38a7d3bc1c9775ca427ec1d", + ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1": "354ee83c563550c58d763f2c99e5491148270e08", ".claude/skills/ai-sdlc-gates/scripts/Install-Apm.ps1": "63ea5061301759e7fb77d69fdbbc2c0fa9c5ff27", ".claude/skills/ai-sdlc-gates/scripts/Install-Apm.Tests.ps1": "b3188b0357d1b1ffa4252f4f78ce24338cdc2ab7", ".claude/skills/ai-sdlc-gates/scripts/Install-Gitleaks.ps1": "39083d99bb0c76ec3a0c2942582629cf4311a54f", @@ -86,7 +86,7 @@ ".claude/skills/ai-sdlc-gates/scripts/Invoke-LocalGates.Tests.ps1": "d4b40927c4a082145cb3948db8e4fb3d98af094b", ".claude/skills/ai-sdlc-gates/scripts/Invoke-PesterGate.ps1": "a265c27173a0bf2f5386d95ed64d1b5d6891b40f", ".claude/skills/ai-sdlc-gates/scripts/Invoke-PesterGate.Tests.ps1": "e0235955d187d956cc6a5fb3cf6ed2f6f2aa5d75", - ".claude/skills/ai-sdlc-gates/scripts/Invoke-Preflight.ps1": "046eb9978b912391af102fa96208b9e326a2df40", + ".claude/skills/ai-sdlc-gates/scripts/Invoke-Preflight.ps1": "d126656dbadaa0e508d3701e9c3e70197d8b48e5", ".claude/skills/ai-sdlc-gates/scripts/Invoke-Preflight.Tests.ps1": "cf8362c453d1f942a1d52244e191eaadf8ebcebe", ".claude/skills/ai-sdlc-gates/scripts/PreflightReceipt.psm1": "5c5c6b5c9a9ddf6c5a4fdaa1c5f5a55e026c5656", ".claude/skills/ai-sdlc-gates/scripts/PreflightReceipt.Tests.ps1": "629fb63e5e0389d072fbc96e7bc8f2b87f061075", @@ -95,7 +95,7 @@ ".claude/skills/ai-sdlc-gates/scripts/Sync-AgentsFile.Tests.ps1": "87533e139944a9dcc50eb45a5109e2ff5f16e63b", ".claude/skills/ai-sdlc-gates/scripts/Sync-AllowRules.ps1": "0466893efb2128502dfe5367058d70231a1c14c3", ".claude/skills/ai-sdlc-gates/scripts/Sync-AllowRules.Tests.ps1": "93de3d86a94954e2a57b6ab417454018efebf041", - ".claude/skills/ai-sdlc-gates/scripts/Test-GitleaksBaseline.ps1": "f81d05d23851892f5575f18afaa902eb7bf28b08", + ".claude/skills/ai-sdlc-gates/scripts/Test-GitleaksBaseline.ps1": "d90af9f6881677ca4308cd4b67f7e0cd8a628533", ".claude/skills/ai-sdlc-gates/scripts/Test-GitleaksBaseline.Tests.ps1": "ce362cbde96a8fcf61eb8793f075fe5f58ac9c3a", ".claude/skills/ai-sdlc-gates/scripts/Test-PushReceipt.ps1": "54ec6a3e42d488994ee91d0f4993ba5d3366d96a", ".claude/skills/ai-sdlc-gates/scripts/Test-PushReceipt.Tests.ps1": "74968692c13e072622dcc86e75759a5de35a62b4", @@ -114,7 +114,7 @@ ".claude/skills/ai-sdlc-handbook/references/docs-wiki.md": "038477c9b704a5b545decfe5e3f3f9970d8d1f9d", ".claude/skills/ai-sdlc-handbook/references/first-story.md": "be899eb395dafb2d704b8f0cb46bac1fb5e593c8", ".claude/skills/ai-sdlc-handbook/references/language.md": "b4ce85e8325cd5e59c13cb31564d6ff81ea71c7a", - ".claude/skills/ai-sdlc-handbook/references/layout.md": "d8d96770c46719c2ce9cdf14e12267cd607c1c4c", + ".claude/skills/ai-sdlc-handbook/references/layout.md": "2c96fa03da2a79f19e31769fe454e5c7f105a086", ".claude/skills/ai-sdlc-handbook/references/node-templates.md": "580c9c92c470a6abbaa0145cc3060ff1a11d247c", ".claude/skills/ai-sdlc-handbook/references/orchestration.md": "5b6c8c38a5d17ca59cc38794a7750355c508d262", ".claude/skills/ai-sdlc-handbook/references/pattern.md": "f0f2a8cf3dac267cda0fd3783d86bddba5afc7c0", diff --git a/core/.apm/skills/ai-sdlc-handbook/references/layout.md b/core/.apm/skills/ai-sdlc-handbook/references/layout.md index d8d9677..2c96fa0 100644 --- a/core/.apm/skills/ai-sdlc-handbook/references/layout.md +++ b/core/.apm/skills/ai-sdlc-handbook/references/layout.md @@ -128,6 +128,7 @@ installs. `AiSdlcConfig.psm1` takes each dependency whose path ends in `packs/ Date: Sat, 7 Nov 2026 14:36:39 +0100 Subject: [PATCH 2/7] Check the secret scan allow paths, show them, and read them from the clone for a baseline A repository widens its own secret scan with secretScan.allowPaths, so each pattern must be anchored, a valid regular expression, free of quotes and control characters, and must not match an ordinary file. A bad pattern stops the scan. The scan prints the paths it skips, so a reviewer sees a wider list in the gate output. Create-GitleaksBaseline.ps1 reads the list from the fresh clone, so the baseline follows what is committed. Refs #12 --- .../scripts/Create-GitleaksBaseline.ps1 | 5 +++-- .../scripts/GitleaksConfig.Tests.ps1 | 22 +++++++++++++++++++ .../ai-sdlc-gates/scripts/GitleaksConfig.psm1 | 20 ++++++++++++++++- .../skills/ai-sdlc-gates/sync-manifest.json | 6 ++--- apm.lock.yaml | 16 +++++++------- .../scripts/Create-GitleaksBaseline.ps1 | 5 +++-- .../scripts/GitleaksConfig.Tests.ps1 | 22 +++++++++++++++++++ .../ai-sdlc-gates/scripts/GitleaksConfig.psm1 | 20 ++++++++++++++++- .../skills/ai-sdlc-gates/sync-manifest.json | 6 ++--- 9 files changed, 102 insertions(+), 20 deletions(-) diff --git a/.claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1 b/.claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1 index 4f0712b..f9ec411 100644 --- a/.claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1 +++ b/.claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1 @@ -131,9 +131,10 @@ try { git clone --quiet $remoteUrl $tempDirectory if ($LASTEXITCODE -ne 0 -or -not (Test-Path -LiteralPath $tempDirectory)) { throw "git clone of $remoteUrl failed with exit code $LASTEXITCODE" } - # The pinned rules plus both allowlists: the one of the AI-SDLC and secretScan.allowPaths of aisdlc.json. + # The pinned rules plus both allowlists: the one of the AI-SDLC and secretScan.allowPaths of the + # aisdlc.json in the clone, so the baseline follows what is committed, not the working copy. Import-Module (Join-Path $PSScriptRoot 'GitleaksConfig.psm1') -Force - $scanConfig = New-GitleaksConfig -Path (Join-Path $tempDrive ('gitleaks-ai-sdlc-' + [guid]::NewGuid().ToString('n') + '.toml')) -RulesPath $gitleakconfigurationFile -RepoRoot $currentDirectory + $scanConfig = New-GitleaksConfig -Path (Join-Path $tempDrive ('gitleaks-ai-sdlc-' + [guid]::NewGuid().ToString('n') + '.toml')) -RulesPath $gitleakconfigurationFile -RepoRoot $tempDirectory Write-Host "Running gitleaks on the clone to create baseline file: $gitleaksBaselinePath" gitleaks git $tempDirectory --config "$scanConfig" --report-format=json --redact --report-path "$gitleaksBaselinePath" --exit-code=99 $scanExit = $LASTEXITCODE diff --git a/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 b/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 index 354ee83..43ac156 100644 --- a/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 +++ b/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 @@ -104,6 +104,28 @@ Describe 'GitleaksConfig' { $with | Should -Be $without } + It 'refuses a pattern that is , and names the field' -ForEach @( + @{ Why = 'not anchored'; Pattern = 'secrets\\.yaml' } + @{ Why = 'a match for every path'; Pattern = '^.*' } + @{ Why = 'a match for any file in a folder'; Pattern = '(^|/)' } + @{ Why = 'holding a quote'; Pattern = "^a'''b" } + @{ Why = 'not a regular expression'; Pattern = '^a[' } + ) { + $json = @{ secretScan = @{ allowPaths = @($Pattern) } } | ConvertTo-Json -Depth 3 + Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value $json + + { New-GitleaksConfig -Path (Join-Path $TestDrive 'bad.toml') -RepoRoot $script:Repo } | Should -Throw '*secretScan.allowPaths*' + } + + It 'says which paths the scan skips, so a reviewer sees a wider list' { + Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "^\\.storage/" ] } }' + + $out = New-GitleaksConfig -Path (Join-Path $TestDrive 'shown.toml') -RepoRoot $script:Repo 6>&1 | Out-String + + $out | Should -Match 'secretScan\.allowPaths' + $out | Should -Match ([regex]::Escape('^\.storage/')) + } + It 'makes gitleaks skip a named path, and still find the same secret elsewhere' -Skip:(-not (Get-Command gitleaks -ErrorAction SilentlyContinue)) { Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "(^|/)secrets\\.yaml$" ] } }' $scan = Join-Path $script:Repo 'scan' diff --git a/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 b/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 index 4d2c508..4647a22 100644 --- a/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 +++ b/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 @@ -80,7 +80,24 @@ function Get-GitleaksRepoAllowedPath { param([Parameter(Mandatory)][string]$RepoRoot) $config = Get-AiSdlcConfig -RepoRoot $RepoRoot - return @($config.secretScan.allowPaths | Where-Object { $_ }) + $patterns = @($config.secretScan.allowPaths | Where-Object { $_ }) + # A repository widens its own secret scan here, so each pattern must stay narrow: anchored at the + # start of a path or of a folder, a valid regular expression, and no match for an ordinary file. + $ordinary = @('README.md', 'src/main.cs', 'a/b/c.txt', 'config/settings.json') + foreach ($pattern in $patterns) { + $reason = if ($pattern -isnot [string]) { 'is not a string' } + elseif ($pattern -match "['`"\p{Cc}]") { 'holds a quote or a control character' } + elseif ($pattern -notmatch '^(\^|\(\^\|/\))') { 'is not anchored: start it with ^ or (^|/)' } + else { + try { + $regex = [regex]::new($pattern) + if (@($ordinary | Where-Object { $regex.IsMatch($_) }).Count -gt 0) { 'matches ordinary files, so it would hide real leaks' } + } + catch { 'is not a valid regular expression' } + } + if ($reason) { throw "secretScan.allowPaths in aisdlc.json: the pattern '$pattern' $reason. Nothing was scanned." } + } + return $patterns } function New-GitleaksConfig { @@ -111,6 +128,7 @@ function New-GitleaksConfig { ) $repoPaths = if ($RepoRoot) { @(Get-GitleaksRepoAllowedPath -RepoRoot $RepoRoot) } else { @() } if ($repoPaths.Count -gt 0) { + Write-Host "The secret scan skips the paths in secretScan.allowPaths of aisdlc.json: $($repoPaths -join ', ')" $toml += @( '[[allowlists]]' 'description = "Paths the repository holds secrets in on purpose: secretScan.allowPaths in aisdlc.json."' diff --git a/.claude/skills/ai-sdlc-gates/sync-manifest.json b/.claude/skills/ai-sdlc-gates/sync-manifest.json index 53deae5..d285280 100644 --- a/.claude/skills/ai-sdlc-gates/sync-manifest.json +++ b/.claude/skills/ai-sdlc-gates/sync-manifest.json @@ -60,7 +60,7 @@ ".claude/skills/ai-sdlc-gates/scripts/Check-SkillHygiene.Tests.ps1": "870de5ec3bd461267325f02e09a657780a5b2e32", ".claude/skills/ai-sdlc-gates/scripts/Check-SyncManifest.ps1": "ebe73f4ced6ee337e8d7f78e2afbdebc59c7274f", ".claude/skills/ai-sdlc-gates/scripts/Check-SyncManifest.Tests.ps1": "f780c435e15a095b4ed8c29fc03aacbac435f557", - ".claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1": "4f0712b2b023d5cf8d0dc631a16646e9e3a6f5e1", + ".claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1": "f9ec411c8663d771b516b302ef4fd1a10ca85e03", ".claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.Tests.ps1": "dbe0ba9cedb0dd413c06ca14a192ea45e7636298", ".claude/skills/ai-sdlc-gates/scripts/data/cefrj-vocabulary-profile-1.5.csv": "1a9cee97a531d04c67751eb4049127c4227bd26a", ".claude/skills/ai-sdlc-gates/scripts/data/octanove-vocabulary-profile-c1c2-1.0.csv": "4c44a971b4fb7b51da472b1dd8370cb64ff4234a", @@ -74,8 +74,8 @@ ".claude/skills/ai-sdlc-gates/scripts/GateAnnotation.Tests.ps1": "beb01f71d8706bd86de7bcc6a7bf583ba9ab6e5a", ".claude/skills/ai-sdlc-gates/scripts/gitleaks-rules.json": "27587aa74bfdd86b48ad9c50309b2b8521289c78", ".claude/skills/ai-sdlc-gates/scripts/gitleaks-version.json": "e77769fb5c7760c211010a6b48c01280b4ed7e44", - ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1": "4d2c50872983f657a38a7d3bc1c9775ca427ec1d", - ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1": "354ee83c563550c58d763f2c99e5491148270e08", + ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1": "4647a221331df87f1638698d5d321a3061299856", + ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1": "43ac156211b5dab24fb0bc0919a634bd8eb96a59", ".claude/skills/ai-sdlc-gates/scripts/Install-Apm.ps1": "63ea5061301759e7fb77d69fdbbc2c0fa9c5ff27", ".claude/skills/ai-sdlc-gates/scripts/Install-Apm.Tests.ps1": "b3188b0357d1b1ffa4252f4f78ce24338cdc2ab7", ".claude/skills/ai-sdlc-gates/scripts/Install-Gitleaks.ps1": "39083d99bb0c76ec3a0c2942582629cf4311a54f", diff --git a/apm.lock.yaml b/apm.lock.yaml index c6d5dbd..a9bc981 100644 --- a/apm.lock.yaml +++ b/apm.lock.yaml @@ -287,15 +287,15 @@ dependencies: .claude/skills/ai-sdlc-gates/scripts/Check-SyncManifest.Tests.ps1: sha256:509b0ddb057d2f457ae93c3d4888b305dbdd0734d85008a76a4c4fb206c144c0 .claude/skills/ai-sdlc-gates/scripts/Check-SyncManifest.ps1: sha256:20a77ea71e24895b3eb27452f082a9f498cc72e484b5e64af20393c667ad3cb6 .claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.Tests.ps1: sha256:005b503c202871965b5c044812cb13ee8ae5dae741a5e5c623a679be96456d78 - .claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1: sha256:6e3183ac72cabbf6056d28f003794cd1a1324e2fb5b351f5f649d5e6ea21dbc1 + .claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1: sha256:1f7ce301cf61f60c699a8596e1516de31fc9f77cbd508794cb2bb23ff693987f .claude/skills/ai-sdlc-gates/scripts/DocCoverage.Tests.ps1: sha256:a6e75191d84f6362a083c067ee26f90bbe0fe9f3960c7fd922e9f207adca2fad .claude/skills/ai-sdlc-gates/scripts/DocCoverage.psm1: sha256:48eddcb174858783e871b0f248a389af59c0aa4feec8ce60bd9640deb9f6a959 .claude/skills/ai-sdlc-gates/scripts/DocToolTestHarness.Tests.ps1: sha256:15cb191503775a83de29d49ccc821d6b43f6c54edfbb4b35a6423db0d43a1e5c .claude/skills/ai-sdlc-gates/scripts/DocToolTestHarness.psm1: sha256:3d62a22fb1955b60aa915b0d9aad19b673df63359eecc22af7c8d004319b6079 .claude/skills/ai-sdlc-gates/scripts/GateAnnotation.Tests.ps1: sha256:cfb83154d61fba1c838a5a66b17f548c5d9d15bacda86a72525ee1222eab76e2 .claude/skills/ai-sdlc-gates/scripts/GateAnnotation.psm1: sha256:8a2db889b816c395cf89c049c8674b36c362dcb0da9bdf2248e01451ccda7705 - .claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1: sha256:a0175a21f1062738bbfda292dd192603e5b40f36ea53b48c48a95b0485bdb820 - .claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1: sha256:b25806104bd6ccb804e5ec0834943aa255cd9c5fd9d27e1586de4b50ca08d5d9 + .claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1: sha256:f86796d9be94a8909aa961c8b4397b731187ac35470f608b1ddba01c2d27ed46 + .claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1: sha256:5d6280fa16c76d853f75ec8af21ce37ac01510237874d690b7ab5041a09d02f4 .claude/skills/ai-sdlc-gates/scripts/Install-Apm.Tests.ps1: sha256:99b5da9c54ce47175b0ba1d9d86602fa85d2b68c94dd319717cf706ccb95e0d5 .claude/skills/ai-sdlc-gates/scripts/Install-Apm.ps1: sha256:1afa7c30042fb04c12a9ee6b2ffe43292b1c4aa56033ac497cd91d3671896247 .claude/skills/ai-sdlc-gates/scripts/Install-Gitleaks.Tests.ps1: sha256:73478c06f7b6b25e462346344d5b55556eec41b9c09423459e7e7e73b77bd6d7 @@ -331,7 +331,7 @@ dependencies: .claude/skills/ai-sdlc-gates/scripts/gitleaks-rules.json: sha256:6a8a75c5dbcf2378a1c52d046e34ce275aac7ce08a0ae61408d25c18e1e27014 .claude/skills/ai-sdlc-gates/scripts/gitleaks-version.json: sha256:c54acb854f87a1bbdf0e90c670b72b5de3cd37f7e460d82eca599c3c7af23a84 .claude/skills/ai-sdlc-gates/skill-catalog.json: sha256:5537684656bf189a740ba7e9e7050083af05668d00501ce1e9c6909cb8b91203 - .claude/skills/ai-sdlc-gates/sync-manifest.json: sha256:fa6cbb56038e695c301e558a24861cedb3eca3bac57fee1fcff0701c90bdb868 + .claude/skills/ai-sdlc-gates/sync-manifest.json: sha256:3a5abfb576b5a4d53776c1955dddf3a09a83755d722778919c1f16f61279859e .claude/skills/ai-sdlc-handbook/SKILL.md: sha256:548e6b9ad79d3d2afa2f5779835988eeb12c49cda08917c4bbaa9ac0486a47a0 .claude/skills/ai-sdlc-handbook/references/README.md: sha256:654afcaa2b81f560eff93dbdef521b09ced06137a1dbb85d70a4e14ef7502248 .claude/skills/ai-sdlc-handbook/references/artifact-graph.md: sha256:d7ddfe20e5ee6565bcf25f9cef0f578da2a4ab1590033d791b8814d4688fd1f0 @@ -1155,7 +1155,7 @@ deployments: owners: - ./core active_owner: ./core - content_hash: sha256:6e3183ac72cabbf6056d28f003794cd1a1324e2fb5b351f5f649d5e6ea21dbc1 + content_hash: sha256:1f7ce301cf61f60c699a8596e1516de31fc9f77cbd508794cb2bb23ff693987f - kind: project-relative target: claude value: .claude/skills/ai-sdlc-gates/scripts/DocCoverage.Tests.ps1 @@ -1218,7 +1218,7 @@ deployments: owners: - ./core active_owner: ./core - content_hash: sha256:a0175a21f1062738bbfda292dd192603e5b40f36ea53b48c48a95b0485bdb820 + content_hash: sha256:f86796d9be94a8909aa961c8b4397b731187ac35470f608b1ddba01c2d27ed46 - kind: project-relative target: claude value: .claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 @@ -1227,7 +1227,7 @@ deployments: owners: - ./core active_owner: ./core - content_hash: sha256:b25806104bd6ccb804e5ec0834943aa255cd9c5fd9d27e1586de4b50ca08d5d9 + content_hash: sha256:5d6280fa16c76d853f75ec8af21ce37ac01510237874d690b7ab5041a09d02f4 - kind: project-relative target: claude value: .claude/skills/ai-sdlc-gates/scripts/Install-Apm.Tests.ps1 @@ -1551,7 +1551,7 @@ deployments: owners: - ./core active_owner: ./core - content_hash: sha256:fa6cbb56038e695c301e558a24861cedb3eca3bac57fee1fcff0701c90bdb868 + content_hash: sha256:3a5abfb576b5a4d53776c1955dddf3a09a83755d722778919c1f16f61279859e - kind: project-relative target: claude value: .claude/skills/ai-sdlc-handbook diff --git a/core/.apm/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1 b/core/.apm/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1 index 4f0712b..f9ec411 100644 --- a/core/.apm/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1 +++ b/core/.apm/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1 @@ -131,9 +131,10 @@ try { git clone --quiet $remoteUrl $tempDirectory if ($LASTEXITCODE -ne 0 -or -not (Test-Path -LiteralPath $tempDirectory)) { throw "git clone of $remoteUrl failed with exit code $LASTEXITCODE" } - # The pinned rules plus both allowlists: the one of the AI-SDLC and secretScan.allowPaths of aisdlc.json. + # The pinned rules plus both allowlists: the one of the AI-SDLC and secretScan.allowPaths of the + # aisdlc.json in the clone, so the baseline follows what is committed, not the working copy. Import-Module (Join-Path $PSScriptRoot 'GitleaksConfig.psm1') -Force - $scanConfig = New-GitleaksConfig -Path (Join-Path $tempDrive ('gitleaks-ai-sdlc-' + [guid]::NewGuid().ToString('n') + '.toml')) -RulesPath $gitleakconfigurationFile -RepoRoot $currentDirectory + $scanConfig = New-GitleaksConfig -Path (Join-Path $tempDrive ('gitleaks-ai-sdlc-' + [guid]::NewGuid().ToString('n') + '.toml')) -RulesPath $gitleakconfigurationFile -RepoRoot $tempDirectory Write-Host "Running gitleaks on the clone to create baseline file: $gitleaksBaselinePath" gitleaks git $tempDirectory --config "$scanConfig" --report-format=json --redact --report-path "$gitleaksBaselinePath" --exit-code=99 $scanExit = $LASTEXITCODE diff --git a/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 b/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 index 354ee83..43ac156 100644 --- a/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 +++ b/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 @@ -104,6 +104,28 @@ Describe 'GitleaksConfig' { $with | Should -Be $without } + It 'refuses a pattern that is , and names the field' -ForEach @( + @{ Why = 'not anchored'; Pattern = 'secrets\\.yaml' } + @{ Why = 'a match for every path'; Pattern = '^.*' } + @{ Why = 'a match for any file in a folder'; Pattern = '(^|/)' } + @{ Why = 'holding a quote'; Pattern = "^a'''b" } + @{ Why = 'not a regular expression'; Pattern = '^a[' } + ) { + $json = @{ secretScan = @{ allowPaths = @($Pattern) } } | ConvertTo-Json -Depth 3 + Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value $json + + { New-GitleaksConfig -Path (Join-Path $TestDrive 'bad.toml') -RepoRoot $script:Repo } | Should -Throw '*secretScan.allowPaths*' + } + + It 'says which paths the scan skips, so a reviewer sees a wider list' { + Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "^\\.storage/" ] } }' + + $out = New-GitleaksConfig -Path (Join-Path $TestDrive 'shown.toml') -RepoRoot $script:Repo 6>&1 | Out-String + + $out | Should -Match 'secretScan\.allowPaths' + $out | Should -Match ([regex]::Escape('^\.storage/')) + } + It 'makes gitleaks skip a named path, and still find the same secret elsewhere' -Skip:(-not (Get-Command gitleaks -ErrorAction SilentlyContinue)) { Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "(^|/)secrets\\.yaml$" ] } }' $scan = Join-Path $script:Repo 'scan' diff --git a/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 b/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 index 4d2c508..4647a22 100644 --- a/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 +++ b/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 @@ -80,7 +80,24 @@ function Get-GitleaksRepoAllowedPath { param([Parameter(Mandatory)][string]$RepoRoot) $config = Get-AiSdlcConfig -RepoRoot $RepoRoot - return @($config.secretScan.allowPaths | Where-Object { $_ }) + $patterns = @($config.secretScan.allowPaths | Where-Object { $_ }) + # A repository widens its own secret scan here, so each pattern must stay narrow: anchored at the + # start of a path or of a folder, a valid regular expression, and no match for an ordinary file. + $ordinary = @('README.md', 'src/main.cs', 'a/b/c.txt', 'config/settings.json') + foreach ($pattern in $patterns) { + $reason = if ($pattern -isnot [string]) { 'is not a string' } + elseif ($pattern -match "['`"\p{Cc}]") { 'holds a quote or a control character' } + elseif ($pattern -notmatch '^(\^|\(\^\|/\))') { 'is not anchored: start it with ^ or (^|/)' } + else { + try { + $regex = [regex]::new($pattern) + if (@($ordinary | Where-Object { $regex.IsMatch($_) }).Count -gt 0) { 'matches ordinary files, so it would hide real leaks' } + } + catch { 'is not a valid regular expression' } + } + if ($reason) { throw "secretScan.allowPaths in aisdlc.json: the pattern '$pattern' $reason. Nothing was scanned." } + } + return $patterns } function New-GitleaksConfig { @@ -111,6 +128,7 @@ function New-GitleaksConfig { ) $repoPaths = if ($RepoRoot) { @(Get-GitleaksRepoAllowedPath -RepoRoot $RepoRoot) } else { @() } if ($repoPaths.Count -gt 0) { + Write-Host "The secret scan skips the paths in secretScan.allowPaths of aisdlc.json: $($repoPaths -join ', ')" $toml += @( '[[allowlists]]' 'description = "Paths the repository holds secrets in on purpose: secretScan.allowPaths in aisdlc.json."' diff --git a/core/.apm/skills/ai-sdlc-gates/sync-manifest.json b/core/.apm/skills/ai-sdlc-gates/sync-manifest.json index 53deae5..d285280 100644 --- a/core/.apm/skills/ai-sdlc-gates/sync-manifest.json +++ b/core/.apm/skills/ai-sdlc-gates/sync-manifest.json @@ -60,7 +60,7 @@ ".claude/skills/ai-sdlc-gates/scripts/Check-SkillHygiene.Tests.ps1": "870de5ec3bd461267325f02e09a657780a5b2e32", ".claude/skills/ai-sdlc-gates/scripts/Check-SyncManifest.ps1": "ebe73f4ced6ee337e8d7f78e2afbdebc59c7274f", ".claude/skills/ai-sdlc-gates/scripts/Check-SyncManifest.Tests.ps1": "f780c435e15a095b4ed8c29fc03aacbac435f557", - ".claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1": "4f0712b2b023d5cf8d0dc631a16646e9e3a6f5e1", + ".claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.ps1": "f9ec411c8663d771b516b302ef4fd1a10ca85e03", ".claude/skills/ai-sdlc-gates/scripts/Create-GitleaksBaseline.Tests.ps1": "dbe0ba9cedb0dd413c06ca14a192ea45e7636298", ".claude/skills/ai-sdlc-gates/scripts/data/cefrj-vocabulary-profile-1.5.csv": "1a9cee97a531d04c67751eb4049127c4227bd26a", ".claude/skills/ai-sdlc-gates/scripts/data/octanove-vocabulary-profile-c1c2-1.0.csv": "4c44a971b4fb7b51da472b1dd8370cb64ff4234a", @@ -74,8 +74,8 @@ ".claude/skills/ai-sdlc-gates/scripts/GateAnnotation.Tests.ps1": "beb01f71d8706bd86de7bcc6a7bf583ba9ab6e5a", ".claude/skills/ai-sdlc-gates/scripts/gitleaks-rules.json": "27587aa74bfdd86b48ad9c50309b2b8521289c78", ".claude/skills/ai-sdlc-gates/scripts/gitleaks-version.json": "e77769fb5c7760c211010a6b48c01280b4ed7e44", - ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1": "4d2c50872983f657a38a7d3bc1c9775ca427ec1d", - ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1": "354ee83c563550c58d763f2c99e5491148270e08", + ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1": "4647a221331df87f1638698d5d321a3061299856", + ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1": "43ac156211b5dab24fb0bc0919a634bd8eb96a59", ".claude/skills/ai-sdlc-gates/scripts/Install-Apm.ps1": "63ea5061301759e7fb77d69fdbbc2c0fa9c5ff27", ".claude/skills/ai-sdlc-gates/scripts/Install-Apm.Tests.ps1": "b3188b0357d1b1ffa4252f4f78ce24338cdc2ab7", ".claude/skills/ai-sdlc-gates/scripts/Install-Gitleaks.ps1": "39083d99bb0c76ec3a0c2942582629cf4311a54f", From 40d5555e30d0da890b94716dd65fc0b7837e352c Mon Sep 17 00:00:00 2001 From: Rob Hofmann Date: Sun, 8 Nov 2026 14:36:46 +0100 Subject: [PATCH 3/7] Give the full link to every pull request, issue or page a reply points to Refs #14 --- .claude/skills/ai-sdlc-gates/assets/agents-core.md | 2 +- .claude/skills/ai-sdlc-handbook/references/language.md | 3 +++ AGENTS.md | 2 +- CHANGELOG.md | 3 +++ apm.lock.yaml | 8 ++++---- core/.apm/skills/ai-sdlc-gates/assets/agents-core.md | 2 +- core/.apm/skills/ai-sdlc-gates/sync-manifest.json | 4 ++-- core/.apm/skills/ai-sdlc-handbook/references/language.md | 3 +++ 8 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.claude/skills/ai-sdlc-gates/assets/agents-core.md b/.claude/skills/ai-sdlc-gates/assets/agents-core.md index 4170c42..f7e4564 100644 --- a/.claude/skills/ai-sdlc-gates/assets/agents-core.md +++ b/.claude/skills/ai-sdlc-gates/assets/agents-core.md @@ -2,7 +2,7 @@ Say the main thing first: the answer, the decision, or the result. Give the reason after it, and only when the reason changes what the reader does next. Lead with the action or the result, number the steps, and end with one -next action. Cut every word that adds nothing. Say what you assume, what can go wrong, and what you have not +next action. Give the full link to every pull request, issue or page the reader must open. Cut every word that adds nothing. Say what you assume, what can go wrong, and what you have not checked. When a request can be read in more than one way, ask one question to make it clear before you start. Inside a run, look up what the substrate holds. Before Checkpoint Alpha, `grilling` asks the rest in rounds, and what the person leaves open goes to Checkpoint Alpha. In the build loop, an unclear story is a stop; any other open diff --git a/.claude/skills/ai-sdlc-handbook/references/language.md b/.claude/skills/ai-sdlc-handbook/references/language.md index b4ce85e..ca703ed 100644 --- a/.claude/skills/ai-sdlc-handbook/references/language.md +++ b/.claude/skills/ai-sdlc-handbook/references/language.md @@ -130,6 +130,9 @@ structure of a reply, so the reader can act on it at once: - The first line of a chat reply is the result, or something the reader can do. - A task with several steps is a numbered list, with one bounded action per step. - End with one concrete next action, small enough to do now. +- Give the full link to every pull request, issue, pipeline run or page that the reader must open or act + on. Put it next to the step that needs it, so the reader does not have to search. A number alone, such + as `#13`, is not a link. - One topic per reply. Offer a side issue separately, in one line, instead of mixing it in. - On long work, say where you are, for example "step 3 of 5 done". - State an error as its cause and its fix, in a matter-of-fact tone. diff --git a/AGENTS.md b/AGENTS.md index bb88fc7..7a7c6ff 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -9,7 +9,7 @@ this file says how to change it without breaking a consumer. Say the main thing first: the answer, the decision, or the result. Give the reason after it, and only when the reason changes what the reader does next. Lead with the action or the result, number the steps, and end with one -next action. Cut every word that adds nothing. Say what you assume, what can go wrong, and what you have not +next action. Give the full link to every pull request, issue or page the reader must open. Cut every word that adds nothing. Say what you assume, what can go wrong, and what you have not checked. When a request can be read in more than one way, ask one question to make it clear before you start. Inside a run, look up what the substrate holds. Before Checkpoint Alpha, `grilling` asks the rest in rounds, and what the person leaves open goes to Checkpoint Alpha. In the build loop, an unclear story is a stop; any other open diff --git a/CHANGELOG.md b/CHANGELOG.md index 9022c9d..d6ad234 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ Each entry names its issue, as `#42`. ## v1.2.0 - 2026-11-07 +- A reply, work item or page gives the full link to every pull request, issue or page that the reader + must open or act on (#14). The rule is in `language.md` and in the `## Communication` part of + `AGENTS.md`. - A repository can name the paths that hold secrets on purpose in `secretScan.allowPaths` of `aisdlc.json` (#12). The secret scan skips them in the pre-flight, in the C03 gate and in a new baseline, through a second allowlist that `GitleaksConfig.psm1` writes. `Create-GitleaksBaseline.ps1` diff --git a/apm.lock.yaml b/apm.lock.yaml index a9bc981..9ea394d 100644 --- a/apm.lock.yaml +++ b/apm.lock.yaml @@ -246,7 +246,7 @@ dependencies: .claude/skills/adr-conventions/SKILL.md: sha256:819d4d4e8f584dc0dddd8a32cc16669317fe13a89acca9c190ff565f7923340b .claude/skills/ai-sdlc-gates/SKILL.md: sha256:09165e4e714d27feedf2c07f0da9e3e4ceb485cbb8171b959428705c1247a83e .claude/skills/ai-sdlc-gates/assets/actions/ai-sdlc-pr/action.yml: sha256:ee6430668f2f44b6256275645e10f8ab2167b8b6d49990465c5527d1b334abac - .claude/skills/ai-sdlc-gates/assets/agents-core.md: sha256:9cc1689bcbd9f2a692fd77e49ca326be152ec24cbb67de6a35ca4eb3f8136fb5 + .claude/skills/ai-sdlc-gates/assets/agents-core.md: sha256:544bb5b78ceaa2ee9eb20203ecdef5d380ecd9b10265cc90d10385d96ed72509 .claude/skills/ai-sdlc-gates/gates.json: sha256:160f09f14ff6591b024f827c879802cf9218b37785d209da6a1323602d6153e5 .claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.Tests.ps1: sha256:dabc8f1c63a903818c4eb46f27eb35769914dc6a4330dc2865a4b756300cb706 .claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.psm1: sha256:63d1161e057b49953e5704e55a0d6091c4a1d6526d8818b26ff96cd69aad133c @@ -342,7 +342,7 @@ dependencies: .claude/skills/ai-sdlc-handbook/references/context-management.md: sha256:16146693f00f638bf428a52bb32a5cd9516ec419f86ea1690243295496b226df .claude/skills/ai-sdlc-handbook/references/docs-wiki.md: sha256:2bd6f3a8e64f9db16163519767b822e4ebcffd740e3c5cbff17281ad71d264b7 .claude/skills/ai-sdlc-handbook/references/first-story.md: sha256:831552230cc16386ee01d7c730e288ef19aca5a66fafb00e1dfbbf4e9788caf2 - .claude/skills/ai-sdlc-handbook/references/language.md: sha256:72acd3a0946586799037ebc3536307f5b852fde1c8d07bebaad418e3303493b9 + .claude/skills/ai-sdlc-handbook/references/language.md: sha256:e0e32fae9c9fcdd23380d92ec910128254ce248538940541f5789ca78228a023 .claude/skills/ai-sdlc-handbook/references/layout.md: sha256:4bd2921479822b4748f2b9842c6955a9ee8efb961bdc880f7e90057bc892060c .claude/skills/ai-sdlc-handbook/references/node-templates.md: sha256:8664ad1f85bff48d6230ed22e3f25683f378822e566c2a1454cbb204f4bb8fad .claude/skills/ai-sdlc-handbook/references/orchestration.md: sha256:05513a9f99f14f281a91da176e9eb39c95f6d939ff33ecca2390c784190546c4 @@ -786,7 +786,7 @@ deployments: owners: - ./core active_owner: ./core - content_hash: sha256:9cc1689bcbd9f2a692fd77e49ca326be152ec24cbb67de6a35ca4eb3f8136fb5 + content_hash: sha256:544bb5b78ceaa2ee9eb20203ecdef5d380ecd9b10265cc90d10385d96ed72509 - kind: project-relative target: claude value: .claude/skills/ai-sdlc-gates/gates.json @@ -1659,7 +1659,7 @@ deployments: owners: - ./core active_owner: ./core - content_hash: sha256:72acd3a0946586799037ebc3536307f5b852fde1c8d07bebaad418e3303493b9 + content_hash: sha256:e0e32fae9c9fcdd23380d92ec910128254ce248538940541f5789ca78228a023 - kind: project-relative target: claude value: .claude/skills/ai-sdlc-handbook/references/layout.md diff --git a/core/.apm/skills/ai-sdlc-gates/assets/agents-core.md b/core/.apm/skills/ai-sdlc-gates/assets/agents-core.md index 4170c42..f7e4564 100644 --- a/core/.apm/skills/ai-sdlc-gates/assets/agents-core.md +++ b/core/.apm/skills/ai-sdlc-gates/assets/agents-core.md @@ -2,7 +2,7 @@ Say the main thing first: the answer, the decision, or the result. Give the reason after it, and only when the reason changes what the reader does next. Lead with the action or the result, number the steps, and end with one -next action. Cut every word that adds nothing. Say what you assume, what can go wrong, and what you have not +next action. Give the full link to every pull request, issue or page the reader must open. Cut every word that adds nothing. Say what you assume, what can go wrong, and what you have not checked. When a request can be read in more than one way, ask one question to make it clear before you start. Inside a run, look up what the substrate holds. Before Checkpoint Alpha, `grilling` asks the rest in rounds, and what the person leaves open goes to Checkpoint Alpha. In the build loop, an unclear story is a stop; any other open diff --git a/core/.apm/skills/ai-sdlc-gates/sync-manifest.json b/core/.apm/skills/ai-sdlc-gates/sync-manifest.json index d285280..e2c29e6 100644 --- a/core/.apm/skills/ai-sdlc-gates/sync-manifest.json +++ b/core/.apm/skills/ai-sdlc-gates/sync-manifest.json @@ -19,7 +19,7 @@ ".claude/skills/adopt-docs/SKILL.md": "49d399e7d200650cb156aa320761e94843018ab2", ".claude/skills/adr-conventions/SKILL.md": "26e170df5a60858e25afe9176fa428f42affb1bb", ".claude/skills/ai-sdlc-gates/assets/actions/ai-sdlc-pr/action.yml": "f80ed84d896859668d74cd47bf327a714d383f8a", - ".claude/skills/ai-sdlc-gates/assets/agents-core.md": "4170c4291b02cb6515f3860b23716d2069fd528b", + ".claude/skills/ai-sdlc-gates/assets/agents-core.md": "f7e45643bf0f5447d480b588784b2c599cc7f320", ".claude/skills/ai-sdlc-gates/gates.json": "cf6f5a2d284f0b22f0f4a89292037caed3e53c19", ".claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.psm1": "afaad1b3853d71d4f1016e2f9f9df4a1ffdbc03d", ".claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.Tests.ps1": "2ad1609653980ca3bada51c7cd470e4ba6ffcbe9", @@ -113,7 +113,7 @@ ".claude/skills/ai-sdlc-handbook/references/context-management.md": "e284e60ca4d5e2624be79b5ce247e0662e430e3d", ".claude/skills/ai-sdlc-handbook/references/docs-wiki.md": "038477c9b704a5b545decfe5e3f3f9970d8d1f9d", ".claude/skills/ai-sdlc-handbook/references/first-story.md": "be899eb395dafb2d704b8f0cb46bac1fb5e593c8", - ".claude/skills/ai-sdlc-handbook/references/language.md": "b4ce85e8325cd5e59c13cb31564d6ff81ea71c7a", + ".claude/skills/ai-sdlc-handbook/references/language.md": "ca703edeb9e07e28e32a39fbcc9116b64db444d8", ".claude/skills/ai-sdlc-handbook/references/layout.md": "2c96fa03da2a79f19e31769fe454e5c7f105a086", ".claude/skills/ai-sdlc-handbook/references/node-templates.md": "580c9c92c470a6abbaa0145cc3060ff1a11d247c", ".claude/skills/ai-sdlc-handbook/references/orchestration.md": "5b6c8c38a5d17ca59cc38794a7750355c508d262", diff --git a/core/.apm/skills/ai-sdlc-handbook/references/language.md b/core/.apm/skills/ai-sdlc-handbook/references/language.md index b4ce85e..ca703ed 100644 --- a/core/.apm/skills/ai-sdlc-handbook/references/language.md +++ b/core/.apm/skills/ai-sdlc-handbook/references/language.md @@ -130,6 +130,9 @@ structure of a reply, so the reader can act on it at once: - The first line of a chat reply is the result, or something the reader can do. - A task with several steps is a numbered list, with one bounded action per step. - End with one concrete next action, small enough to do now. +- Give the full link to every pull request, issue, pipeline run or page that the reader must open or act + on. Put it next to the step that needs it, so the reader does not have to search. A number alone, such + as `#13`, is not a link. - One topic per reply. Offer a side issue separately, in one line, instead of mixing it in. - On long work, say where you are, for example "step 3 of 5 done". - State an error as its cause and its fix, in a matter-of-fact tone. From 512f986254c196670e076ed13c3a7dde56b81fac Mon Sep 17 00:00:00 2001 From: Rob Hofmann Date: Sun, 8 Nov 2026 15:16:20 +0100 Subject: [PATCH 4/7] Use neutral example paths for the secret scan allow paths Refs #12 --- .../scripts/GitleaksConfig.Tests.ps1 | 16 ++++++++-------- .claude/skills/ai-sdlc-gates/sync-manifest.json | 4 ++-- .../skills/ai-sdlc-handbook/references/layout.md | 2 +- apm.lock.yaml | 12 ++++++------ .../scripts/GitleaksConfig.Tests.ps1 | 16 ++++++++-------- .../.apm/skills/ai-sdlc-gates/sync-manifest.json | 4 ++-- .../skills/ai-sdlc-handbook/references/layout.md | 2 +- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 b/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 index 43ac156..853079b 100644 --- a/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 +++ b/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 @@ -86,13 +86,13 @@ Describe 'GitleaksConfig' { } It 'adds them as an allowlist of their own, next to the allowlist of the AI-SDLC' { - Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "^\\.storage/", "(^|/)secrets\\.yaml$" ] } }' + Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "^\\.runtime/", "(^|/)app-secrets\\.yaml$" ] } }' $text = Get-Content -LiteralPath (New-GitleaksConfig -Path (Join-Path $TestDrive 'repo.toml') -RepoRoot $script:Repo) -Raw ([regex]::Matches($text, '(?m)^\[\[allowlists\]\]')).Count | Should -Be 2 - $text | Should -Match ([regex]::Escape("'''^\.storage/'''")) - $text | Should -Match ([regex]::Escape("'''(^|/)secrets\.yaml$'''")) + $text | Should -Match ([regex]::Escape("'''^\.runtime/'''")) + $text | Should -Match ([regex]::Escape("'''(^|/)app-secrets\.yaml$'''")) } It 'writes the same config as before when aisdlc.json names no paths' { @@ -105,7 +105,7 @@ Describe 'GitleaksConfig' { } It 'refuses a pattern that is , and names the field' -ForEach @( - @{ Why = 'not anchored'; Pattern = 'secrets\\.yaml' } + @{ Why = 'not anchored'; Pattern = 'app-secrets\\.yaml' } @{ Why = 'a match for every path'; Pattern = '^.*' } @{ Why = 'a match for any file in a folder'; Pattern = '(^|/)' } @{ Why = 'holding a quote'; Pattern = "^a'''b" } @@ -118,19 +118,19 @@ Describe 'GitleaksConfig' { } It 'says which paths the scan skips, so a reviewer sees a wider list' { - Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "^\\.storage/" ] } }' + Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "^\\.runtime/" ] } }' $out = New-GitleaksConfig -Path (Join-Path $TestDrive 'shown.toml') -RepoRoot $script:Repo 6>&1 | Out-String $out | Should -Match 'secretScan\.allowPaths' - $out | Should -Match ([regex]::Escape('^\.storage/')) + $out | Should -Match ([regex]::Escape('^\.runtime/')) } It 'makes gitleaks skip a named path, and still find the same secret elsewhere' -Skip:(-not (Get-Command gitleaks -ErrorAction SilentlyContinue)) { - Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "(^|/)secrets\\.yaml$" ] } }' + Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "(^|/)app-secrets\\.yaml$" ] } }' $scan = Join-Path $script:Repo 'scan' New-Item -ItemType Directory -Path $scan -Force | Out-Null - Set-Content -LiteralPath (Join-Path $scan 'secrets.yaml') -Value (New-ManifestLine) + Set-Content -LiteralPath (Join-Path $scan 'app-secrets.yaml') -Value (New-ManifestLine) Set-Content -LiteralPath (Join-Path $scan 'other.json') -Value (New-ManifestLine) $config = New-GitleaksConfig -Path (Join-Path $TestDrive 'repo-scan.toml') -RepoRoot $script:Repo $report = Join-Path $TestDrive 'repo-report.json' diff --git a/.claude/skills/ai-sdlc-gates/sync-manifest.json b/.claude/skills/ai-sdlc-gates/sync-manifest.json index d285280..182f820 100644 --- a/.claude/skills/ai-sdlc-gates/sync-manifest.json +++ b/.claude/skills/ai-sdlc-gates/sync-manifest.json @@ -75,7 +75,7 @@ ".claude/skills/ai-sdlc-gates/scripts/gitleaks-rules.json": "27587aa74bfdd86b48ad9c50309b2b8521289c78", ".claude/skills/ai-sdlc-gates/scripts/gitleaks-version.json": "e77769fb5c7760c211010a6b48c01280b4ed7e44", ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1": "4647a221331df87f1638698d5d321a3061299856", - ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1": "43ac156211b5dab24fb0bc0919a634bd8eb96a59", + ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1": "088aa60df9e4c3664aa11fe53788ce100ae13e1d", ".claude/skills/ai-sdlc-gates/scripts/Install-Apm.ps1": "63ea5061301759e7fb77d69fdbbc2c0fa9c5ff27", ".claude/skills/ai-sdlc-gates/scripts/Install-Apm.Tests.ps1": "b3188b0357d1b1ffa4252f4f78ce24338cdc2ab7", ".claude/skills/ai-sdlc-gates/scripts/Install-Gitleaks.ps1": "39083d99bb0c76ec3a0c2942582629cf4311a54f", @@ -114,7 +114,7 @@ ".claude/skills/ai-sdlc-handbook/references/docs-wiki.md": "038477c9b704a5b545decfe5e3f3f9970d8d1f9d", ".claude/skills/ai-sdlc-handbook/references/first-story.md": "be899eb395dafb2d704b8f0cb46bac1fb5e593c8", ".claude/skills/ai-sdlc-handbook/references/language.md": "b4ce85e8325cd5e59c13cb31564d6ff81ea71c7a", - ".claude/skills/ai-sdlc-handbook/references/layout.md": "2c96fa03da2a79f19e31769fe454e5c7f105a086", + ".claude/skills/ai-sdlc-handbook/references/layout.md": "af74f6557e823b6778d46ebab70e41db98cf22a4", ".claude/skills/ai-sdlc-handbook/references/node-templates.md": "580c9c92c470a6abbaa0145cc3060ff1a11d247c", ".claude/skills/ai-sdlc-handbook/references/orchestration.md": "5b6c8c38a5d17ca59cc38794a7750355c508d262", ".claude/skills/ai-sdlc-handbook/references/pattern.md": "f0f2a8cf3dac267cda0fd3783d86bddba5afc7c0", diff --git a/.claude/skills/ai-sdlc-handbook/references/layout.md b/.claude/skills/ai-sdlc-handbook/references/layout.md index 2c96fa0..af74f65 100644 --- a/.claude/skills/ai-sdlc-handbook/references/layout.md +++ b/.claude/skills/ai-sdlc-handbook/references/layout.md @@ -128,7 +128,7 @@ installs. `AiSdlcConfig.psm1` takes each dependency whose path ends in `packs/, and names the field' -ForEach @( - @{ Why = 'not anchored'; Pattern = 'secrets\\.yaml' } + @{ Why = 'not anchored'; Pattern = 'app-secrets\\.yaml' } @{ Why = 'a match for every path'; Pattern = '^.*' } @{ Why = 'a match for any file in a folder'; Pattern = '(^|/)' } @{ Why = 'holding a quote'; Pattern = "^a'''b" } @@ -118,19 +118,19 @@ Describe 'GitleaksConfig' { } It 'says which paths the scan skips, so a reviewer sees a wider list' { - Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "^\\.storage/" ] } }' + Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "^\\.runtime/" ] } }' $out = New-GitleaksConfig -Path (Join-Path $TestDrive 'shown.toml') -RepoRoot $script:Repo 6>&1 | Out-String $out | Should -Match 'secretScan\.allowPaths' - $out | Should -Match ([regex]::Escape('^\.storage/')) + $out | Should -Match ([regex]::Escape('^\.runtime/')) } It 'makes gitleaks skip a named path, and still find the same secret elsewhere' -Skip:(-not (Get-Command gitleaks -ErrorAction SilentlyContinue)) { - Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "(^|/)secrets\\.yaml$" ] } }' + Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "(^|/)app-secrets\\.yaml$" ] } }' $scan = Join-Path $script:Repo 'scan' New-Item -ItemType Directory -Path $scan -Force | Out-Null - Set-Content -LiteralPath (Join-Path $scan 'secrets.yaml') -Value (New-ManifestLine) + Set-Content -LiteralPath (Join-Path $scan 'app-secrets.yaml') -Value (New-ManifestLine) Set-Content -LiteralPath (Join-Path $scan 'other.json') -Value (New-ManifestLine) $config = New-GitleaksConfig -Path (Join-Path $TestDrive 'repo-scan.toml') -RepoRoot $script:Repo $report = Join-Path $TestDrive 'repo-report.json' diff --git a/core/.apm/skills/ai-sdlc-gates/sync-manifest.json b/core/.apm/skills/ai-sdlc-gates/sync-manifest.json index d285280..32bf9b6 100644 --- a/core/.apm/skills/ai-sdlc-gates/sync-manifest.json +++ b/core/.apm/skills/ai-sdlc-gates/sync-manifest.json @@ -75,7 +75,7 @@ ".claude/skills/ai-sdlc-gates/scripts/gitleaks-rules.json": "27587aa74bfdd86b48ad9c50309b2b8521289c78", ".claude/skills/ai-sdlc-gates/scripts/gitleaks-version.json": "e77769fb5c7760c211010a6b48c01280b4ed7e44", ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1": "4647a221331df87f1638698d5d321a3061299856", - ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1": "43ac156211b5dab24fb0bc0919a634bd8eb96a59", + ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1": "853079b7608e1dc8f211160463fdd3b1f59edfaa", ".claude/skills/ai-sdlc-gates/scripts/Install-Apm.ps1": "63ea5061301759e7fb77d69fdbbc2c0fa9c5ff27", ".claude/skills/ai-sdlc-gates/scripts/Install-Apm.Tests.ps1": "b3188b0357d1b1ffa4252f4f78ce24338cdc2ab7", ".claude/skills/ai-sdlc-gates/scripts/Install-Gitleaks.ps1": "39083d99bb0c76ec3a0c2942582629cf4311a54f", @@ -114,7 +114,7 @@ ".claude/skills/ai-sdlc-handbook/references/docs-wiki.md": "038477c9b704a5b545decfe5e3f3f9970d8d1f9d", ".claude/skills/ai-sdlc-handbook/references/first-story.md": "be899eb395dafb2d704b8f0cb46bac1fb5e593c8", ".claude/skills/ai-sdlc-handbook/references/language.md": "b4ce85e8325cd5e59c13cb31564d6ff81ea71c7a", - ".claude/skills/ai-sdlc-handbook/references/layout.md": "2c96fa03da2a79f19e31769fe454e5c7f105a086", + ".claude/skills/ai-sdlc-handbook/references/layout.md": "af74f6557e823b6778d46ebab70e41db98cf22a4", ".claude/skills/ai-sdlc-handbook/references/node-templates.md": "580c9c92c470a6abbaa0145cc3060ff1a11d247c", ".claude/skills/ai-sdlc-handbook/references/orchestration.md": "5b6c8c38a5d17ca59cc38794a7750355c508d262", ".claude/skills/ai-sdlc-handbook/references/pattern.md": "f0f2a8cf3dac267cda0fd3783d86bddba5afc7c0", diff --git a/core/.apm/skills/ai-sdlc-handbook/references/layout.md b/core/.apm/skills/ai-sdlc-handbook/references/layout.md index 2c96fa0..af74f65 100644 --- a/core/.apm/skills/ai-sdlc-handbook/references/layout.md +++ b/core/.apm/skills/ai-sdlc-handbook/references/layout.md @@ -128,7 +128,7 @@ installs. `AiSdlcConfig.psm1` takes each dependency whose path ends in `packs/ Date: Sun, 8 Nov 2026 15:30:28 +0100 Subject: [PATCH 5/7] Refresh the installed copy after the merge Refs #14 --- .claude/skills/ai-sdlc-gates/sync-manifest.json | 4 ++-- apm.lock.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.claude/skills/ai-sdlc-gates/sync-manifest.json b/.claude/skills/ai-sdlc-gates/sync-manifest.json index 32bf9b6..d03e49e 100644 --- a/.claude/skills/ai-sdlc-gates/sync-manifest.json +++ b/.claude/skills/ai-sdlc-gates/sync-manifest.json @@ -19,7 +19,7 @@ ".claude/skills/adopt-docs/SKILL.md": "49d399e7d200650cb156aa320761e94843018ab2", ".claude/skills/adr-conventions/SKILL.md": "26e170df5a60858e25afe9176fa428f42affb1bb", ".claude/skills/ai-sdlc-gates/assets/actions/ai-sdlc-pr/action.yml": "f80ed84d896859668d74cd47bf327a714d383f8a", - ".claude/skills/ai-sdlc-gates/assets/agents-core.md": "4170c4291b02cb6515f3860b23716d2069fd528b", + ".claude/skills/ai-sdlc-gates/assets/agents-core.md": "f7e45643bf0f5447d480b588784b2c599cc7f320", ".claude/skills/ai-sdlc-gates/gates.json": "cf6f5a2d284f0b22f0f4a89292037caed3e53c19", ".claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.psm1": "afaad1b3853d71d4f1016e2f9f9df4a1ffdbc03d", ".claude/skills/ai-sdlc-gates/scripts/AiSdlcConfig.Tests.ps1": "2ad1609653980ca3bada51c7cd470e4ba6ffcbe9", @@ -113,7 +113,7 @@ ".claude/skills/ai-sdlc-handbook/references/context-management.md": "e284e60ca4d5e2624be79b5ce247e0662e430e3d", ".claude/skills/ai-sdlc-handbook/references/docs-wiki.md": "038477c9b704a5b545decfe5e3f3f9970d8d1f9d", ".claude/skills/ai-sdlc-handbook/references/first-story.md": "be899eb395dafb2d704b8f0cb46bac1fb5e593c8", - ".claude/skills/ai-sdlc-handbook/references/language.md": "b4ce85e8325cd5e59c13cb31564d6ff81ea71c7a", + ".claude/skills/ai-sdlc-handbook/references/language.md": "ca703edeb9e07e28e32a39fbcc9116b64db444d8", ".claude/skills/ai-sdlc-handbook/references/layout.md": "af74f6557e823b6778d46ebab70e41db98cf22a4", ".claude/skills/ai-sdlc-handbook/references/node-templates.md": "580c9c92c470a6abbaa0145cc3060ff1a11d247c", ".claude/skills/ai-sdlc-handbook/references/orchestration.md": "5b6c8c38a5d17ca59cc38794a7750355c508d262", diff --git a/apm.lock.yaml b/apm.lock.yaml index 9662b48..a4d88a6 100644 --- a/apm.lock.yaml +++ b/apm.lock.yaml @@ -331,7 +331,7 @@ dependencies: .claude/skills/ai-sdlc-gates/scripts/gitleaks-rules.json: sha256:6a8a75c5dbcf2378a1c52d046e34ce275aac7ce08a0ae61408d25c18e1e27014 .claude/skills/ai-sdlc-gates/scripts/gitleaks-version.json: sha256:c54acb854f87a1bbdf0e90c670b72b5de3cd37f7e460d82eca599c3c7af23a84 .claude/skills/ai-sdlc-gates/skill-catalog.json: sha256:5537684656bf189a740ba7e9e7050083af05668d00501ce1e9c6909cb8b91203 - .claude/skills/ai-sdlc-gates/sync-manifest.json: sha256:ffcabc88b301b6310bd97818b164d74d7300c3865f5c9596a7b47066241a7d63 + .claude/skills/ai-sdlc-gates/sync-manifest.json: sha256:be54d9bdd32c433af6ee9c98a21bf1623990eab64827a11761a9521890ddea77 .claude/skills/ai-sdlc-handbook/SKILL.md: sha256:548e6b9ad79d3d2afa2f5779835988eeb12c49cda08917c4bbaa9ac0486a47a0 .claude/skills/ai-sdlc-handbook/references/README.md: sha256:654afcaa2b81f560eff93dbdef521b09ced06137a1dbb85d70a4e14ef7502248 .claude/skills/ai-sdlc-handbook/references/artifact-graph.md: sha256:d7ddfe20e5ee6565bcf25f9cef0f578da2a4ab1590033d791b8814d4688fd1f0 @@ -1551,7 +1551,7 @@ deployments: owners: - ./core active_owner: ./core - content_hash: sha256:ffcabc88b301b6310bd97818b164d74d7300c3865f5c9596a7b47066241a7d63 + content_hash: sha256:be54d9bdd32c433af6ee9c98a21bf1623990eab64827a11761a9521890ddea77 - kind: project-relative target: claude value: .claude/skills/ai-sdlc-handbook From e1f1e3ca8de059d3209bd2c13d99d6342cb07cb4 Mon Sep 17 00:00:00 2001 From: Rob Hofmann Date: Sun, 8 Nov 2026 16:17:44 +0100 Subject: [PATCH 6/7] Refresh the installed copy of the sync manifest Refs #12 --- .claude/skills/ai-sdlc-gates/sync-manifest.json | 2 +- apm.lock.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.claude/skills/ai-sdlc-gates/sync-manifest.json b/.claude/skills/ai-sdlc-gates/sync-manifest.json index 182f820..32bf9b6 100644 --- a/.claude/skills/ai-sdlc-gates/sync-manifest.json +++ b/.claude/skills/ai-sdlc-gates/sync-manifest.json @@ -75,7 +75,7 @@ ".claude/skills/ai-sdlc-gates/scripts/gitleaks-rules.json": "27587aa74bfdd86b48ad9c50309b2b8521289c78", ".claude/skills/ai-sdlc-gates/scripts/gitleaks-version.json": "e77769fb5c7760c211010a6b48c01280b4ed7e44", ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1": "4647a221331df87f1638698d5d321a3061299856", - ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1": "088aa60df9e4c3664aa11fe53788ce100ae13e1d", + ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1": "853079b7608e1dc8f211160463fdd3b1f59edfaa", ".claude/skills/ai-sdlc-gates/scripts/Install-Apm.ps1": "63ea5061301759e7fb77d69fdbbc2c0fa9c5ff27", ".claude/skills/ai-sdlc-gates/scripts/Install-Apm.Tests.ps1": "b3188b0357d1b1ffa4252f4f78ce24338cdc2ab7", ".claude/skills/ai-sdlc-gates/scripts/Install-Gitleaks.ps1": "39083d99bb0c76ec3a0c2942582629cf4311a54f", diff --git a/apm.lock.yaml b/apm.lock.yaml index d9e5b1c..95d928a 100644 --- a/apm.lock.yaml +++ b/apm.lock.yaml @@ -331,7 +331,7 @@ dependencies: .claude/skills/ai-sdlc-gates/scripts/gitleaks-rules.json: sha256:6a8a75c5dbcf2378a1c52d046e34ce275aac7ce08a0ae61408d25c18e1e27014 .claude/skills/ai-sdlc-gates/scripts/gitleaks-version.json: sha256:c54acb854f87a1bbdf0e90c670b72b5de3cd37f7e460d82eca599c3c7af23a84 .claude/skills/ai-sdlc-gates/skill-catalog.json: sha256:5537684656bf189a740ba7e9e7050083af05668d00501ce1e9c6909cb8b91203 - .claude/skills/ai-sdlc-gates/sync-manifest.json: sha256:0ceb5f4041fe5dcfd98b33dc94717ef8f6d446a66fc7cd4bad69d2774bc71988 + .claude/skills/ai-sdlc-gates/sync-manifest.json: sha256:ffcabc88b301b6310bd97818b164d74d7300c3865f5c9596a7b47066241a7d63 .claude/skills/ai-sdlc-handbook/SKILL.md: sha256:548e6b9ad79d3d2afa2f5779835988eeb12c49cda08917c4bbaa9ac0486a47a0 .claude/skills/ai-sdlc-handbook/references/README.md: sha256:654afcaa2b81f560eff93dbdef521b09ced06137a1dbb85d70a4e14ef7502248 .claude/skills/ai-sdlc-handbook/references/artifact-graph.md: sha256:d7ddfe20e5ee6565bcf25f9cef0f578da2a4ab1590033d791b8814d4688fd1f0 @@ -1551,7 +1551,7 @@ deployments: owners: - ./core active_owner: ./core - content_hash: sha256:0ceb5f4041fe5dcfd98b33dc94717ef8f6d446a66fc7cd4bad69d2774bc71988 + content_hash: sha256:ffcabc88b301b6310bd97818b164d74d7300c3865f5c9596a7b47066241a7d63 - kind: project-relative target: claude value: .claude/skills/ai-sdlc-handbook From d4c4ddaa8e1e3f6cdbbbe03cfbc84cad186211ea Mon Sep 17 00:00:00 2001 From: Rob Hofmann Date: Sun, 8 Nov 2026 16:48:43 +0100 Subject: [PATCH 7/7] Leave the choice of skipped paths to the repository The scan now only refuses a pattern that would break the generated TOML file or that is not a valid regular expression. Which paths to skip, and how broad, is up to the repository. Refs #12 --- .../scripts/GitleaksConfig.Tests.ps1 | 16 +++++++++++++--- .../ai-sdlc-gates/scripts/GitleaksConfig.psm1 | 11 +++-------- .claude/skills/ai-sdlc-gates/sync-manifest.json | 6 +++--- .../skills/ai-sdlc-handbook/references/layout.md | 2 +- apm.lock.yaml | 16 ++++++++-------- .../scripts/GitleaksConfig.Tests.ps1 | 16 +++++++++++++--- .../ai-sdlc-gates/scripts/GitleaksConfig.psm1 | 11 +++-------- .../.apm/skills/ai-sdlc-gates/sync-manifest.json | 6 +++--- .../skills/ai-sdlc-handbook/references/layout.md | 2 +- 9 files changed, 48 insertions(+), 38 deletions(-) diff --git a/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 b/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 index 853079b..10e5158 100644 --- a/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 +++ b/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1 @@ -105,9 +105,6 @@ Describe 'GitleaksConfig' { } It 'refuses a pattern that is , and names the field' -ForEach @( - @{ Why = 'not anchored'; Pattern = 'app-secrets\\.yaml' } - @{ Why = 'a match for every path'; Pattern = '^.*' } - @{ Why = 'a match for any file in a folder'; Pattern = '(^|/)' } @{ Why = 'holding a quote'; Pattern = "^a'''b" } @{ Why = 'not a regular expression'; Pattern = '^a[' } ) { @@ -117,6 +114,19 @@ Describe 'GitleaksConfig' { { New-GitleaksConfig -Path (Join-Path $TestDrive 'bad.toml') -RepoRoot $script:Repo } | Should -Throw '*secretScan.allowPaths*' } + It 'accepts any valid pattern, because the repository decides what it skips' -ForEach @( + @{ Pattern = 'app-secrets\.yaml' } + @{ Pattern = '^config/' } + @{ Pattern = '^.*' } + ) { + $json = @{ secretScan = @{ allowPaths = @($Pattern) } } | ConvertTo-Json -Depth 3 + Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value $json + + $text = Get-Content -LiteralPath (New-GitleaksConfig -Path (Join-Path $TestDrive 'any.toml') -RepoRoot $script:Repo 6>$null) -Raw + + $text | Should -Match ([regex]::Escape("'''$Pattern'''")) + } + It 'says which paths the scan skips, so a reviewer sees a wider list' { Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "^\\.runtime/" ] } }' diff --git a/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 b/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 index 4647a22..4ade0e5 100644 --- a/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 +++ b/.claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 @@ -81,18 +81,13 @@ function Get-GitleaksRepoAllowedPath { $config = Get-AiSdlcConfig -RepoRoot $RepoRoot $patterns = @($config.secretScan.allowPaths | Where-Object { $_ }) - # A repository widens its own secret scan here, so each pattern must stay narrow: anchored at the - # start of a path or of a folder, a valid regular expression, and no match for an ordinary file. - $ordinary = @('README.md', 'src/main.cs', 'a/b/c.txt', 'config/settings.json') + # Which paths to skip is the choice of the repository. The check only stops a pattern that would + # break the TOML file or that gitleaks cannot read: a quote, a control character, or a bad regex. foreach ($pattern in $patterns) { $reason = if ($pattern -isnot [string]) { 'is not a string' } elseif ($pattern -match "['`"\p{Cc}]") { 'holds a quote or a control character' } - elseif ($pattern -notmatch '^(\^|\(\^\|/\))') { 'is not anchored: start it with ^ or (^|/)' } else { - try { - $regex = [regex]::new($pattern) - if (@($ordinary | Where-Object { $regex.IsMatch($_) }).Count -gt 0) { 'matches ordinary files, so it would hide real leaks' } - } + try { $null = [regex]::new($pattern) } catch { 'is not a valid regular expression' } } if ($reason) { throw "secretScan.allowPaths in aisdlc.json: the pattern '$pattern' $reason. Nothing was scanned." } diff --git a/.claude/skills/ai-sdlc-gates/sync-manifest.json b/.claude/skills/ai-sdlc-gates/sync-manifest.json index d03e49e..fcfc9ec 100644 --- a/.claude/skills/ai-sdlc-gates/sync-manifest.json +++ b/.claude/skills/ai-sdlc-gates/sync-manifest.json @@ -74,8 +74,8 @@ ".claude/skills/ai-sdlc-gates/scripts/GateAnnotation.Tests.ps1": "beb01f71d8706bd86de7bcc6a7bf583ba9ab6e5a", ".claude/skills/ai-sdlc-gates/scripts/gitleaks-rules.json": "27587aa74bfdd86b48ad9c50309b2b8521289c78", ".claude/skills/ai-sdlc-gates/scripts/gitleaks-version.json": "e77769fb5c7760c211010a6b48c01280b4ed7e44", - ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1": "4647a221331df87f1638698d5d321a3061299856", - ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1": "853079b7608e1dc8f211160463fdd3b1f59edfaa", + ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1": "4ade0e52616bea818365f5625a00e29c90f5114b", + ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1": "10e515840ca417b480e5fcec14f7e6396de32b6c", ".claude/skills/ai-sdlc-gates/scripts/Install-Apm.ps1": "63ea5061301759e7fb77d69fdbbc2c0fa9c5ff27", ".claude/skills/ai-sdlc-gates/scripts/Install-Apm.Tests.ps1": "b3188b0357d1b1ffa4252f4f78ce24338cdc2ab7", ".claude/skills/ai-sdlc-gates/scripts/Install-Gitleaks.ps1": "39083d99bb0c76ec3a0c2942582629cf4311a54f", @@ -114,7 +114,7 @@ ".claude/skills/ai-sdlc-handbook/references/docs-wiki.md": "038477c9b704a5b545decfe5e3f3f9970d8d1f9d", ".claude/skills/ai-sdlc-handbook/references/first-story.md": "be899eb395dafb2d704b8f0cb46bac1fb5e593c8", ".claude/skills/ai-sdlc-handbook/references/language.md": "ca703edeb9e07e28e32a39fbcc9116b64db444d8", - ".claude/skills/ai-sdlc-handbook/references/layout.md": "af74f6557e823b6778d46ebab70e41db98cf22a4", + ".claude/skills/ai-sdlc-handbook/references/layout.md": "eaabf81a917d8b826f26318bcef7934fbbecbdfa", ".claude/skills/ai-sdlc-handbook/references/node-templates.md": "580c9c92c470a6abbaa0145cc3060ff1a11d247c", ".claude/skills/ai-sdlc-handbook/references/orchestration.md": "5b6c8c38a5d17ca59cc38794a7750355c508d262", ".claude/skills/ai-sdlc-handbook/references/pattern.md": "f0f2a8cf3dac267cda0fd3783d86bddba5afc7c0", diff --git a/.claude/skills/ai-sdlc-handbook/references/layout.md b/.claude/skills/ai-sdlc-handbook/references/layout.md index af74f65..eaabf81 100644 --- a/.claude/skills/ai-sdlc-handbook/references/layout.md +++ b/.claude/skills/ai-sdlc-handbook/references/layout.md @@ -128,7 +128,7 @@ installs. `AiSdlcConfig.psm1` takes each dependency whose path ends in `packs/, and names the field' -ForEach @( - @{ Why = 'not anchored'; Pattern = 'app-secrets\\.yaml' } - @{ Why = 'a match for every path'; Pattern = '^.*' } - @{ Why = 'a match for any file in a folder'; Pattern = '(^|/)' } @{ Why = 'holding a quote'; Pattern = "^a'''b" } @{ Why = 'not a regular expression'; Pattern = '^a[' } ) { @@ -117,6 +114,19 @@ Describe 'GitleaksConfig' { { New-GitleaksConfig -Path (Join-Path $TestDrive 'bad.toml') -RepoRoot $script:Repo } | Should -Throw '*secretScan.allowPaths*' } + It 'accepts any valid pattern, because the repository decides what it skips' -ForEach @( + @{ Pattern = 'app-secrets\.yaml' } + @{ Pattern = '^config/' } + @{ Pattern = '^.*' } + ) { + $json = @{ secretScan = @{ allowPaths = @($Pattern) } } | ConvertTo-Json -Depth 3 + Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value $json + + $text = Get-Content -LiteralPath (New-GitleaksConfig -Path (Join-Path $TestDrive 'any.toml') -RepoRoot $script:Repo 6>$null) -Raw + + $text | Should -Match ([regex]::Escape("'''$Pattern'''")) + } + It 'says which paths the scan skips, so a reviewer sees a wider list' { Set-Content -LiteralPath (Join-Path $script:Repo 'aisdlc.json') -Value '{ "secretScan": { "allowPaths": [ "^\\.runtime/" ] } }' diff --git a/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 b/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 index 4647a22..4ade0e5 100644 --- a/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 +++ b/core/.apm/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1 @@ -81,18 +81,13 @@ function Get-GitleaksRepoAllowedPath { $config = Get-AiSdlcConfig -RepoRoot $RepoRoot $patterns = @($config.secretScan.allowPaths | Where-Object { $_ }) - # A repository widens its own secret scan here, so each pattern must stay narrow: anchored at the - # start of a path or of a folder, a valid regular expression, and no match for an ordinary file. - $ordinary = @('README.md', 'src/main.cs', 'a/b/c.txt', 'config/settings.json') + # Which paths to skip is the choice of the repository. The check only stops a pattern that would + # break the TOML file or that gitleaks cannot read: a quote, a control character, or a bad regex. foreach ($pattern in $patterns) { $reason = if ($pattern -isnot [string]) { 'is not a string' } elseif ($pattern -match "['`"\p{Cc}]") { 'holds a quote or a control character' } - elseif ($pattern -notmatch '^(\^|\(\^\|/\))') { 'is not anchored: start it with ^ or (^|/)' } else { - try { - $regex = [regex]::new($pattern) - if (@($ordinary | Where-Object { $regex.IsMatch($_) }).Count -gt 0) { 'matches ordinary files, so it would hide real leaks' } - } + try { $null = [regex]::new($pattern) } catch { 'is not a valid regular expression' } } if ($reason) { throw "secretScan.allowPaths in aisdlc.json: the pattern '$pattern' $reason. Nothing was scanned." } diff --git a/core/.apm/skills/ai-sdlc-gates/sync-manifest.json b/core/.apm/skills/ai-sdlc-gates/sync-manifest.json index d03e49e..fcfc9ec 100644 --- a/core/.apm/skills/ai-sdlc-gates/sync-manifest.json +++ b/core/.apm/skills/ai-sdlc-gates/sync-manifest.json @@ -74,8 +74,8 @@ ".claude/skills/ai-sdlc-gates/scripts/GateAnnotation.Tests.ps1": "beb01f71d8706bd86de7bcc6a7bf583ba9ab6e5a", ".claude/skills/ai-sdlc-gates/scripts/gitleaks-rules.json": "27587aa74bfdd86b48ad9c50309b2b8521289c78", ".claude/skills/ai-sdlc-gates/scripts/gitleaks-version.json": "e77769fb5c7760c211010a6b48c01280b4ed7e44", - ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1": "4647a221331df87f1638698d5d321a3061299856", - ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1": "853079b7608e1dc8f211160463fdd3b1f59edfaa", + ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.psm1": "4ade0e52616bea818365f5625a00e29c90f5114b", + ".claude/skills/ai-sdlc-gates/scripts/GitleaksConfig.Tests.ps1": "10e515840ca417b480e5fcec14f7e6396de32b6c", ".claude/skills/ai-sdlc-gates/scripts/Install-Apm.ps1": "63ea5061301759e7fb77d69fdbbc2c0fa9c5ff27", ".claude/skills/ai-sdlc-gates/scripts/Install-Apm.Tests.ps1": "b3188b0357d1b1ffa4252f4f78ce24338cdc2ab7", ".claude/skills/ai-sdlc-gates/scripts/Install-Gitleaks.ps1": "39083d99bb0c76ec3a0c2942582629cf4311a54f", @@ -114,7 +114,7 @@ ".claude/skills/ai-sdlc-handbook/references/docs-wiki.md": "038477c9b704a5b545decfe5e3f3f9970d8d1f9d", ".claude/skills/ai-sdlc-handbook/references/first-story.md": "be899eb395dafb2d704b8f0cb46bac1fb5e593c8", ".claude/skills/ai-sdlc-handbook/references/language.md": "ca703edeb9e07e28e32a39fbcc9116b64db444d8", - ".claude/skills/ai-sdlc-handbook/references/layout.md": "af74f6557e823b6778d46ebab70e41db98cf22a4", + ".claude/skills/ai-sdlc-handbook/references/layout.md": "eaabf81a917d8b826f26318bcef7934fbbecbdfa", ".claude/skills/ai-sdlc-handbook/references/node-templates.md": "580c9c92c470a6abbaa0145cc3060ff1a11d247c", ".claude/skills/ai-sdlc-handbook/references/orchestration.md": "5b6c8c38a5d17ca59cc38794a7750355c508d262", ".claude/skills/ai-sdlc-handbook/references/pattern.md": "f0f2a8cf3dac267cda0fd3783d86bddba5afc7c0", diff --git a/core/.apm/skills/ai-sdlc-handbook/references/layout.md b/core/.apm/skills/ai-sdlc-handbook/references/layout.md index af74f65..eaabf81 100644 --- a/core/.apm/skills/ai-sdlc-handbook/references/layout.md +++ b/core/.apm/skills/ai-sdlc-handbook/references/layout.md @@ -128,7 +128,7 @@ installs. `AiSdlcConfig.psm1` takes each dependency whose path ends in `packs/