SlideShare a Scribd company logo
Open Source and Secure
Coding Practices
—
Sahdev Zala
Senior Software Engineer
Open Source Developer
Is Open Source
Software secure?
2
qDepends on the project
§ Maturity
§ Community
§ Maintainers
§ Governance
qIssues can be caught and
fixed early in the
development cycle
“We believe open source is a public good
and across every industry we have a
responsibility to come together to improve
and support the security of open source
software we all depend on. It is one of the
most important things we can do.”
Jim Zemlin
Executive Director
The Linux Foundation
Secure Coding
Practices
3
q Identify high security risk areas to
pay special attention
§ Refer to the project architecture
q Perform secure code review
§ Automated
§ Manual
§ Define roles of the assessment team
q Third party security audit
q Address findings - short and longer
term
q Plan to publish CVEs
Security Checklist
4
q Authentication and Authorization
§ Cover every users, check password length, encryption,
RBAC
q TLS certificates
§ Make sure not to allow Monkey-In-The-Middle
interference
q Data validations
§ Validate all input parameters, URLs, expected data type,
length, range
q File permissions
§ Pay special attention to third party tools you are using for
file management
q Logging
§ Log error for any security alert
q Error handling
§ Make sure that you are not leaking any sensitive
information that can help hackers
q Third party tools security compliance
§ Use the latest releases, keep eye on any CVE advisories
q Documentation and Configuration
Secure Code Review
5
q Automated analysis
§ Static tools
• Prevents coding mistakes that can impact
security
o e.g. variable shadowing, unreachable code
• govet, staticcheck
https://github.com/analysis-tools-dev/static-
analysis#go
§ Dynamic tools
• Fuzzing
o Finds implementation bugs using
malformed/semi-malformed data injection in an
automated way e.g.
https://github.com/google/gofuzz
q Manual review
§ Tools are good at assessing large amounts of
code and pointing out possible issues
• BUT a person needs to verify every single result
to determine if it is a real issue
§ There is no alternative to manual code review
File Permission
6
Do you see any security issue in
this code snippet?
// create directory with 0700 permission
err := os.MkdirAll(dirPath, 0700)
if err != nil {
return err
}
qIf path is already an existing
directory, MkdirAll does
nothing and returns nil
Ø Make sure that if directory
already exist, it has the desired
permission, if not raise an
error
Data Validation
7
What is wrong here in this snippet?
What’s the security issue?
// update log with msg at given time interval
func updateLog(timeVal string, msg string) (err error)
{
rv, err := strconv.Atoi(timeVal)
if err != nil {
t = time.Duration(int64(rv))
//update log
}
return err
}
q The return value of strconv.Atoi
can be negative which is not
handled in the code
q Misconfiguration can be done by
setting input to a negative value
§ Forever logging, filling all disk
space and rendering application
unable to process properly
Ø Add validation to check for the
negative value
CVEs through GitHub
8
q Common Vulnerabilities and
Exposures (CVEs)
§ List of publicly disclosed computer
security flaws
q Do you know that GitHub has an
integrated feature to request and
publish CVEs?
q Very handy if your project is hosted
on the GitHub
q Keep your CVEs details on your
project GitHub repo
Conclusion
9
q Writing secure code is challenging but
possible
§ Understand project architecture
§ Perform secure code review
§ Use tools like static analyzer and
fuzzer
§ Manual review
§ Keep in mind that less popular features
can be a source of problems
q Third party audit is helpful
q Creating and Publishing CVEs with
GitHub is easy
Learning Resources
10
qOpen Source @ IBM
§ ibm.com/opensource
qOWASP
§ owasp.org
qOpenSSF
§ openssf.org
qMITRE Corporation
§ mitre.org
qTrail of Bits blogs
§ trailofbits.com
Thank You!
Sahdev Zala
Senior Software Engineer, IBM
—
spzala@us.ibm.com
@sp_zala
11

More Related Content

