SlideShare a Scribd company logo
@darkmsph1t
o n e s i z e f i t s m e
BUILDING SECURE-BY-DEFAULT NODEJS
APPLICATIONS
yolonda smith
AKA: What I did this summer while all the other kids were outside playing
@darkmsph1t
the common refrain
“That’s handled somewhere
else
[downstream/upstream/some
other made up place]”
“Is this really that big of a
problem? What’s the
likelihood that anyone will
ever find this?”
“Where does it say we have
to do that?”
@darkmsph1t
@darkmsph1t
t h e c h a l l e n g e
CAN I FOLLOW MY OWN ADVICE?
@darkmsph1t
rules of engagement
1. Assume limited-knowledge or background in security
2. Tech stack used should offer (relatively) low barrier to entry and yet…
• Widely used in production environment I’m familiar with
3. Final application must implement security guidance from a well-known
framework (e.g. NIST, OWASP)
@darkmsph1t
key requirements
build “security” in from the very
beginning
contextualized to application
flexible enough to adjust to app
changes
cover all the bases
provide everything needed to build
an application which is ‘secure by
default’
@darkmsph1t
___ ___ _ ___ _____ _ _ _
/ __| | _  /_ |_  |_ _| /_ |  | |
___ __  | _/ / _  | / | | / _  | .` |
|___| |___/ |_ | /_/ _  |_ |_ |_| /_ / _ |_ | _|
IN T R ODUCING
@darkmsph1t
what is it?
• node app deployed as an npm cli module
• Delivers policy (security.json) & boilerplate code/middleware for immediate use
• Built-in support:
• Redis
• MongoDB
• Firebase && local authentication
• Synk => application dependency vulnerabilities
• mocha-chai => unit testing
• Coveralls => test coverage
• TravisCI-ready
@darkmsph1t
concept of operations
CACHE
DATABASE
SESSIONS
SECURITY HEADERS
FORMS
CONNECTION
SECRETS
CLIENT
ACCESS CONTROL
CSP
CACHE
CORS
APP DEPENDENCIES
@darkmsph1t
@darkmsph1t
• Shouldn’t need domain expertise needed to get basics done
• Security things for other security people
• Security with the application not around the application
@darkmsph1t
d e m o n s t r a t i o n
YOU CAN PLAY TOO!
node npm git* Your fave text editor/IDEterminal
@darkmsph1t
npm init -y
Optional : git init
@darkmsph1t
npm install -g spartan-shield
yarn add spartan-shield
@darkmsph1t
$ _spartan -h
@darkmsph1t
@darkmsph1t
p r a c t i c a l e x a m p l e
NEUTRALIZING DIGITAL SKIMMERS WITH _SPARTAN
@darkmsph1t@darkmsph1t
@darkmsph1t
what are the options?
1. JSONP…please, God, no…
2. Regenerate js for every page load
• Shorten cache period
3. Minimize the amount of 3P javascript running
on sensitive pages
4. Limit the context where 3P javascript can run
(e.g. sandbox) and what permissions it has
(CORS)
5. Track changes in javascript that we do allow
• Make sure we know when failures occur
@darkmsph1t
what did we get done?
CACHE
SESSIONS
SECURITY HEADERS
FORMS
CONNECTION
SECRETS
CLIENT
ACCESS CONTROL
CSP
CACHE
CORS
APP DEPENDENCIES
DATABASE
@darkmsph1t
what i learned
@darkmsph1t
what’s next?
1. (More) testing, refactor & documentation
2. Desktop (Electron) app && REST API
3. Introduction of audit through RBAC
• Track policy changes
• Very basic fuzzing & code-audit
4. Port boilerplate to other languages
• GO, Spring, Ruby top priorities
@darkmsph1t
unsolicited advice
1. DO know what you have, understand its
value and watch it
a. This includes infrastructure
2. DON’T rely on the pen-test to catch all of
the security issues
3. DO devote at least one sprint/epic on
secure design & code review
4. DO make sure that you have a means of
detecting attempts to circumvent your
controls
@darkmsph1t
q u e s t i o n s
@darkmsph1t
o n e s i z e f i t s m e
BUILDING SECURE-BY-DEFAULT NODEJS
APPLICATIONS
@darkmsph1t darkmsph1t.github.io darkmsph1t@gmail.com
@darkmsph1t
• All things skimmer:
• https://otx.alienvault.com/pulse/5ba3c739f1b1ed67ed7764c1
• https://gwillem.gitlab.io/tag/skimming/
• https://gwillem.gitlab.io/2018/09/18/abs-cbn.com-hacked/
resources & references

More Related Content

Similar to Building Secure By Default Nodejs Applications (20)

SecDevOps for API Security
SecDevOps for API Security
42Crunch
 
Enterprise Node - Securing Your Environment
Enterprise Node - Securing Your Environment
Kurtis Kemple
 
AppSensor CodeMash 2017
AppSensor CodeMash 2017
jtmelton
 
Serverless Security Guy Podjarny Liran Tal
Serverless Security Guy Podjarny Liran Tal
xenikwit30
 
How to Build Secure APIs with Node.js for Remote Applications.ppt
How to Build Secure APIs with Node.js for Remote Applications.ppt
GraffersID
 
AppSensor Near Real-Time Event Detection and Response - DevNexus 2016
AppSensor Near Real-Time Event Detection and Response - DevNexus 2016
jtmelton
 
Including security in devops
Including security in devops
Jérémy Matos
 
Shields Up! Securing React Apps
Shields Up! Securing React Apps
Zachary Klein
 
Secure Coding for NodeJS
Secure Coding for NodeJS
Thang Chung
 
Stop expecting magic fairy dust: Make apps secure by design
Stop expecting magic fairy dust: Make apps secure by design
Patrick Walsh
 
A Complete Guide to Node.js Authentication and Security
A Complete Guide to Node.js Authentication and Security
Naresh IT
 
How to Build a Fortress with the Security of a Tent - Jacob Ideskog, Curity
How to Build a Fortress with the Security of a Tent - Jacob Ideskog, Curity
Nordic APIs
 
AppSec Tel Aviv - OWASP Top 10 For JavaScript Developers
AppSec Tel Aviv - OWASP Top 10 For JavaScript Developers
Lewis Ardern
 
AllDayDevOps 2019 AppSensor
AllDayDevOps 2019 AppSensor
jtmelton
 
How npm is making JavaScript safe for everyone
How npm is making JavaScript safe for everyone
Daniel Sauble
 
Proactive Security AppSec Case Study
Proactive Security AppSec Case Study
Andy Hoernecke
 
Designing Secure APIs
Designing Secure APIs
Steven Chen
 
Snyk Intro - Developer Security Essentials 2022
Snyk Intro - Developer Security Essentials 2022
Liran Tal
 
Effective approaches to web application security
Effective approaches to web application security
Zane Lackey
 
12 best Node.js security practices in 2024
12 best Node.js security practices in 2024
russellpitt93
 
SecDevOps for API Security
SecDevOps for API Security
42Crunch
 
Enterprise Node - Securing Your Environment
Enterprise Node - Securing Your Environment
Kurtis Kemple
 
AppSensor CodeMash 2017
AppSensor CodeMash 2017
jtmelton
 
Serverless Security Guy Podjarny Liran Tal
Serverless Security Guy Podjarny Liran Tal
xenikwit30
 
How to Build Secure APIs with Node.js for Remote Applications.ppt
How to Build Secure APIs with Node.js for Remote Applications.ppt
GraffersID
 
AppSensor Near Real-Time Event Detection and Response - DevNexus 2016
AppSensor Near Real-Time Event Detection and Response - DevNexus 2016
jtmelton
 
Including security in devops
Including security in devops
Jérémy Matos
 
Shields Up! Securing React Apps
Shields Up! Securing React Apps
Zachary Klein
 
Secure Coding for NodeJS
Secure Coding for NodeJS
Thang Chung
 
Stop expecting magic fairy dust: Make apps secure by design
Stop expecting magic fairy dust: Make apps secure by design
Patrick Walsh
 
A Complete Guide to Node.js Authentication and Security
A Complete Guide to Node.js Authentication and Security
Naresh IT
 
How to Build a Fortress with the Security of a Tent - Jacob Ideskog, Curity
How to Build a Fortress with the Security of a Tent - Jacob Ideskog, Curity
Nordic APIs
 
AppSec Tel Aviv - OWASP Top 10 For JavaScript Developers
AppSec Tel Aviv - OWASP Top 10 For JavaScript Developers
Lewis Ardern
 
AllDayDevOps 2019 AppSensor
AllDayDevOps 2019 AppSensor
jtmelton
 
How npm is making JavaScript safe for everyone
How npm is making JavaScript safe for everyone
Daniel Sauble
 
Proactive Security AppSec Case Study
Proactive Security AppSec Case Study
Andy Hoernecke
 
Designing Secure APIs
Designing Secure APIs
Steven Chen
 
Snyk Intro - Developer Security Essentials 2022
Snyk Intro - Developer Security Essentials 2022
Liran Tal
 
Effective approaches to web application security
Effective approaches to web application security
Zane Lackey
 
12 best Node.js security practices in 2024
12 best Node.js security practices in 2024
russellpitt93
 

Recently uploaded (20)

How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
Edge AI and Vision Alliance
 
TimeSeries Machine Learning - PyData London 2025
TimeSeries Machine Learning - PyData London 2025
Suyash Joshi
 
MCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
MCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
Bluebash
 
GIS and FME: The Foundation to Improve the Locate Process of Utilities
GIS and FME: The Foundation to Improve the Locate Process of Utilities
Safe Software
 
Dancing with AI - A Developer's Journey.pptx
Dancing with AI - A Developer's Journey.pptx
Elliott Richmond
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Anchore
 
Oracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI Foundations
VICTOR MAESTRE RAMIREZ
 
7 Salesforce Data Cloud Best Practices.pdf
7 Salesforce Data Cloud Best Practices.pdf
Minuscule Technologies
 
Data Virtualization: Bringing the Power of FME to Any Application
Data Virtualization: Bringing the Power of FME to Any Application
Safe Software
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
Introduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUE
Google Developer Group On Campus European Universities in Egypt
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
ThousandEyes
 
If You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FME
Safe Software
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
Edge AI and Vision Alliance
 
TimeSeries Machine Learning - PyData London 2025
TimeSeries Machine Learning - PyData London 2025
Suyash Joshi
 
MCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
MCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
Bluebash
 
GIS and FME: The Foundation to Improve the Locate Process of Utilities
GIS and FME: The Foundation to Improve the Locate Process of Utilities
Safe Software
 
Dancing with AI - A Developer's Journey.pptx
Dancing with AI - A Developer's Journey.pptx
Elliott Richmond
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Anchore
 
Oracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI Foundations
VICTOR MAESTRE RAMIREZ
 
7 Salesforce Data Cloud Best Practices.pdf
7 Salesforce Data Cloud Best Practices.pdf
Minuscule Technologies
 
Data Virtualization: Bringing the Power of FME to Any Application
Data Virtualization: Bringing the Power of FME to Any Application
Safe Software
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
ThousandEyes
 
If You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FME
Safe Software
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
Ad

Building Secure By Default Nodejs Applications

  • 1. @darkmsph1t o n e s i z e f i t s m e BUILDING SECURE-BY-DEFAULT NODEJS APPLICATIONS yolonda smith AKA: What I did this summer while all the other kids were outside playing
  • 2. @darkmsph1t the common refrain “That’s handled somewhere else [downstream/upstream/some other made up place]” “Is this really that big of a problem? What’s the likelihood that anyone will ever find this?” “Where does it say we have to do that?”
  • 4. @darkmsph1t t h e c h a l l e n g e CAN I FOLLOW MY OWN ADVICE?
  • 5. @darkmsph1t rules of engagement 1. Assume limited-knowledge or background in security 2. Tech stack used should offer (relatively) low barrier to entry and yet… • Widely used in production environment I’m familiar with 3. Final application must implement security guidance from a well-known framework (e.g. NIST, OWASP)
  • 6. @darkmsph1t key requirements build “security” in from the very beginning contextualized to application flexible enough to adjust to app changes cover all the bases provide everything needed to build an application which is ‘secure by default’
  • 7. @darkmsph1t ___ ___ _ ___ _____ _ _ _ / __| | _ /_ |_ |_ _| /_ | | | ___ __ | _/ / _ | / | | / _ | .` | |___| |___/ |_ | /_/ _ |_ |_ |_| /_ / _ |_ | _| IN T R ODUCING
  • 8. @darkmsph1t what is it? • node app deployed as an npm cli module • Delivers policy (security.json) & boilerplate code/middleware for immediate use • Built-in support: • Redis • MongoDB • Firebase && local authentication • Synk => application dependency vulnerabilities • mocha-chai => unit testing • Coveralls => test coverage • TravisCI-ready
  • 9. @darkmsph1t concept of operations CACHE DATABASE SESSIONS SECURITY HEADERS FORMS CONNECTION SECRETS CLIENT ACCESS CONTROL CSP CACHE CORS APP DEPENDENCIES
  • 11. @darkmsph1t • Shouldn’t need domain expertise needed to get basics done • Security things for other security people • Security with the application not around the application
  • 12. @darkmsph1t d e m o n s t r a t i o n YOU CAN PLAY TOO! node npm git* Your fave text editor/IDEterminal
  • 14. @darkmsph1t npm install -g spartan-shield yarn add spartan-shield
  • 16. @darkmsph1t p r a c t i c a l e x a m p l e NEUTRALIZING DIGITAL SKIMMERS WITH _SPARTAN
  • 18. @darkmsph1t what are the options? 1. JSONP…please, God, no… 2. Regenerate js for every page load • Shorten cache period 3. Minimize the amount of 3P javascript running on sensitive pages 4. Limit the context where 3P javascript can run (e.g. sandbox) and what permissions it has (CORS) 5. Track changes in javascript that we do allow • Make sure we know when failures occur
  • 19. @darkmsph1t what did we get done? CACHE SESSIONS SECURITY HEADERS FORMS CONNECTION SECRETS CLIENT ACCESS CONTROL CSP CACHE CORS APP DEPENDENCIES DATABASE
  • 21. @darkmsph1t what’s next? 1. (More) testing, refactor & documentation 2. Desktop (Electron) app && REST API 3. Introduction of audit through RBAC • Track policy changes • Very basic fuzzing & code-audit 4. Port boilerplate to other languages • GO, Spring, Ruby top priorities
  • 22. @darkmsph1t unsolicited advice 1. DO know what you have, understand its value and watch it a. This includes infrastructure 2. DON’T rely on the pen-test to catch all of the security issues 3. DO devote at least one sprint/epic on secure design & code review 4. DO make sure that you have a means of detecting attempts to circumvent your controls
  • 23. @darkmsph1t q u e s t i o n s
  • 24. @darkmsph1t o n e s i z e f i t s m e BUILDING SECURE-BY-DEFAULT NODEJS APPLICATIONS @darkmsph1t darkmsph1t.github.io [email protected]
  • 25. @darkmsph1t • All things skimmer: • https://otx.alienvault.com/pulse/5ba3c739f1b1ed67ed7764c1 • https://gwillem.gitlab.io/tag/skimming/ • https://gwillem.gitlab.io/2018/09/18/abs-cbn.com-hacked/ resources & references