feat(dotnet): .NET detection, NuGet SBOM, C# rules and config checks (#447)
Minimal .NET/C# support for epic #445 (N1-N5): detection of solutions/projects and target frameworks, NuGet SBOM without build or restore (pkg:nuget purls for OSV, unresolved-dependency warning, end-of-support frameworks), own C# semgrep rule pack, .NET configuration and key-file checks, .NET build output and restored packages not counted as own code. Fixture fixtures/dotnet/framework48, docs .NET-Projekte (DE/EN). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
This commit was merged in pull request #447.
This commit is contained in:
1 parent
654f387c80
commit
8926255d6f
34 files changed
+3356
-43
No files matched your search
+42
-1
@@ -250,6 +250,44 @@ mod tests {
|
||||
assert!(memory_safety.checked_for(&["cpp".to_string()]));
|
||||
// gitleaks reads any file, so no language is needed.
|
||||
assert!(secrets.checked_for(&[]));
|
||||
// C# is checked for secure defaults by its own rules and the .NET
|
||||
// configuration checks.
|
||||
assert!(secure_defaults.checked_for(&["csharp".to_string()]));
|
||||
assert!(memory_safety.checked_for(&["csharp".to_string()]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dotnet_findings_attach_to_their_controls() {
|
||||
let map = ControlMap::cra().expect("map");
|
||||
let controls = |tool: &str, rule: &str| -> Vec<String> {
|
||||
map.controls_for_finding(tool, None, Some(rule))
|
||||
.iter()
|
||||
.map(|c| c.control.clone())
|
||||
.collect()
|
||||
};
|
||||
assert_eq!(
|
||||
controls(
|
||||
"semgrep",
|
||||
"tmp.compliance-cra-semgrep-csharp.cra-ai-20-csharp-sql-string"
|
||||
),
|
||||
["cra-ai-20"]
|
||||
);
|
||||
assert_eq!(
|
||||
controls("dotnet-config", "dotnet-config-cleartext-password"),
|
||||
["cra-ai-9"]
|
||||
);
|
||||
assert_eq!(
|
||||
controls("dotnet-config", "dotnet-config-wcf-insecure-binding"),
|
||||
["cra-ai-15"]
|
||||
);
|
||||
assert_eq!(
|
||||
controls("secret-files", "secret-file-private-key"),
|
||||
["cra-ai-16"]
|
||||
);
|
||||
assert_eq!(
|
||||
controls("dotnet-lifecycle", "dotnet-framework-end-of-support"),
|
||||
["cra-ai-22"]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -259,7 +297,10 @@ mod tests {
|
||||
let map = ControlMap::cra().expect("map");
|
||||
for control in &map.controls {
|
||||
for scan in &control.scans {
|
||||
let reads_code = !matches!(scan.tool.as_str(), "gitleaks" | "syft" | "osv");
|
||||
let reads_code = !matches!(
|
||||
scan.tool.as_str(),
|
||||
"gitleaks" | "secret-files" | "syft" | "osv"
|
||||
);
|
||||
assert_eq!(
|
||||
reads_code,
|
||||
!scan.languages.is_empty(),
|
||||
|
||||
Reference in new issue
Block a user