JS Security Testing in GitHub Actions

Rate this content
Bookmark

This workshop will focus on automating software composition analysis, static application security testing and dynamic application security testing using GitHub Actions. After a brief introduction covering the different types of application security and the importance of finding security vulnerabilities before they hit production, we'll dive into a hands-on session where users will add three different security testing tool to their build pipelines.

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

FAQ

StackHawk helps developers find, triage, and fix application security bugs before deploying to production. It integrates into CI/CD pipelines to automate security testing.

Download the StackHawk configuration file from the StackHawk platform, open it in a text editor, and then add this file to the root of your repository as StackHawk.yaml.

Setting a failure threshold in StackHawk allows you to specify the severity of issues that will cause the build to fail. This ensures that critical vulnerabilities are addressed before deployment.

Yes, StackHawk can scan APIs. It supports OpenAPI specs, SOAP WSDL configurations, and GraphQL introspection endpoints to discover API routes and supported queries.

You can run StackHawk locally using its CLI or as a Docker container. The CLI can be installed via Homebrew for Mac, or you can use Docker commands to run the scanner.

StackHawk offers integrations with Slack, MS Teams, Jira, and various CI/CD platforms. It also has a partnership with Snyk to correlate DAST and SAST results for more comprehensive security insights.

The workshop will use GitHub Actions, Dependabot, CodeQL, and StackHawk to automate the build and security tests of a Node.js application.

CodeQL is a static application security testing (SAST) tool provided by GitHub. It scans your code for patterns that may cause vulnerabilities and is free for public repositories.

Zachary Conger is a Senior DevOps Engineer at StackHawk with extensive experience as a developer, automator, tester, observer, and operator of IT systems. He is also a musician, cyclist, and photographer.

To enable Dependabot, go to the Settings of your GitHub repository, then navigate to Code security and analysis. Enable Dependency graph, Dependabot alerts, and Dependabot security updates.

Zachary Conger
Zachary Conger
101 min
04 Jul, 2022

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Today's Workshop focuses on automating build and security tests for a Node.js application using tools like Stackhawk, Dependabot, CodeQL, and GitHub Actions. GitHub Actions is a powerful CI platform with a marketplace of Actions and built-in secrets management. CodeQL is a SAST utility that scans code for vulnerabilities, while Stackhawk is a dynamic application security testing tool. The Workshop covers enabling code security and analysis, configuring StackHawk, and running scans locally. Overall, the Workshop provides practical guidance for integrating security into software development pipelines.

1. Introduction to Workshop and Agenda

Short description:

My name is Zachary Conger, a Senior DevOps Engineer at StackHawk. Today, we'll automate the build and security tests for a Node.js application. We'll use various tools like Stackhawk, Dependabot, CodeQL, and GitHub actions to ensure application security.

My name is Zachary Conger. I am a Senior DevOps Engineer here at StackHawk, and I've been a developer and an automator, tester, observer, also operator of IT systems for many years Also a musician, cyclist, and photographer, and I love doing these workshops. I love seeing people's reactions to the tools and how easy it can be to add security to your pipelines.

The bird we are repping today is Stackhawk. Stackhawk helps developers find, triage, and fix application security bugs before deploying to production. It is one of the tools that we'll be using today to automate security in your pipeline, but certainly not the only tool. In fact, we're going to be starting with a couple of other ones.

Our agenda today. We're going to automate our build of a Node.js application. We're going to automate security tests for that application as well. We're going to use all you need is a web browser and Discord. And what we're going to do is we're going to take a sample application, we're going to bring it into GitHub. We're going to fork that application. We're going to use GitHub actions to automatically build that application. Then we're going to add Dependabot to scan the app's dependencies for known vulnerabilities. Then we'll add CodeQL to scan the code base and look for vulnerable patterns in the code base. And then we're finally going to add StackHawk to dynamically scan the running application for vulnerabilities all within the build pipeline using GitHub actions.

2. Introduction to GitHub Actions

Short description:

GitHub Actions is a powerful continuous integration platform built into GitHub. It's easy to get started by adding a GitHub Actions configuration file. It uses YAML configuration language and has a marketplace of Actions. It's event-driven and has a built-in secrets management platform. GitHub Actions provide 2,000 free minutes per month. Let's begin with GitHub Actions by forking the vulnerable node express repo to your own repository.

ZACHARY LOTOS. We got a question in the discord, which I'm thrilled about. Should we trust the repo locally in VS Code or should I just use GitHub.com? DREW REINHARDT. Yes, you can trust this application. It's okay to bring it down. You should fork it to your own repo. Yes, you can also use it in GitHub code spaces. We're doing all of this work in the browser only to make it easy for attendees to follow along to minimize any unpredictable outcomes. I encourage you to follow along in the browser, but if you want to bring it down to your workstation or GitHub code spaces, that's fine too. If you're like, what is Zach talking about? We will go over all of that in just a second. So no worries if you're not as familiar with GitHub, we'll be covering all that. Somebody has jumped ahead in the workshop guidebook. An overachiever. All right, so getting started.

