Top Banner
How to leverage static code analysis in your CICD pipelines for continuous code quality Dana Epp Microsoft Regional Director https://danaepp.com
32

How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

May 07, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

How to leverage static code analysis in your CICD pipelines for continuous code quality

Dana EppMicrosoft Regional Directorhttps://danaepp.com

Page 2: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana
Page 3: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

When the code is incorrect, youcan't really talk about security.When the code is faulty, itcannot be safe.

- Gene ‘Spaf’ Spafford

Page 4: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

Quality is not an act,it is a habit.

-- Aristotle

Page 5: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

If you can’t champion codequality with your team, howcan you ever champion securecode?

- Dana Epp

Page 6: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

Passing static code analysisdoesn’t prove your code issafe… but failing it pretty muchsignals it isn’t.

- Dana Epp

Page 7: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana
Page 8: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

WHY IS THAT?

Page 9: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

Most studies show that inspectionis cheaper than testing. [We] foundthat code reading detected 80%more faults per hour than testing.

- Basili and Selby 1987

Page 10: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

Comparing defect detection approaches

Page 11: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

What can static code analysis

do for me??

Page 12: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

Know the quality of your code at all times

Page 13: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

Detect bugs

Page 14: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

Detect ‘code smells’

Page 15: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

Explore more execution paths

Page 16: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

Discover cognitive complexity issues

Page 17: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

Find security vulnerabilities

Page 18: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

Review security ‘hotspots’

Page 19: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

Enforce security best practices

Page 20: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

Untrusted input analysis (taint analysis)

Page 21: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

OWASP / SANS security reports

• Requires SonarQube Enterprise

Page 22: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

OWASP / SANS security reports

• Available in SonarCloud

Page 23: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana
Page 24: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

Our DevOps toolchain

Azure Boards Azure Repos Azure Pipelines Azure Artifacts

Page 25: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

• Typescript code targeting NodeJS deployed to Web App for Containers

• C++ code targeting Linux shell deployed to Azure Container Instances

• C# code targeting .NET Core 3.1 deployed to Azure Container Instances

• C# code targeting .NET Core 2.1 deployed to Azure Functions

• Typescript code targeting Angular 8 deployed to Azure CDN / Frontdoor

Our Stack

Page 26: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

Languages SonarQube supports

Page 27: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

We start with SonarLint – Democratize quality

Page 28: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

We enforce peer code review before merge

Require at least one other code reviewer

Don’t allow requestor to approve their own work

Require all code to be linked to work on the board

Page 29: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

Merge triggers build pipeline

Inject static code analysis agent into build environment, configured to your project in SonarCloud

Execute static code analysis

Report results to SonarCloud

Page 30: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

Build success triggers release pipeline

Enable Deployment Gates

Quality Gate enforcement

Page 31: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

• Azure DevOps : https://dev.azure.com• SonarLint : https://www.sonarlint.org/

• SonarQube : https://www.sonarqube.org/

• SonarCloud: https://www.sonarcloud.io

• Dana Epp: https://danaepp.com• AuditWolf: https://www.auditwolf.com

More information / links

Tools

Follow

Page 32: How to leverage static code analysis in your CICD pipelines for … · 2020-04-28 · How to leverage static code analysis in your CICD pipelines for continuous code quality. Dana

Questions??

Dana EppMicrosoft Regional Directorhttps://danaepp.com