Finding, Hacking and fixing your NodeJS Vulnerabilities with Snyk

Rate this content
Bookmark

npm and security, how much do you know about your dependencies?

Hack-along, live hacking of a vulnerable Node app https://github.com/snyk-labs/nodejs-goof, Vulnerabilities from both Open source and written code. Encouraged to download the application and hack along with us.

Fixing the issues and an introduction to Snyk with a demo.

Open questions.

This workshop has been presented at JSNation 2022, check out the latest edition of this JavaScript Conference.

FAQ

Snyk is a platform that helps improve security by scanning for vulnerabilities in code, dependencies, and containers. It integrates with development environments and CI/CD pipelines to provide real-time feedback and guidance on fixing vulnerabilities, thus enhancing the security posture of applications.

You can use Snyk by installing its CLI tool or integrating it into your IDE. Snyk can scan your project for vulnerabilities and provide recommendations and patches. You can also integrate Snyk into your version control system to monitor branches and pull requests for security issues.

The 'snyk test' command scans your project and reports vulnerabilities for a one-time check, while 'snyk monitor' records the state of dependencies to continuously monitor and alert you about new vulnerabilities that affect your project over time.

Yes, Snyk can suggest alternatives to vulnerable packages. This is facilitated by the Snyk Advisor feature, which provides health scores for packages and recommends healthier, more secure alternatives.

Prototype pollution is a vulnerability that allows an attacker to inject properties into existing JavaScript language construct prototypes. It can be mitigated by validating input data to ensure that objects are not tampered with, using Object.freeze to prevent modifications to objects, and avoiding the use of unsafe recursive merge functions.

When no direct fixes are available, Snyk allows users to ignore non-critical vulnerabilities with justification, apply patches if available, or migrate to more secure and actively maintained alternatives. Snyk also provides detailed information and educational resources on how to manually mitigate such vulnerabilities.

Yes, Snyk supports multiple programming languages including Java, Python, Go, C-Sharp, and Ruby, among others. This makes it a versatile tool for a wide range of development environments.

Best practices for using Snyk include integrating it early in the development process, continuously monitoring dependencies for vulnerabilities, using Snyk's patch management to apply fixes, and educating the development team on secure coding practices using resources like Snyk Learn.

Matthew Salmon
Matthew Salmon
99 min
04 Jul, 2022

Comments

Sign in or register to post your comment.

Video Summary and Transcription

This Workshop on Open Source and Security covers topics such as the use of open source packages in JavaScript, the risks and vulnerabilities associated with open source, and real-world examples of vulnerabilities and exploits. It emphasizes the importance of promptly addressing vulnerabilities and provides insights into fixing vulnerabilities using tools like Snyk. The Workshop also discusses best practices for package maintenance, triaging vulnerabilities, and integrating security measures into software development pipelines.

1. Introduction to Open Source and Security

Short description:

Hey there, my name is Matt Simon. I'm a Solutions Engineer with Snyk, so I'm working with customers of Snyk in order to improve the security posture using Snyk as their tooling of choice. Today's session is focused on open source in general and using open source inside of JavaScript and NPM to improve your applications and make them more secure. We'll start by booting up an application and hacking it. After that, we'll discuss fixing the vulnerabilities and give a high-level introduction to Snick. Feel free to interact with me during the presentation. Now, let's start with a basic introduction to open source.

Is it Phylicity or Toolkit? Hey there, my name is Matt Simon. I'm a Solutions Engineer with Snyk, so I'm working with customers of Snyk in order to basically improve the security posture using Snyk as their tooling of choice. Effectively, today's session is going to be primarily focused on open source in general and using open source inside of JavaScript and NPM in order to basically improve your applications and also make them more secure at the same time. This is primarily going to be from a security perspective.

So, without further ado, I'll get on to the agenda. So the first part of the day is going to be focusing on open source, and then what we're going to do is actually get into booting up an application and actually hacking it as well. So, if you're interested, you can follow along and hack the application alongside it. So, I'll quickly boot up the repo. So it's actually, I think it's Node.js.-goof. I'll quickly find it. It should be in my recent. There we go. And I'll send this through. If anyone's interested, I'll send this through in the Zoom chat, and feel free to get it up alongside it. And you can start hacking as well in the meantime. To run it, you need either MongoDB installed, or you'll just need Docker installed. So you can do one or the other. And I'll be running through... There's some example exploits in here, and there's also some more exploits inside of this folder that you can start playing with on your own side. I'll only be focusing on a couple of those in the meantime. But feel free to have a crack at this if you're in spare time of interest. So, without further ado, I'll go into the rest of it. After hacking into these, then we'll take about a 50 minute interval just to have a comfort break. And then we'll be going into kind of what you can do about actually fixing the vulnerabilities that we've exploited. And then I'm going to do a basic introduction at high level into Snick and kind of how we help secure things in your environment. I hope that all makes sense. Please feel free to stop me as I go along this presentation. I want it to be interactive. And I want you to guys to get something out of it rather than just talk in a monologue. So, please feel free to interact with me. Hit me up in the Zoom chat, or just come off mute and say hi. Yeah. Cool. I'll get started.

