Security

Vulnerability scanning in .NET with DevSkim and GitHub Actions

DEV Community: #dotnet Victor Cesar Carretero Hualpa
Security

A walkthrough that wires Microsoft's free DevSkim analyzer into a GitHub Actions pipeline so every push to a .NET 8 API is scanned, uploaded to Code Scanning as SARIF and published as a public HTML report.

Key points

  • DevSkim is Microsoft's free, open source SAST analyzer that outputs SARIF, which GitHub Code Scanning reads natively.
  • The sample is a .NET 8 Minimal API seeded with deliberate flaws: MD5 hashing, hardcoded credentials, plain HTTP and `System.Random` tokens.
  • Three workflow steps do the work: `microsoft/DevSkim-Action@v1`, `github/codeql-action/upload-sarif@v3` and a Python SARIF-to-HTML script.
  • The job needs `security-events: write`, plus `pages: write` and `id-token: write` to publish reports on GitHub Pages.
  • First run took 2 min 8 s and produced 10 findings — 8 critical DS126858 weak hashes, 1 DS137138 insecure URL, 1 DS176209 TODO comment.
  • The pattern-based analyzer missed the connection string password and the non-cryptographic RNG, so a secret scanner is still needed.

Real-world use

  • A team that wants a security gate on every pull request to `main` without buying a commercial scanner
  • A public or open source .NET API whose scan results can be published for users and auditors
  • Reviewers who need the SARIF findings inside the repository's Security tab next to the code

This summary was generated by the agent from the original post on DEV Community: #dotnet. The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message