The first thing that we're going to work on is GitHub Actions. And GitHub Actions is a powerful continuous integration platform that's built right into GitHub. So it's super handy to use. It's super easy to get started. If you have a repo in GitHub, you can light this thing up just by adding a GitHub Actions configuration file. It will read that file and start building on it, if it finds it, as long as you've got GitHub Actions enabled in your repository and enabled for your organization, which it is by default. So by default, this just works. If you add a configuration file for it, some organizations will turn it off. And sometimes if you fork an application that already has GitHub Actions workflows defined, it will disable actions just so you don't mistakenly do a builds. It's a powerful CI system built into GitHub and uses YAML configuration language and it's got a huge marketplace of something called Actions, the basis of the name. The Actions are like Jenkins plugins. They are little pieces of functionality that are made really accessible by so you can add functions for various things with just a couple of lines of YAML. Everything that we do today, I think, has an action associated with it. CodeQL does, StackHawk does. It's an event driven platform, so it's driven off of events like I pushed some code to GitHub to my repo or I opened a PR or you can send other kinds of webhooks to kick off events. You can also have one workflow kick off another workflow, so it's really, really flexible and you can build complicated pipelines if you want to, but it's very easy to get started with it as well. There's also a built-in secrets management platform in GitHub Actions so that if you have any secrets that you need and we'll have at least one example of a secret that we'll need to inject into our pipeline, you can stash that in the secrets management platform in GitHub so that you don't have to put those secrets into your code base and into your GitHub repo, which is generally a no-no. You don't want to put secrets in your Git repos. It's also really accessible in that they provide 2,000 free minutes per month. Last time I checked, which was a while ago, they may have changed that, but that's a lot of time. That's a lot of build time to work on your projects. I use it for personal projects all the time. Very handy platform, easy to get going, easy to start. Let's go ahead and begin with GitHub actions actually. So I want to refer over to the, let me see, yeah, okay. So what I'd like to do is direct you to, if you have the guide book open, we're going to start with step one, continuous integration workflows and GitHub actions. I will provide a link to that very spot. And you can read from here what we're going to do. So first step we are going to fork this application repo, the vulnerable node express repo. What this is, is just a simple test app that we often use to test various security tools against. What we're going to do is just fork it to your own repository. So hit this fork button here up at the top right. It should prompt you for a good default repository name within your own organization. Give it a description if you like. It's just a vulnerable node express application. Create that fork.

QnA

Watch more workshops on topic

Master JavaScript Patterns
JSNation 2024JSNation 2024
145 min
Master JavaScript Patterns
Top Content
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.
API Testing with Postman Workshop
TestJS Summit 2023TestJS Summit 2023
48 min
API Testing with Postman Workshop
Top Content
WorkshopFree
Pooja Mistry
Pooja Mistry
In the ever-evolving landscape of software development, ensuring the reliability and functionality of APIs has become paramount. "API Testing with Postman" is a comprehensive workshop designed to equip participants with the knowledge and skills needed to excel in API testing using Postman, a powerful tool widely adopted by professionals in the field. This workshop delves into the fundamentals of API testing, progresses to advanced testing techniques, and explores automation, performance testing, and multi-protocol support, providing attendees with a holistic understanding of API testing with Postman.
1. Welcome to Postman- Explaining the Postman User Interface (UI)2. Workspace and Collections Collaboration- Understanding Workspaces and their role in collaboration- Exploring the concept of Collections for organizing and executing API requests3. Introduction to API Testing- Covering the basics of API testing and its significance4. Variable Management- Managing environment, global, and collection variables- Utilizing scripting snippets for dynamic data5. Building Testing Workflows- Creating effective testing workflows for comprehensive testing- Utilizing the Collection Runner for test execution- Introduction to Postbot for automated testing6. Advanced Testing- Contract Testing for ensuring API contracts- Using Mock Servers for effective testing- Maximizing productivity with Collection/Workspace templates- Integration Testing and Regression Testing strategies7. Automation with Postman- Leveraging the Postman CLI for automation- Scheduled Runs for regular testing- Integrating Postman into CI/CD pipelines8. Performance Testing- Demonstrating performance testing capabilities (showing the desktop client)- Synchronizing tests with VS Code for streamlined development9. Exploring Advanced Features - Working with Multiple Protocols: GraphQL, gRPC, and more
Join us for this workshop to unlock the full potential of Postman for API testing, streamline your testing processes, and enhance the quality and reliability of your software. Whether you're a beginner or an experienced tester, this workshop will equip you with the skills needed to excel in API testing with Postman.
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.

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.
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.
Building a Voice-Enabled AI Assistant With Javascript
JSNation 2023JSNation 2023
21 min
Building a Voice-Enabled AI Assistant With Javascript
Top Content
This Talk discusses building a voice-activated AI assistant using web APIs and JavaScript. It covers using the Web Speech API for speech recognition and the speech synthesis API for text to speech. The speaker demonstrates how to communicate with the Open AI API and handle the response. The Talk also explores enabling speech recognition and addressing the user. The speaker concludes by mentioning the possibility of creating a product out of the project and using Tauri for native desktop-like experiences.