Skip to content

Enable security analyzers#8427

Open
andrewlock wants to merge 44 commits intomasterfrom
andrew/security-analyzers
Open

Enable security analyzers#8427
andrewlock wants to merge 44 commits intomasterfrom
andrew/security-analyzers

Conversation

@andrewlock
Copy link
Copy Markdown
Member

Summary of changes

Enables the built-in security analyzers

Reason for change

We added the performance once, adding the security ones seemed to be the prudent thing to do

Implementation details

Had 🤖 iterate through them all, enabling, and fixing. But it turns out, there's basically nothing to fix, except in the vendored code, where we can't easily fix it... So, do we actually want all these analyzers running in the build? 🤷‍♂️ 🤔

Test coverage

If the tests pass, we're good

Other details

Only one analyzer that hit too many places, "Use DefaultDllImportSearchPaths attribute for P/Invokes". I'll look into that one further to see if I can fix it. But still, do we actually want all these turned on?

andrewlock and others added 30 commits April 8, 2026 11:46
…ulnerabilities

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… interfaces

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ceptions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…BinaryFormatter

Suppress for vendored third-party code (dnlib).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ialize without first setting Binder

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…set before calling Deserialize

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…LosFormatter

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…NetDataContractSerializer

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rializer and ObjectStateFormatter deserializer rules

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…leTypeResolver rules

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…s other than None

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…urity rules

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…taTable security rules

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…vulnerability rules

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix DotnetCommon.cs to use XmlReader with DtdProcessing.Prohibit.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…, XML Document and XML Text Reader

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ntiForgeryToken

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…orithms

Suppress for vendored code. Pragma suppress IAST aspect that
intentionally constructs TripleDES to detect weak crypto usage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…lgorithms

Suppress for vendored code. Pragma suppress Md5Helper (intentional MD5
usage) and IAST aspects (intentional DES/RC2 detection).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tion

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…deserialization

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rong crypto

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rialized object graph

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…n, security protocols, HTTP header checking

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…aSet, pointer fields, ViewStateUserKey

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ize, validating reader, schema read, XPathDocument

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
andrewlock and others added 14 commits April 8, 2026 14:15
…rm, shared access signature rules

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ivation, certificate store rules

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ey size rules

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…Type value

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ve path injection rules

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CA5391 - Use antiforgery tokens in ASP.NET Core MVC controllers.
CA5392 - Use DefaultDllImportSearchPaths attribute for P/Invokes
(commented out, too many P/Invoke methods across the codebase).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…Path value

Suppress for vendored third-party code (dnlib).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Suppress for vendored code and non-security Random usage
(sampling, rate limiting, trace/span ID generation).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ookie HttpOnly rules

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…and hardcoding rules

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…vocation list check rules

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…d-coded certificate rules

Suppress CA5401 for vendored third-party code (SharpZipLib).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@andrewlock andrewlock added the area:builds project files, build scripts, pipelines, versioning, releases, packages label Apr 8, 2026
@andrewlock andrewlock requested review from a team as code owners April 8, 2026 15:11
@andrewlock andrewlock added the AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos label Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos area:builds project files, build scripts, pipelines, versioning, releases, packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants