Skip to content

Commit b5ae0bb

Browse files
committed
Exclude security scripts from self-scan false positives
1 parent e33c856 commit b5ae0bb

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Scripts/security/pre-push-security-check.ps1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ $allowedPlaceholders = @(
5151

5252
$violations = New-Object System.Collections.Generic.List[string]
5353

54+
$excludedFiles = @(
55+
'Scripts/security/pre-push-security-check.ps1',
56+
'Scripts/security/install-git-hooks.ps1'
57+
)
58+
5459
foreach ($r in $refs) {
5560
if ($r.LocalSha -match '^0+$') { continue }
5661

@@ -61,7 +66,17 @@ foreach ($r in $refs) {
6166
if (-not $patch) { continue }
6267

6368
$lines = $patch -split "`n"
69+
$currentFile = ''
6470
foreach ($line in $lines) {
71+
if ($line.StartsWith('+++ b/')) {
72+
$currentFile = $line.Substring(6).Trim()
73+
continue
74+
}
75+
76+
if ($excludedFiles -contains $currentFile) {
77+
continue
78+
}
79+
6580
if (-not $line.StartsWith('+')) { continue }
6681
if ($line.StartsWith('+++')) { continue }
6782

0 commit comments

Comments
 (0)