So, just to start off with, this is just a basic introduction to open source. And obviously, everyone knows what open source is and like the power of it and why we actually care about it. The main idea is that it's awesome because it helps us develop things in a quick, easy way. And it also allows us to do things in a more standardized way as well, because we can iterate over each other's processes and find out communitively, what is the best practice for doing things. So, as an example of that, I was on the hunt yesterday or over the weekend to buy new computer parts. And we've got a website in the UK called scan, which is the scan.co.uk. And this is a platform for buying computer parts as such. So, what I'd like to do as a bit of an exercise is to kind of, even if you haven't seen this website before, if you could come off mute, just shout out what you think certain parts of this web application are hosted via or supported via open source, just to name a few functions or name like different ways in which you can automatically know. Let's say for example, clicking on the help ticket, what they would actually do and how that can be supported by open source. Does that make sense? Yeah, for sure. The basket. It's something which, you know, every basically commerce website has, and it's something which is standardised across them. Yeah, like a lot of it, Joe. It's like the more you look, the more you realize that, yeah, it's definitely powered by open source as far as things like your login, for example. Like you've got this little help button down here, which will open up like its own window and widget and then have like a chatbot features inside of it. And while the chatbot may not be free, it may also be powered by some other kind of service.

QnA

Watch more workshops on topic

Master JavaScript Patterns
JSNation 2024JSNation 2024
145 min
Master JavaScript Patterns
Featured Workshop
Adrian Hajdin
Adrian Hajdin
During this workshop, participants will review the essential JavaScript patterns that every developer should know. Through hands-on exercises, real-world examples, and interactive discussions, attendees will deepen their understanding of best practices for organizing code, solving common challenges, and designing scalable architectures. By the end of the workshop, participants will gain newfound confidence in their ability to write high-quality JavaScript code that stands the test of time.
Points Covered:
1. Introduction to JavaScript Patterns2. Foundational Patterns3. Object Creation Patterns4. Behavioral Patterns5. Architectural Patterns6. Hands-On Exercises and Case Studies
How It Will Help Developers:
- Gain a deep understanding of JavaScript patterns and their applications in real-world scenarios- Learn best practices for organizing code, solving common challenges, and designing scalable architectures- Enhance problem-solving skills and code readability- Improve collaboration and communication within development teams- Accelerate career growth and opportunities for advancement in the software industry
Build Modern Applications Using GraphQL and Javascript
Node Congress 2024Node Congress 2024
152 min
Build Modern Applications Using GraphQL and Javascript
Featured Workshop
Emanuel Scirlet
Miguel Henriques
2 authors
Come and learn how you can supercharge your modern and secure applications using GraphQL and Javascript. In this workshop we will build a GraphQL API and we will demonstrate the benefits of the query language for APIs and what use cases that are fit for it. Basic Javascript knowledge required.
Integrating LangChain with JavaScript for Web Developers
React Summit 2024React Summit 2024
92 min
Integrating LangChain with JavaScript for Web Developers
Featured Workshop
Vivek Nayyar
Vivek Nayyar
Dive into the world of AI with our interactive workshop designed specifically for web developers. "Hands-On AI: Integrating LangChain with JavaScript for Web Developers" offers a unique opportunity to bridge the gap between AI and web development. Despite the prominence of Python in AI development, the vast potential of JavaScript remains largely untapped. This workshop aims to change that.Throughout this hands-on session, participants will learn how to leverage LangChain—a tool designed to make large language models more accessible and useful—to build dynamic AI agents directly within JavaScript environments. This approach opens up new possibilities for enhancing web applications with intelligent features, from automated customer support to content generation and beyond.We'll start with the basics of LangChain and AI models, ensuring a solid foundation even for those new to AI. From there, we'll dive into practical exercises that demonstrate how to integrate these technologies into real-world JavaScript projects. Participants will work through examples, facing and overcoming the challenges of making AI work seamlessly on the web.This workshop is more than just a learning experience; it's a chance to be at the forefront of an emerging field. By the end, attendees will not only have gained valuable skills but also created AI-enhanced features they can take back to their projects or workplaces.Whether you're a seasoned web developer curious about AI or looking to expand your skillset into new and exciting areas, "Hands-On AI: Integrating LangChain with JavaScript for Web Developers" is your gateway to the future of web development. Join us to unlock the potential of AI in your web projects, making them smarter, more interactive, and more engaging for users.
Using CodeMirror to Build a JavaScript Editor with Linting and AutoComplete
React Day Berlin 2022React Day Berlin 2022
86 min
Using CodeMirror to Build a JavaScript Editor with Linting and AutoComplete
Top Content
WorkshopFree
Hussien Khayoon
Kahvi Patel
2 authors
Using a library might seem easy at first glance, but how do you choose the right library? How do you upgrade an existing one? And how do you wade through the documentation to find what you want?
In this workshop, we’ll discuss all these finer points while going through a general example of building a code editor using CodeMirror in React. All while sharing some of the nuances our team learned about using this library and some problems we encountered.
Building a Shopify App with React & Node
React Summit Remote Edition 2021React Summit Remote Edition 2021
87 min
Building a Shopify App with React & Node
Top Content
WorkshopFree
Jennifer Gray
Hanna Chen
2 authors
Shopify merchants have a diverse set of needs, and developers have a unique opportunity to meet those needs building apps. Building an app can be tough work but Shopify has created a set of tools and resources to help you build out a seamless app experience as quickly as possible. Get hands on experience building an embedded Shopify app using the Shopify App CLI, Polaris and Shopify App Bridge.We’ll show you how to create an app that accesses information from a development store and can run in your local environment.
Node.js Masterclass
Node Congress 2023Node Congress 2023
109 min
Node.js Masterclass
Top Content
Workshop
Matteo Collina
Matteo Collina
Have you ever struggled with designing and structuring your Node.js applications? Building applications that are well organised, testable and extendable is not always easy. It can often turn out to be a lot more complicated than you expect it to be. In this live event Matteo will show you how he builds Node.js applications from scratch. You’ll learn how he approaches application design, and the philosophies that he applies to create modular, maintainable and effective applications.

