Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building a Secure Continuous Delivery Pipeline ...

Building a Secure Continuous Delivery Pipeline - Medly.Tech

In this talk, we will speak about challenges teams face to include security as a practice. We will share some of the lessons learned, tools and techniques to help teams build a continuous delivery pipeline which has security at its core. We will also talk about how a continuously evolving threat model helps team to bake security in the product instead of bloating on later.

Shirish Padalkar

October 23, 2021
Tweet

More Decks by Shirish Padalkar

Other Decks in Technology

Transcript

  1. 2 About Me • Shirish Padalkar / शि रीष पाडळकर

    • Developer, Agile Coach, Security Specialist • Principal Engineer @ Medly • Security / DevSecOps practice lead
  2. 4

  3. “I feel like we talk about dev and ops working

    better together, but we kind of ignore security and security teams.” Pete Cheslock “Why We Can't Have Nice Things”, DevOpsDays Austin, 2015
  4. 7

  5. 8

  6. 9 The Security Sandwich } Threat modeling Security discussions Penetration

    testing A lot of changes Who is taking care of security?
  7. 14 No upfront design • Upfront design is a big

    no-no in agile / lean teams • When to make sure the design is secure? • How do you review the design? • Design isn’t done • No design document to be handed off • Design is constantly changing along with the code and requirements • Lean teams want to build MVP, fail fast
  8. 15 Microservices • Good for scaling and maintaining domain boundaries

    • Bring operational complexity • Big attack surface • No obvious security “choke point” • Different tech stack ➟ difficult to standardise security practices • No standard logging by default
  9. 16 Containers • Standard for deployment on the cloud •

    Package and deploy all of the runtime dependencies • Eliminates the “works on my machine” problem • Provide some isolation and security protection by default • How to manage secrets inside image? • Dealing with container breakouts • How do you know if container image to be trusted?
  10. 25

  11. 31 Security Champions Program • Every project has one nominated

    security champion • Single point of contact for the team from security perspective • Security Champion • Has strong engineering skills • Has visibility into key decisions of the project • Is an influential team member • Security team mentors this person about security • Goals of security champion • Educate the team about security thinking • Own project’s Threat Model • Manage known vulnerabilities
  12. 32 Secure defaults • Make it easy to write secure

    code and difficult to make mistakes • Build on top of secure libraries and frameworks • Build security in upfront and try to make it invisible to developers • Provide tools which identifies if an insecure dependency is introduced • Define a security low bar which all projects needs to meet • All password must be encrypted • Every engineer must have 2FA enabled • Etc.
  13. 33 Gather Security Requirements • Get security requirement as part

    of each story • Mark security sensitive stories and get them reviewed by security specialist • Write security acceptance criteria • Write abuse(r) / “evil user” stories / “misuse cases”
  14. 34 Abuse cases As an attacker I want to perform

    a SQL injection attack against login form So that I can login as an admin without correct credentials
  15. 35 5 minute threat modeling • What assumptions are you

    making about callers? • Can you trust the data you are getting? • What happens if something fails? https://martinfowler.com/articles/agile-threat-modelling.html
  16. 36

  17. 38 SAST Tools • Static Application Security Testing (SAST) •

    Designed to analyse source code • Some tools are starting to move into the IDE
  18. 39 SAST Tools - Strengths • Provides immediate feedback •

    Scales well • Can be run on lots of software • Can be run repeatedly • Useful for things such as buffer overflows, SQL Injection Flaws • Output is good for developers • Highlights the precise source files, line numbers
  19. 40 SAST Tools - Weaknesses • Not all security vulnerabilities

    are easy to find automatically • Authentication problems • Access control issues • Insecure use of cryptography, etc. • High numbers of false positives • Some commercial tools do a better job at this • Still need to 'prove' that an identified security issue is an actual vulnerability. • Many of these tools have difficulty analysing code that can't be compiled.
  20. 46 Pairing with security specialist • Pairing with security specialist

    on security sensitive stories • Helps understanding “why”s, not just “how”s • Code reviews
  21. 51 DAST tools • Dynamic Application Security Testing (DAST) •

    Designed to scan web applications, normally from the outside • Great to catch low hanging fruits • eg. missing CORS headers • Can’t validate logic flaw automatically
  22. 54

  23. 55 Automated tests • We can’t rely fully on SAST

    and DAST tools • Sometimes we need to write own tests for validating business logic flaws
  24. 58 Gauntlt • Framework that enables security testing that is

    usable by devs, ops and security. • easy-to-read language • Easily hooks into testing tools and processes • Adaptors for • nmap • cURL • sqlmap • etc. • http://gauntlt.org/ # nmap-simple.attack Feature: simple nmap attack to check for open ports Background: Given "nmap" is installed And the following profile: | name | value | | hostname | example.com | Scenario: Check standard web ports When I launch an "nmap" attack with: """ nmap -F <hostname> """ Then the output should match /80.tcp\s+open/ Then the output should not match: """ 25\/tcp\s+open """
  25. 59 Manual Security Testing • Do as exploratory testing •

    Not effective as a control gate in CI/CD world • Pen tests takes too long to setup, run and review • Don’t forget to automate after discovering vulnerability!
  26. 61 Infrastructure as Code • Must have to fix security

    problems at one place propagate everywhere • Compliance using code • Can write security tests for • unnecessary services are disabled • ports that do not need to be open are indeed not open • Review permissions on sensitive files and directories
  27. 66 Managing Secrets 6 stages of secret management • Denial

    - No solution • Reluctance - Emailing encrypted secrets • Bargaining - Team password managers • Acceptance - Encrypted DVCS • Progress - Orchestration • Mastery - Secret Service https://www.vaultproject.io/
  28. 69 Feature Toggles • Gives you control to turn functionality

    on or off dynamically • Super handy if something goes wrong • https://writeabout.net/2016/12/21/there-is-no-devops-without-feature-flags/
  29. 71 Take aways • Delivery at speed needs security at

    speed • Security can’t get in the way of delivery • More often than not, the security team isn’t available to look at everything. We need to do more! • Prefer built-in security over bloat-in security • Introduce transparent tools which breaks your CD pipeline if vulnerabilities are introduced • Everybody is responsible for security.
  30. 72 Snapshot of tools • IDE plugins • Snyk •

    FindSecBugs • Talisman • Dependency Checker • Github Dependabot • Snyk Scanner • DAST • Burp Suite • Zed Attack Proxy • Automated tests • Semgrep • Gauntlt • tfsec • Hashicorp Sentinel • Clair Image Scanner • Open Policy Agent • Hashicorp Vault • dev-sec.io
  31. 75 Interested in implementing this? We are hiring! [email protected] https://apply.medly.careers/

    Our Values • Empathy • Make realistic tradeoffs • Credibility • “Enablers of security” than owners of security • Reward good security practices • Helping people who ask is always our highest priority