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.

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

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.
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
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.
Testing Web Applications Using Cypress
TestJS Summit - January, 2021TestJS Summit - January, 2021
173 min
Testing Web Applications Using Cypress
WorkshopFree
Gleb Bahmutov
Gleb Bahmutov
This workshop will teach you the basics of writing useful end-to-end tests using Cypress Test Runner.
We will cover writing tests, covering every application feature, structuring tests, intercepting network requests, and setting up the backend data.
Anyone who knows JavaScript programming language and has NPM installed would be able to follow along.
Build a powerful DataGrid in few hours with Ag Grid
React Summit US 2023React Summit US 2023
96 min
Build a powerful DataGrid in few hours with Ag Grid
WorkshopFree
Mike Ryan
Mike Ryan
Does your React app need to efficiently display lots (and lots) of data in a grid? Do your users want to be able to search, sort, filter, and edit data? AG Grid is the best JavaScript grid in the world and is packed with features, highly performant, and extensible. In this workshop, you’ll learn how to get started with AG Grid, how we can enable sorting and filtering of data in the grid, cell rendering, and more. You will walk away from this free 3-hour workshop equipped with the knowledge for implementing AG Grid into your React application.
We all know that rolling our own grid solution is not easy, and let's be honest, is not something that we should be working on. We are focused on building a product and driving forward innovation. In this workshop, you'll see just how easy it is to get started with AG Grid.
Prerequisites: Basic React and JavaScript
Workshop level: Beginner
0 to Auth in an hour with ReactJS
React Summit 2023React Summit 2023
56 min
0 to Auth in an hour with ReactJS
WorkshopFree
Kevin Gao
Kevin Gao
Passwordless authentication may seem complex, but it is simple to add it to any app using the right tool. There are multiple alternatives that are much better than passwords to identify and authenticate your users - including SSO, SAML, OAuth, Magic Links, One-Time Passwords, and Authenticator Apps.
While addressing security aspects and avoiding common pitfalls, we will enhance a full-stack JS application (Node.js backend + React frontend) to authenticate users with OAuth (social login) and One Time Passwords (email), including:- User authentication - Managing user interactions, returning session / refresh JWTs- Session management and validation - Storing the session securely for subsequent client requests, validating / refreshing sessions- Basic Authorization - extracting and validating claims from the session token JWT and handling authorization in backend flows
At the end of the workshop, we will also touch other approaches of authentication implementation with Descope - using frontend or backend SDKs.

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
Do you have a large product built by many teams? Are you struggling to release often? Did your frontend turn into a massive unmaintainable monolith? If, like me, you’ve answered yes to any of those questions, this talk is for you! I’ll show you exactly how you can build a micro frontend architecture with Remix to solve those challenges.
Levelling up Monorepos with npm Workspaces
DevOps.js Conf 2022DevOps.js Conf 2022
33 min
Levelling up Monorepos with npm Workspaces
Top Content
Learn more about how to leverage the default features of npm workspaces to help you manage your monorepo project while also checking out some of the new npm cli features.
Full Stack Components
Remix Conf Europe 2022Remix Conf Europe 2022
37 min
Full Stack Components
Top Content
Remix is a web framework that gives you the simple mental model of a Multi-Page App (MPA) but the power and capabilities of a Single-Page App (SPA). One of the big challenges of SPAs is network management resulting in a great deal of indirection and buggy code. This is especially noticeable in application state which Remix completely eliminates, but it's also an issue in individual components that communicate with a single-purpose backend endpoint (like a combobox search for example).
In this talk, Kent will demonstrate how Remix enables you to build complex UI components that are connected to a backend in the simplest and most powerful way you've ever seen. Leaving you time to chill with your family or whatever else you do for fun.
A Framework for Managing Technical Debt
TechLead Conference 2023TechLead Conference 2023
35 min
A Framework for Managing Technical Debt
Top Content
Let’s face it: technical debt is inevitable and rewriting your code every 6 months is not an option. Refactoring is a complex topic that doesn't have a one-size-fits-all solution. Frontend applications are particularly sensitive because of frequent requirements and user flows changes. New abstractions, updated patterns and cleaning up those old functions - it all sounds great on paper, but it often fails in practice: todos accumulate, tickets end up rotting in the backlog and legacy code crops up in every corner of your codebase. So a process of continuous refactoring is the only weapon you have against tech debt.In the past three years, I’ve been exploring different strategies and processes for refactoring code. In this talk I will describe the key components of a framework for tackling refactoring and I will share some of the learnings accumulated along the way. Hopefully, this will help you in your quest of improving the code quality of your codebases.

Making JavaScript on WebAssembly Fast
JSNation Live 2021JSNation Live 2021
29 min
Making JavaScript on WebAssembly Fast
Top Content
JavaScript in the browser runs many times faster than it did two decades ago. And that happened because the browser vendors spent that time working on intensive performance optimizations in their JavaScript engines.Because of this optimization work, JavaScript is now running in many places besides the browser. But there are still some environments where the JS engines can’t apply those optimizations in the right way to make things fast.We’re working to solve this, beginning a whole new wave of JavaScript optimization work. We’re improving JavaScript performance for entirely different environments, where different rules apply. And this is possible because of WebAssembly. In this talk, I'll explain how this all works and what's coming next.
Debugging JS
React Summit 2023React Summit 2023
24 min
Debugging JS
Top Content
As developers, we spend much of our time debugging apps - often code we didn't even write. Sadly, few developers have ever been taught how to approach debugging - it's something most of us learn through painful experience.  The good news is you _can_ learn how to debug effectively, and there's several key techniques and tools you can use for debugging JS and React apps.