Top Banner
49

Static Analysis For Security and DevOps Happiness w/ Justin Collins

Apr 15, 2017

Download

Software

sonatype
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: Static Analysis For Security and DevOps Happiness w/ Justin Collins
Page 2: Static Analysis For Security and DevOps Happiness w/ Justin Collins
Page 3: Static Analysis For Security and DevOps Happiness w/ Justin Collins
Page 4: Static Analysis For Security and DevOps Happiness w/ Justin Collins

Me

@MakotoTheCat

Page 5: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Obligatory “About Me”

6 years of application security(AT&T Interactive, Twitter, SurveyMonkey)

6 years working on Brakeman OSS(Static analysis security tool for Rails)

2.5 years working on (More pro static analysis security tool for Rails)

Page 6: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

The Ratio of Doom

100 : 10 : 1Dev Ops Sec

Shannon Lietzhttp://www.slideshare.net/SeniorStoryteller/the-journey-to-devsecops

Page 7: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

The Ratio of Doom

100 developers - experts on their slice of the code

1 security person - responsible for ALL code + systems

Page 8: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Not Sustainable nor Scalable

Page 9: Static Analysis For Security and DevOps Happiness w/ Justin Collins
Page 10: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

DevOpsDevelopers as responsible for stable code as ops team is

DevSecOpsDevelopers as responsible for secure code as security team is

Page 11: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Security Team’s Role

Expertise

Guidance

Training

Tools

Page 12: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Security Tools in DevOps Land

Automation friendly

Fast

Consistent

Provide early feedback for developers

Page 13: Static Analysis For Security and DevOps Happiness w/ Justin Collins
Page 14: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Static Analysis

Page 15: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Static Source Code Analysis

Page 16: Static Analysis For Security and DevOps Happiness w/ Justin Collins
Page 17: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Automation Friendly

Input: Source Code

Output: Report

Page 18: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Page 19: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Page 20: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Fast

(Especially in comparison to “web scanners”)

Page 21: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Project Controllers Models Templates Scan Time

Diaspora 48 54 44 5s

Discourse 78 162 57 15s

Redmine 50 86 342 24s

GitlabHQ 150 123 707 61s

Canvas LMS 176 384 455 161s

Brakeman Scan Times

Brakeman 3.4.1, Ruby 2.3.1p112

Page 22: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Consistent

(Especially in comparison to “web scanners”)

Page 23: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Consistent

Baseline scan -> Incremental results

Page 24: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

brakeman --compare report.json

Page 25: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Early Feedback (for Developers)

“Amplify feedback loops”

Page 26: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

“Shift Left”

WriteCode

UnitTests

Commit Code

Push to CI

CodeReview

QATests

Deploy!Plan /Reqs

In Production

Security?

Page 27: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

“Shift Left”

WriteCode

UnitTests

Commit Code

Push to CI

CodeReview

QATests

Deploy!Plan /Reqs

In Production

Security!

Page 28: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Source Code Analysis

WriteCode

UnitTests

Commit Code

Push to CI

CodeReview

QATests

Deploy!Plan /Reqs

In Production

Security!

Kind of Latebut Possible

Page 29: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Source Code Analysis

WriteCode

UnitTests

Commit Code

Push to CI

CodeReview

QATests

Deploy!Plan /Reqs

In Production

Security!

DeploymentGate

Page 30: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Source Code Analysis

WriteCode

UnitTests

Commit Code

Push to CI

CodeReview

QATests

Deploy!Plan /Reqs

In Production

Security!

QA?Why not?

Page 31: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Source Code Analysis

WriteCode

UnitTests

Commit Code

Push to CI

CodeReview

QATests

Deploy!Plan /Reqs

In Production

Security!

Manual Scans

Page 32: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Source Code Analysis

WriteCode

UnitTests

Commit Code

Push to CI

CodeReview

QATests

Deploy!Plan /Reqs

In Production

Security!

New WarningsFail Build

Page 33: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Source Code Analysis

WriteCode

UnitTests

Commit Code

Push to CI

CodeReview

QATests

Deploy!Plan /Reqs

In Production

Security!

Commit Hooks

Page 34: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Source Code Analysis

WriteCode

UnitTests

Commit Code

Push to CI

CodeReview

QATests

Deploy!Plan /Reqs

In Production

Security!

Run in Tests

Page 35: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Source Code Analysis

WriteCode

UnitTests

Commit Code

Push to CI

CodeReview

QATests

Deploy!Plan /Reqs

In Production

Security!

Run in IDE /On Save

Page 36: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Early Feedback

Few dependencies makes integration easy

Fast tools can be “in line” with workflow

Incremental results relevant to changes

Page 37: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Automation Strategies

Page 38: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Continuous Integration

https://jenkins.io/blog/2016/08/10/rails-cd-with-pipeline/

Brakeman plugin

Page 39: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Code Review

Brakeman engine

Page 40: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Deployment Gate

Page 41: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Tweetable Incremental Scan

Page 42: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Separate Process

Page 43: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Local Tests/Git Hook

guard-brakeman

Page 44: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

require "brakeman/test/minitest"

class TestBrakemanWarnings < Minitest::Test def test_no_brakeman_warnings assert_no_brakeman_warnings endend

(Brakeman Pro only)

Page 45: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Types of Static Analysis Tools

Security - Vulnerabilities

Composition - Old/vulnerable dependencies

Quality - Complexity

Style

Page 48: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

In Conclusion

Source code analysis fits well with DevOps

Enables security review inside workflow

Provides feedback early in development

Multiple options for integration points

Page 49: Static Analysis For Security and DevOps Happiness w/ Justin Collins

@presidentbeef

Thank You

@presidentbeef / presidentbeef.com