Skip to content

Commit 5b3c12b

Browse files
committed
fix(rules): address review feedback on dotnet rule precision
- Remove Path.GetFullPath() as path-traversal sanitizer (normalizes but does not prevent traversal on its own) - Broaden hardcoded-credentials variable regex to cover idiomatic C# naming: apiKey, connectionString, privateKey, accessKey, authToken - Remove overly broad Base64 encoding pattern from crypto-failures (benign encoding/transport use generates noise)
1 parent 580a263 commit 5b3c12b

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

socket_basics/rules/dotnet.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ rules:
158158
string $VAR = "$VALUE";
159159
- metavariable-regex:
160160
metavariable: $VAR
161-
regex: (?i).*(password|passwd|pwd|secret|token|api_key|connection_string).*
161+
regex: (?i).*(password|passwd|pwd|secret|secretKey|token|authToken|api_?key|apiKey|accessKey|privateKey|connection_?string|connectionString).*
162162
- metavariable-regex:
163163
metavariable: $VALUE
164164
# Must look like an actual secret: 6+ chars, not a config path or empty
@@ -407,7 +407,6 @@ rules:
407407
- pattern: Directory.EnumerateFiles(...)
408408
pattern-sanitizers:
409409
- pattern-either:
410-
- pattern: Path.GetFullPath(...)
411410
- pattern: Path.GetFileName(...)
412411
# Framework-provided base paths are safe sources, not sanitizers,
413412
# but if the result is validated against a base we consider it sanitized
@@ -801,8 +800,6 @@ rules:
801800
# Using raw password bytes directly as crypto key (no KDF)
802801
- pattern: new RijndaelManaged() { Key = Encoding.UTF8.GetBytes($KEY) }
803802
- pattern: new AesCryptoServiceProvider() { Key = Encoding.UTF8.GetBytes($KEY) }
804-
# Encoding password for storage without hashing (storing plaintext)
805-
- pattern: Convert.ToBase64String(Encoding.UTF8.GetBytes($SECRET))
806803
metadata:
807804
category: security
808805
owasp: A02

0 commit comments

Comments
 (0)