Allow explicitly targeted rules in build files - #653
Conversation
Allow explicitly targeted rules to report build-file findings while preserving suppression for universal rules. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f0f9dbe0-e8ba-472b-b645-eda10038e683
SDL Security Review
Scope: 7 files, +111/−12. Review covers changed lines only in application source; test and doc-comment changes noted for completeness. Findings
Per-file notes
|
Summary
Rule.IsUniversaland reuse it from rule selection and both processing paths.applies_toorapplies_to_file_regexto emit non-Metadata tags without-A.--allow-all-tags-in-build-files, add synchronous and asynchronous regression coverage, and remove three now-unnecessary test workarounds.Background
The build-file filter was intended to prevent generic feature rules from producing incidental findings in build/configuration files. Because it applied to every matching rule, it also suppressed rules deliberately scoped to build languages or filenames, making 22 default rules silent unless users supplied
-A.The project's XML tests were also working around this behavior with
AllowAllTagsInBuildFiles = true; the overrides are now removed where those rules explicitly targetpom.xml,AndroidManifest.xml, or.configfiles. Universal JSON/XML tests retain the option.Revived default rules
AI002100TravisCI,AI002200CircleCI,AI002300Azure Pipelines,AI017300BambooAI016800Maven,AI016900Ant,AI017000Gradle,AI017100Jenkins,AI017200SBT,AI017600Ivy,AI017700Leiningen,AI017800VisualStudioAI028500NETCore,AI028600NETStandard,AI028700MonoAI070003GenerativeAI,AI070302MCPAI002600Azure DataStorage,AI011700Oracle SQL,AI031565Hashicorp Packer,AI034700OS ACL Write Unsafe,AI041800AvaBehavior change
Scans can now report additional tags from rules that explicitly target build-type files. Universal rules remain filtered in build files by default, so the original anti-noise behavior is preserved;
-Aonly opts universal rules into non-Metadata findings.Scanning this repository with the old and fixed engines against the same source tree using
--no-file-metadatachangeduniqueTagsfrom 76 to 79. No tags were removed; these were added:CloudServices.Code.CI.Microsoft.Azure(AI002300)Development.Build.VisualStudio(AI017800)Platform.Microsoft.NETStandard(AI028600)Validation
dotnet buildsucceeded..travis.yml/pom.xml/.csproj/build.gradlerepro emitsCloudServices.Code.CI.TravisCI,Development.Build.Maven, andPlatform.Microsoft.NETStandardwithout-A; the universalApplication.Target.Frameworktag remains suppressed.dotnet test AppInspector.Tests/AppInspector.Tests.csproj -f net9.0: 351 passed, 0 failed.PR #651 ("Add WebApp.API ruleset for detecting exposed HTTP/REST APIs") depends on this fix and will be rebased onto this branch.