Level: intermediate

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Scaling Up with Remix and Micro Frontends
Remix Conf Europe 2022Remix Conf Europe 2022
23 min
Scaling Up with Remix and Micro Frontends
Top Content
This talk discusses the usage of Microfrontends in Remix and introduces the Tiny Frontend library. Kazoo, a used car buying platform, follows a domain-driven design approach and encountered issues with granular slicing. Tiny Frontend aims to solve the slicing problem and promotes type safety and compatibility of shared dependencies. The speaker demonstrates how Tiny Frontend works with server-side rendering and how Remix can consume and update components without redeploying the app. The talk also explores the usage of micro frontends and the future support for Webpack Module Federation in Remix.
Levelling up Monorepos with npm Workspaces
DevOps.js Conf 2022DevOps.js Conf 2022
33 min
Levelling up Monorepos with npm Workspaces
Top Content
NPM workspaces help manage multiple nested packages within a single top-level package, improving since the release of NPM CLI 7.0. You can easily add dependencies to workspaces and handle duplications. Running scripts and orchestration in a monorepo is made easier with NPM workspaces. The npm pkg command is useful for setting and retrieving keys and values from package.json files. NPM workspaces offer benefits compared to Lerna and future plans include better workspace linking and adding missing features.
Full Stack Components
Remix Conf Europe 2022Remix Conf Europe 2022
37 min
Full Stack Components
Top Content
RemixConf EU discussed full stack components and their benefits, such as marrying the backend and UI in the same file. The talk demonstrated the implementation of a combo box with search functionality using Remix and the Downshift library. It also highlighted the ease of creating resource routes in Remix and the importance of code organization and maintainability in full stack components. The speaker expressed gratitude towards the audience and discussed the future of Remix, including its acquisition by Shopify and the potential for collaboration with Hydrogen.
A Framework for Managing Technical Debt
TechLead Conference 2023TechLead Conference 2023
35 min
A Framework for Managing Technical Debt
Top Content
Today's Talk discusses the importance of managing technical debt through refactoring practices, prioritization, and planning. Successful refactoring requires establishing guidelines, maintaining an inventory, and implementing a process. Celebrating success and ensuring resilience are key to building a strong refactoring culture. Visibility, support, and transparent communication are crucial for addressing technical debt effectively. The team's responsibilities, operating style, and availability should be transparent to product managers.
Debugging JS
React Summit 2023React Summit 2023
24 min
Debugging JS
Top Content
Watch video: Debugging JS
Debugging JavaScript is a crucial skill that is often overlooked in the industry. It is important to understand the problem, reproduce the issue, and identify the root cause. Having a variety of debugging tools and techniques, such as console methods and graphical debuggers, is beneficial. Replay is a time-traveling debugger for JavaScript that allows users to record and inspect bugs. It works with Redux, plain React, and even minified code with the help of source maps.
Making JavaScript on WebAssembly Fast
JSNation Live 2021JSNation Live 2021
29 min
Making JavaScript on WebAssembly Fast
Top Content
WebAssembly enables optimizing JavaScript performance for different environments by deploying the JavaScript engine as a portable WebAssembly module. By making JavaScript on WebAssembly fast, instances can be created for each request, reducing latency and security risks. Initialization and runtime phases can be improved with tools like Wiser and snapshotting, resulting in faster startup times. Optimizing JavaScript performance in WebAssembly can be achieved through techniques like ahead-of-time compilation and inline caching. WebAssembly usage is growing outside the web, offering benefits like isolation and portability. Build sizes and snapshotting in WebAssembly depend on the application, and more information can be found on the Mozilla Hacks website and Bike Reliance site.