PDF
Securing Your Resources with Short-Lived Certificates!
PPTX
Debugging Your Debugging Tools: What to do When Your Service Mesh Goes Down
PDF
Containers in depth – Understanding how containers work to better work with c...
PPTX
Cleaner Code Through Test-Driven Development
PPT
IstioD - From Microservices to Monolithic
PDF
Deploying Anything as a Service (XaaS) Using Operators on Kubernetes
PDF
Jenkins in the real world - DevOpsCon 2017
PDF
Securing Applications and Pipelines on a Container Platform
Securing Your Resources with Short-Lived Certificates!
Debugging Your Debugging Tools: What to do When Your Service Mesh Goes Down
Containers in depth – Understanding how containers work to better work with c...
Cleaner Code Through Test-Driven Development
IstioD - From Microservices to Monolithic
Deploying Anything as a Service (XaaS) Using Operators on Kubernetes
Jenkins in the real world - DevOpsCon 2017
Securing Applications and Pipelines on a Container Platform

What's hot (20)

PDF
Go for Operations
PDF
FluentD vs. Logstash
PDF
Series of Unfortunate Netflix Container Events - QConNYC17
PDF
Embracing Observability in CI/CD with OpenTelemetry
PDF
2017 Microservices Practitioner Virtual Summit: The Mechanics of Deploying En...
PDF
Clean Infrastructure as Code
PDF
GitOps is the best modern practice for CD with Kubernetes
PDF
A microservice architecture based on golang
PPTX
Onnx and onnx runtime
PDF
Troubleshooting tips from docker support engineers
PDF
Developing a user-friendly OpenResty application
PDF
Improving security with Istio | DevNation Tech Talk
PDF
Netflix OSS Meetup Season 4 Episode 4
PDF
2017 Microservices Practitioner Virtual Summit - Opening Keynote: Trends in M...
PDF
Breaking the monolith
PDF
Canary deployment with Traefik and K3S
PDF
Introduction to GitHub Actions - How to easily automate and integrate with Gi...
PPTX
Virtual Puppet User Group: Puppet Development Kit (PDK) and Puppet Platform 6...
PDF
Continuous (Non)-Functional Testing of Microservices on k8s
PDF
A Story of Cultural Change: PayPal's 2 Year Journey to 150,000 Containers wit...
Go for Operations
FluentD vs. Logstash
Series of Unfortunate Netflix Container Events - QConNYC17
Embracing Observability in CI/CD with OpenTelemetry
2017 Microservices Practitioner Virtual Summit: The Mechanics of Deploying En...
Clean Infrastructure as Code
GitOps is the best modern practice for CD with Kubernetes
A microservice architecture based on golang
Onnx and onnx runtime
Troubleshooting tips from docker support engineers
Developing a user-friendly OpenResty application
Improving security with Istio | DevNation Tech Talk
Netflix OSS Meetup Season 4 Episode 4
2017 Microservices Practitioner Virtual Summit - Opening Keynote: Trends in M...
Breaking the monolith
Canary deployment with Traefik and K3S
Introduction to GitHub Actions - How to easily automate and integrate with Gi...
Virtual Puppet User Group: Puppet Development Kit (PDK) and Puppet Platform 6...
Continuous (Non)-Functional Testing of Microservices on k8s
A Story of Cultural Change: PayPal's 2 Year Journey to 150,000 Containers wit...
Ad

Similar to Open Source and Secure Coding Practices (20)

PDF
Security in open source projects
PPTX
All You need to Know about Secure Coding with Open Source Software
PDF
"CERT Secure Coding Standards" by Dr. Mark Sherman
PDF
Health and Sustainability of Open Source Software from a Public Sector Perspe...
PPTX
Managing Open Source in Application Security and Software Development Lifecycle
PDF
Open Source evaluation: A comprehensive guide on what you are using
PDF
Webinar – Streamling Your Tech Due Diligence Process for Software Assets
PPTX
Security engineering 101 when good design & security work together
PDF
Myths and Misperceptions of Open Source Security
PPT
SoftwareSecurity.ppt
KEY
Open Source Compliance at Twitter
PPTX
September 13, 2016: Security in the Age of Open Source:
PDF
Secure coding-guidelines
PDF
Introduction to the CII Badge Programe, OW2con'16, Paris.
 
