feat(sast): DevSkim for .NET without a build (#494)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 8m32s
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 8m32s
Legacy .NET Framework code often cannot be built outside the customer's Windows toolchain, so no Roslyn analyser applies. DevSkim (MIT, Microsoft) matches its rules on the source text and now runs as the sast_dotnet stage on every tree with C# or VB.NET code: .cs, .vb, Razor/ASP.NET pages and .config files, skipping bin/, obj/, packages/ and vendor directories (anchored at the tree root). - Only DevSkim's own rules at Critical/Important/Moderate (its ManualReview and BestPractice hints are not findings); DS205000 (NuGet feed mapping), DS184626 (controller base class) and DS440000 (generic twin of DS440020) are left out, and two that flood real C# (OpenRA, eShopOnWeb): DS148264 matches any method named Random (71 hits in OpenRA), DS126858 the bare words md5/sha1, identifiers included (35). DS168931 and our own semgrep rules still cover broken hashes and System.Random. What remains: 3 hits in OpenRA (test vectors), 14 Low http:// hits in eShopOnWeb seed data; each run took about 2 s. - SARIF is read with import::sarif::parse; findings are normalised like the other scanners (relative path, whole source line as snippet, one finding per rule/file/line), severity from DevSkim's own Critical/Important/ Moderate (its SARIF level says "error" for both of the first two). - DevSkim's SARIF names no CWE, so pipeline/devskim.rs gives each rule one; the control map binds the devskim tool by CWE to cra-ai-1, 8, 10, 13, 14, 15, 16 and 20 for csharp and vb. A test checks every mapped rule reaches a control. A failed run is a sast_dotnet skip, so those controls read "not assessed" instead of clean. - languages.rs now records VB.NET (vb). Image: the CLI is published as a .NET tool on nuget.org only (no release binaries). Dockerfile.agent pins the 1.0.100 nupkg by sha256 and the .NET 10.0.12 runtime (no SDK) by sha512, keeps only the linux-x64 natives, and runs it through docker/devskim.sh with invariant globalisation (no ICU). The tools stage grows from 1.525 GB to 1.623 GB (+98.5 MB: runtime 80 MB, DevSkim 16 MB). Checked in that image as the unprivileged user with an empty environment and --network none: it runs offline. tool-versions.json lists devskim and dotnet-runtime. Fixtures: fixtures/dotnet/legacy-sample, a small vulnerable C#/VB.NET library with a Web.config (SSL 3, certificate validation off, DES, XXE, BinaryFormatter in VB.NET, tracing, cookies without Secure), and nightly targets for it and for framework48; their baselines need a bless run after deploy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
This commit is contained in:
1 parent
e51a790d59
commit
05fa4975d8
18 files changed
+902
-3
No files matched your search
@@ -90,6 +90,19 @@
|
||||
"elttam-struts-xml-always-select-full-namespace"
|
||||
],
|
||||
"check": "Vendored rules (GitLab, elttam): the shipped configuration must be secure by default; a development mode left on (Struts devMode or dynamic method invocation), permissive CORS, world-writable file permissions, a service bound to all interfaces or a missing input-validation framework violates it."
|
||||
},
|
||||
{
|
||||
"tool": "devskim",
|
||||
"scan_type": "sast",
|
||||
"languages": [
|
||||
"csharp",
|
||||
"vb"
|
||||
],
|
||||
"cwe": [
|
||||
"CWE-489"
|
||||
],
|
||||
"rules": [],
|
||||
"check": "The shipped configuration must be secure by default; ASP.NET tracing switched on in Web.config violates it."
|
||||
}
|
||||
],
|
||||
"note": null,
|
||||
@@ -282,6 +295,19 @@
|
||||
],
|
||||
"rules": [],
|
||||
"check": "Vendored rules (GitLab): no password or key may be written into the source; a real credential assigned in code violates it. A placeholder or an empty value does not."
|
||||
},
|
||||
{
|
||||
"tool": "devskim",
|
||||
"scan_type": "sast",
|
||||
"languages": [
|
||||
"csharp",
|
||||
"vb"
|
||||
],
|
||||
"cwe": [
|
||||
"CWE-798"
|
||||
],
|
||||
"rules": [],
|
||||
"check": "No credential (password, key, token) may be written into the product's source or configuration: every installation would ship the same secret. A placeholder does not violate it."
|
||||
}
|
||||
],
|
||||
"note": null,
|
||||
@@ -385,6 +411,19 @@
|
||||
],
|
||||
"rules": [],
|
||||
"check": "Vendored rules (GitLab, elttam): session state must be protected; cookies without Secure, HttpOnly or a safe SameSite value, and state-changing handlers without CSRF protection violate it."
|
||||
},
|
||||
{
|
||||
"tool": "devskim",
|
||||
"scan_type": "sast",
|
||||
"languages": [
|
||||
"csharp",
|
||||
"vb"
|
||||
],
|
||||
"cwe": [
|
||||
"CWE-614"
|
||||
],
|
||||
"rules": [],
|
||||
"check": "Session and authentication cookies must be Secure; a Web.config that turns the Secure flag off violates it."
|
||||
}
|
||||
],
|
||||
"note": null,
|
||||
@@ -518,6 +557,20 @@
|
||||
"elttam-gcm-static-iv"
|
||||
],
|
||||
"check": "Vendored rules (GitLab, elttam): sensitive data must be protected with current algorithms; DES, RC4, MD5, SHA-1, ECB, RSA without padding, short keys, a static GCM nonce or a timing-unsafe comparison of secrets violates it. A non-security use (a cache key, a checksum of public data) does not."
|
||||
},
|
||||
{
|
||||
"tool": "devskim",
|
||||
"scan_type": "sast",
|
||||
"languages": [
|
||||
"csharp",
|
||||
"vb"
|
||||
],
|
||||
"cwe": [
|
||||
"CWE-327",
|
||||
"CWE-328"
|
||||
],
|
||||
"rules": [],
|
||||
"check": "Data must not be protected with a broken algorithm: MD5, SHA-1, DES, 3DES, RC2 or ECB mode used for integrity or confidentiality violates it. A non-security use (a cache key, a checksum of public data) does not."
|
||||
}
|
||||
],
|
||||
"note": null,
|
||||
@@ -575,6 +628,19 @@
|
||||
"cra-ai-14-objc-secret-in-userdefaults"
|
||||
],
|
||||
"check": "An iOS app must keep passwords, tokens and keys in the Keychain; storing them in UserDefaults (also through @AppStorage), an unencrypted plist in the app container, violates it. The Objective-C rule is a regex pattern (semgrep has no Objective-C parser), hence the regex language."
|
||||
},
|
||||
{
|
||||
"tool": "devskim",
|
||||
"scan_type": "sast",
|
||||
"languages": [
|
||||
"csharp",
|
||||
"vb"
|
||||
],
|
||||
"cwe": [
|
||||
"CWE-311"
|
||||
],
|
||||
"rules": [],
|
||||
"check": "Data protected with DPAPI (ProtectedData) needs additional entropy; without it any process of the same user can read it."
|
||||
}
|
||||
],
|
||||
"note": null,
|
||||
@@ -658,6 +724,21 @@
|
||||
],
|
||||
"rules": [],
|
||||
"check": "Vendored rules (GitLab): network traffic must use TLS 1.2 or newer with certificate and host checking; disabled verification, plain-text protocols (HTTP, FTP, SMTP, telnet) for sensitive data or an old protocol version violates it."
|
||||
},
|
||||
{
|
||||
"tool": "devskim",
|
||||
"scan_type": "sast",
|
||||
"languages": [
|
||||
"csharp",
|
||||
"vb"
|
||||
],
|
||||
"cwe": [
|
||||
"CWE-295",
|
||||
"CWE-319",
|
||||
"CWE-757"
|
||||
],
|
||||
"rules": [],
|
||||
"check": "Network traffic must use TLS 1.2 or newer with certificate checking; a disabled certificate check, an outdated or hard-coded old protocol version, or plain http:// for data that needs protection violates it."
|
||||
}
|
||||
],
|
||||
"note": null,
|
||||
@@ -736,6 +817,20 @@
|
||||
],
|
||||
"rules": [],
|
||||
"check": "Vendored rules (GitLab, 0xdea): keys, tokens and nonces need a cryptographically secure random generator; rand(), java.util.Random, Math.random or the random module for them violates it."
|
||||
},
|
||||
{
|
||||
"tool": "devskim",
|
||||
"scan_type": "sast",
|
||||
"languages": [
|
||||
"csharp",
|
||||
"vb"
|
||||
],
|
||||
"cwe": [
|
||||
"CWE-338",
|
||||
"CWE-321"
|
||||
],
|
||||
"rules": [],
|
||||
"check": "Keys, tokens and nonces need a cryptographic random generator (RandomNumberGenerator), and private keys must not be committed; System.Random or a time-based seed for them violates it."
|
||||
}
|
||||
],
|
||||
"note": null,
|
||||
@@ -942,6 +1037,20 @@
|
||||
"elttam-UnsafeHttpInvokerServiceExporter-XML"
|
||||
],
|
||||
"check": "Vendored rules (GitLab, 0xdea, elttam): untrusted input must not reach an interpreter, the file system, a deserialiser or a fixed-size buffer unchecked; injection (SQL, OS command, LDAP, XPath, XSS, template), path traversal, unsafe deserialisation, XXE, SSRF, open redirects, and memory errors (unbounded copies, off-by-one, use after free, double free, integer wraparound) violate it."
|
||||
},
|
||||
{
|
||||
"tool": "devskim",
|
||||
"scan_type": "sast",
|
||||
"languages": [
|
||||
"csharp",
|
||||
"vb"
|
||||
],
|
||||
"cwe": [
|
||||
"CWE-502",
|
||||
"CWE-611"
|
||||
],
|
||||
"rules": [],
|
||||
"check": "Untrusted input must not reach an unsafe deserialiser (BinaryFormatter, NetDataContractSerializer, SoapFormatter, LosFormatter) or an XML parser that resolves external entities."
|
||||
}
|
||||
],
|
||||
"note": null,
|
||||
|
||||
Reference in new issue
Block a user