Skip to content

Commit

Permalink
fix directory separator for xplat
Browse files Browse the repository at this point in the history
  • Loading branch information
bjompen committed Oct 24, 2022
1 parent 787eecc commit 53be8a2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
18 changes: 10 additions & 8 deletions .ignoresecrets
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# Comments supported

# Relative paths supported (starting with .\)
.\Docs\Help\Find-Secret.md
.\Source\config.json
./Docs/Help/Find-Secret.md
./Source/config.json

# Wildcards supported. All files within this and subfolders will be excluded.
.\bin\*
./bin/*

# Paths to files. All matches in these files will be excluded
.\Tests\RegexPatternTests\TestCases.json
C:\MyRepo\PSSecretScanner\README.md
./Tests/RegexPatternTests/TestCases.json
C:/MyRepo/PSSecretScanner/README.md

# Any directory separator character should work (Linux and Windows)
.\README.md

# Patterns on specific lines supported in the format
# <path\to\file>;<line number>;<pattern>
.\ExcludeList.csv;1;"C:\BicepLab\template.json;51;-----BEGIN RSA PRIVATE KEY-----"
C:\MyRepo\PSSecretScanner\Docs\Help\Find-Secret.md;51;"C:\MyFiles\template.json;51;-----BEGIN RSA PRIVATE KEY-----"
# <path/to/file>;<line number>;<pattern>
C:/MyRepo/PSSecretScanner/Docs/Help/Find-Secret.md;51;"C:\MyFiles\template.json;51;-----BEGIN RSA PRIVATE KEY-----"
3 changes: 3 additions & 0 deletions Source/Private/GetExclusions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ function GetExclusions {
foreach ($e in $Exclusions) {
$eObj = ConvertFrom-Csv -InputObject $e -Delimiter ';' -Header 'Path', 'LineNumber', 'Line'

# Normalize path
$eObj.Path = $eObj.Path -replace '[\\\/]', [IO.Path]::DirectorySeparatorChar

if ($eObj.Path -match '^\..*') {
# Path starts with '.', is relative. Replace with root folder
$BasePath = split-path (Resolve-Path $Excludelist).Path
Expand Down

0 comments on commit 53be8a2

Please sign in to comment.