PDF
BlueHat Seattle 2019 || Open Source Security, vulnerabilities never come alone
PPT
Code Quality - Security
PDF
OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...
PPTX
Security in the Age of Open Source
PDF
ProdSec: A Technical Approach
PDF
The State of Open Source Security Vulnerabilities in 2020
Security in open source projects
All You need to Know about Secure Coding with Open Source Software
"CERT Secure Coding Standards" by Dr. Mark Sherman
Health and Sustainability of Open Source Software from a Public Sector Perspe...
Managing Open Source in Application Security and Software Development Lifecycle
Open Source evaluation: A comprehensive guide on what you are using
Webinar – Streamling Your Tech Due Diligence Process for Software Assets
Security engineering 101 when good design & security work together
Myths and Misperceptions of Open Source Security
SoftwareSecurity.ppt
Open Source Compliance at Twitter
September 13, 2016: Security in the Age of Open Source:
Secure coding-guidelines
Introduction to the CII Badge Programe, OW2con'16, Paris.
 
BlueHat Seattle 2019 || Open Source Security, vulnerabilities never come alone
Code Quality - Security
OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...
Security in the Age of Open Source
ProdSec: A Technical Approach
The State of Open Source Security Vulnerabilities in 2020
Ad

More from All Things Open (20)

PDF
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
PPTX
Big Data on a Small Budget: Scalable Data Visualization for the Rest of Us - ...
PDF
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
PDF
Let's Create a GitHub Copilot Extension! - Nick Taylor, Pomerium
PDF
Leveraging Pre-Trained Transformer Models for Protein Function Prediction - T...
PDF
Gen AI: AI Agents - Making LLMs work together in an organized way - Brent Las...
PDF
You Don't Need an AI Strategy, But You Do Need to Be Strategic About AI - Jes...
PPTX
DON’T PANIC: AI IS COMING – The Hitchhiker’s Guide to AI - Mark Hinkle, Perip...
PDF
Fine-Tuning Large Language Models with Declarative ML Orchestration - Shivay ...
PDF
Leveraging Knowledge Graphs for RAG: A Smarter Approach to Contextual AI Appl...
PPTX
Artificial Intelligence Needs Community Intelligence - Sriram Raghavan, IBM R...
PDF
Don't just talk to AI, do more with AI: how to improve productivity with AI a...
PPTX
Open-Source GenAI vs. Enterprise GenAI: Navigating the Future of AI Innovatio...
PDF
The Death of the Browser - Rachel-Lee Nabors, AgentQL
PDF
Making Operating System updates fast, easy, and safe
PDF
Reshaping the landscape of belonging to transform community
PDF
The Unseen, Underappreciated Security Work Your Maintainers May (or may not) ...
PDF
Integrating Diversity, Equity, and Inclusion into Product Design
PDF
The Open Source Ecosystem for eBPF in Kubernetes
PDF
Open Source Privacy-Preserving Metrics - Sarah Gran & Brandon Pitman
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
Big Data on a Small Budget: Scalable Data Visualization for the Rest of Us - ...
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
Let's Create a GitHub Copilot Extension! - Nick Taylor, Pomerium
Leveraging Pre-Trained Transformer Models for Protein Function Prediction - T...
Gen AI: AI Agents - Making LLMs work together in an organized way - Brent Las...
You Don't Need an AI Strategy, But You Do Need to Be Strategic About AI - Jes...
DON’T PANIC: AI IS COMING – The Hitchhiker’s Guide to AI - Mark Hinkle, Perip...
Fine-Tuning Large Language Models with Declarative ML Orchestration - Shivay ...
Leveraging Knowledge Graphs for RAG: A Smarter Approach to Contextual AI Appl...
Artificial Intelligence Needs Community Intelligence - Sriram Raghavan, IBM R...
Don't just talk to AI, do more with AI: how to improve productivity with AI a...
Open-Source GenAI vs. Enterprise GenAI: Navigating the Future of AI Innovatio...
The Death of the Browser - Rachel-Lee Nabors, AgentQL
Making Operating System updates fast, easy, and safe
Reshaping the landscape of belonging to transform community
The Unseen, Underappreciated Security Work Your Maintainers May (or may not) ...
Integrating Diversity, Equity, and Inclusion into Product Design
The Open Source Ecosystem for eBPF in Kubernetes
Open Source Privacy-Preserving Metrics - Sarah Gran & Brandon Pitman

Recently uploaded (20)

PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Big Data Technologies - Introduction.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Cloud computing and distributed systems.
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Chapter 3 Spatial Domain Image Processing.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Digital-Transformation-Roadmap-for-Companies.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Big Data Technologies - Introduction.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Understanding_Digital_Forensics_Presentation.pptx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Review of recent advances in non-invasive hemoglobin estimation
Spectral efficient network and resource selection model in 5G networks
Per capita expenditure prediction using model stacking based on satellite ima...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
NewMind AI Weekly Chronicles - August'25 Week I
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Cloud computing and distributed systems.
Network Security Unit 5.pdf for BCA BBA.
MYSQL Presentation for SQL database connectivity
Chapter 3 Spatial Domain Image Processing.pdf

Open Source and Secure Coding Practices

  • 1. Open Source and Secure Coding Practices — Sahdev Zala Senior Software Engineer Open Source Developer
  • 2. Is Open Source Software secure? 2 qDepends on the project § Maturity § Community § Maintainers § Governance qIssues can be caught and fixed early in the development cycle “We believe open source is a public good and across every industry we have a responsibility to come together to improve and support the security of open source software we all depend on. It is one of the most important things we can do.” Jim Zemlin Executive Director The Linux Foundation
  • 3. Secure Coding Practices 3 q Identify high security risk areas to pay special attention § Refer to the project architecture q Perform secure code review § Automated § Manual § Define roles of the assessment team q Third party security audit q Address findings - short and longer term q Plan to publish CVEs
  • 4. Security Checklist 4 q Authentication and Authorization § Cover every users, check password length, encryption, RBAC q TLS certificates § Make sure not to allow Monkey-In-The-Middle interference q Data validations § Validate all input parameters, URLs, expected data type, length, range q File permissions § Pay special attention to third party tools you are using for file management q Logging § Log error for any security alert q Error handling § Make sure that you are not leaking any sensitive information that can help hackers q Third party tools security compliance § Use the latest releases, keep eye on any CVE advisories q Documentation and Configuration
  • 5. Secure Code Review 5 q Automated analysis § Static tools • Prevents coding mistakes that can impact security o e.g. variable shadowing, unreachable code • govet, staticcheck https://github.com/analysis-tools-dev/static- analysis#go § Dynamic tools • Fuzzing o Finds implementation bugs using malformed/semi-malformed data injection in an automated way e.g. https://github.com/google/gofuzz q Manual review § Tools are good at assessing large amounts of code and pointing out possible issues • BUT a person needs to verify every single result to determine if it is a real issue § There is no alternative to manual code review
  • 6. File Permission 6 Do you see any security issue in this code snippet? // create directory with 0700 permission err := os.MkdirAll(dirPath, 0700) if err != nil { return err } qIf path is already an existing directory, MkdirAll does nothing and returns nil Ø Make sure that if directory already exist, it has the desired permission, if not raise an error
  • 7. Data Validation 7 What is wrong here in this snippet? What’s the security issue? // update log with msg at given time interval func updateLog(timeVal string, msg string) (err error) { rv, err := strconv.Atoi(timeVal) if err != nil { t = time.Duration(int64(rv)) //update log } return err } q The return value of strconv.Atoi can be negative which is not handled in the code q Misconfiguration can be done by setting input to a negative value § Forever logging, filling all disk space and rendering application unable to process properly Ø Add validation to check for the negative value
  • 8. CVEs through GitHub 8 q Common Vulnerabilities and Exposures (CVEs) § List of publicly disclosed computer security flaws q Do you know that GitHub has an integrated feature to request and publish CVEs? q Very handy if your project is hosted on the GitHub q Keep your CVEs details on your project GitHub repo
  • 9. Conclusion 9 q Writing secure code is challenging but possible § Understand project architecture § Perform secure code review § Use tools like static analyzer and fuzzer § Manual review § Keep in mind that less popular features can be a source of problems q Third party audit is helpful q Creating and Publishing CVEs with GitHub is easy
  • 10. Learning Resources 10 qOpen Source @ IBM § ibm.com/opensource qOWASP § owasp.org qOpenSSF § openssf.org qMITRE Corporation § mitre.org qTrail of Bits blogs § trailofbits.com
  • 11. Thank You! Sahdev Zala Senior Software Engineer, IBM — spzala@us.ibm.com @sp_zala 11