More Secure Vue & Nuxt Apps - By Default

Rate this content
Bookmark

As developers we usually have to develop fast and because of that some Software Quality aspects such as Performance, Accessibility or Security can suffer. Configuring web applications to be protected against common threats and hackers is difficult. And that is why, you can use Nuxt Security -> a module for Nuxt that will help you build more secure applications without additional configuration needed! 

In this talk, I will guide you through the concepts of Security in modern web applications and OWASP to help you build more secure Vue & Nuxt applications!

Jakub Andrzejewski
Jakub Andrzejewski
21 min
25 Apr, 2024

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Handling security in front-end development is crucial, and the OWASP Top 10 is a valuable resource for secure coding. The list of security risks is constantly evolving, and the Nuxt security module provides features like security headers, rate limiting, and cross-site request forgery protection. Frontend developers should prioritize security to avoid information leaks and mitigate risks. Understanding the difference between public and private tokens is important for secure token handling.

1. Introduction to Secure Next Apps

Short description:

Handling security is traditionally seen as the responsibility of back-end developers or DevOps engineers. However, with more functionality being moved to the front-end, it is important for everyone to prioritize security. In this presentation, I will discuss more secure Next apps by default and raise awareness about security risks in modern web applications. One crucial resource is OWASP Top 10, a document that highlights the most critical security risks. It is recognized as the first step towards more secure coding. The list of security risks is constantly evolving, as seen on the OWASP Top 10 website.

Hi there. I always thought that handling security should be a responsibility of back-end developers or DevOps engineers. But nowadays, more and more functionality is being forwarded to the front-end. And that is why I believe that everyone should be taking care of security. And that is also why I have selected this topic for my today's presentation, which is more secure Next apps by default.

My name is Jakub and I work at Allokai as a senior developer and advocate. Apart from that, I'm also a Google developer expert in web performance. I am part of the Next team and I'm also an ambassador for Algolia, Storyblok, Cloudinary, and SuperBase. So, after this presentation, you will be a security ninja. That sounds great, right? But the reality is that it is not possible. It is not possible to transfer to you all the security knowledge that is necessary to build secure applications out of the box. So, my idea is to make you more aware of security risks and issues that can appear in modern web applications. Because I believe that if you are aware of these issues, you will be able to protect your application against them.

So, for that, I would recommend you to become familiar with the concept of OWASP and specifically OWASP Top 10. So, OWASP is a standard awareness document for both developers and web security, web application security specialists, and it represents broad consensus about the most critical security risks to web applications. And as you can see, I marked two places here. One is standard awareness document, which basically means that this OWASP Top 10 is a document. And the second one, security risks. So, it is a document that will showcase to you the most popular security risks. OWASP Top 10 is also recognized by developers as the first step towards more secure coding. This time as well, marked with green color, first step.

So, if you look at the OWASP Top 10 website, you will see basically this. And if we zoom in a bit, we will see this list of most popular security risks that can appear in your web application. And as you can see on the left side, we have 2017, and on the right side, there's 2021. And you see that the list, both the order and the elements of the list are changing. Which means that this list is evolving over and over. Like all the time.

2. Overview of Security Risks

Short description:

The list of security risks is constantly evolving, as new issues and risks emerge. OWASP's website provides a wealth of knowledge, including checklists and cheat sheets for different application types. We'll focus on a few selected risks, such as cross-site scripting and SQL injections. Broken access control can allow unauthorized access to sensitive data. DOS and DDOS attacks can overwhelm an application's server, causing it to become unresponsive. Additionally, malicious NPM packages and dependency confusion pose a significant threat to web applications.

And you see that the list, both the order and the elements of the list are changing. Which means that this list is evolving over and over. Like all the time. Because new issues or new risks are appearing and we have to make our apps more and more secure based on changing environments.

And there is also a big, very big resource of knowledge in terms of making your app more secure on OWASP's website, which is basically a list of checklists, like cheat sheets, that you can review to see if your application is secure in a certain area. So, for example, we have cheat sheet for REST applications, GraphQL applications, applications built with Ruby and so on and so on.

So, let's take a look at some of these security risks. We won't be taking a look at all of them, we'll be focusing only on a few selected ones. So, first of all, we have injections. And the two main attacks here, or risks, are cross-site scripting and SQL injections. And in terms of SQL injections, you might think that this is a very old vulnerability and it doesn't appear anymore, but you would be surprised how many production websites have this kind of vulnerability still.

In both cases, the idea is that the attacker is injecting some kind of malicious code in either SQL, so our database, or in the applications through JavaScript, for example, and then this malicious code is basically getting the data getting the shouldn't have access to, like users, passwords, stuff like that. Going further, we have broken access control. Access control means that our application will allow to get certain data if we are properly authorized.

So, for example, we are logged in, or we are part of organization, or group, that has access to certain resource. So, broken access control means that the attacker can have access to the data that basically he or she shouldn't have. And my favorite one, which is DOS, or DDOS, which means denial of service, means that our application is served on a server that can serve or handle only a certain amount of requests. So, if attacker manages to send too many requests, our application won't be able to serve the responses to these requests and basically give up.

So, we have DOS, which is denial of service, and DDOS, which is like the distributed denial of service, which is the routing is basically distributed between many different so-called zombie devices. It can be mobile phones, it can be desktop devices, and so on and so on. And I have one interesting bonus case, which is called malicious NPM packages and dependency confusion. This can happen for anyone who is building web applications nowadays.

So, how it works is basically we have a user that is supposed to fetch a package that is stored in a private registry. Like private NPM registry. It could be something else. The idea is that this registry is like a private one, and only authorized users should have access to it, should be able to fetch this package. So, what the user does instead unintentionally is to fetch the package with the same name, but from the public registry, like the public NPM. And this package can contain a malicious code. And this is a real case. And this is, unfortunately, this is in Polish.

QnA

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

A Guide to React Rendering Behavior
React Advanced Conference 2022React Advanced Conference 2022
25 min
A Guide to React Rendering Behavior
Top Content
React is a library for "rendering" UI from components, but many users find themselves confused about how React rendering actually works. What do terms like "rendering", "reconciliation", "Fibers", and "committing" actually mean? When do renders happen? How does Context affect rendering, and how do libraries like Redux cause updates? In this talk, we'll clear up the confusion and provide a solid foundation for understanding when, why, and how React renders. We'll look at: - What "rendering" actually is - How React queues renders and the standard rendering behavior - How keys and component types are used in rendering - Techniques for optimizing render performance - How context usage affects rendering behavior| - How external libraries tie into React rendering
Speeding Up Your React App With Less JavaScript
React Summit 2023React Summit 2023
32 min
Speeding Up Your React App With Less JavaScript
Top Content
Too much JavaScript is getting you down? New frameworks promising no JavaScript look interesting, but you have an existing React application to maintain. What if Qwik React is your answer for faster applications startup and better user experience? Qwik React allows you to easily turn your React application into a collection of islands, which can be SSRed and delayed hydrated, and in some instances, hydration skipped altogether. And all of this in an incremental way without a rewrite.
React Concurrency, Explained
React Summit 2023React Summit 2023
23 min
React Concurrency, Explained
Top Content
React 18! Concurrent features! You might’ve already tried the new APIs like useTransition, or you might’ve just heard of them. But do you know how React 18 achieves the performance wins it brings with itself? In this talk, let’s peek under the hood of React 18’s performance features: - How React 18 lowers the time your page stays frozen (aka TBT) - What exactly happens in the main thread when you run useTransition() - What’s the catch with the improvements (there’s no free cake!), and why Vue.js and Preact straight refused to ship anything similar
The Future of Performance Tooling
JSNation 2022JSNation 2022
21 min
The Future of Performance Tooling
Top Content
Our understanding of performance & user-experience has heavily evolved over the years. Web Developer Tooling needs to similarly evolve to make sure it is user-centric, actionable and contextual where modern experiences are concerned. In this talk, Addy will walk you through Chrome and others have been thinking about this problem and what updates they've been making to performance tools to lower the friction for building great experiences on the web.
Optimizing HTML5 Games: 10 Years of Learnings
JS GameDev Summit 2022JS GameDev Summit 2022
33 min
Optimizing HTML5 Games: 10 Years of Learnings
Top Content
The open source PlayCanvas game engine is built specifically for the browser, incorporating 10 years of learnings about optimization. In this talk, you will discover the secret sauce that enables PlayCanvas to generate games with lightning fast load times and rock solid frame rates.
It's a Jungle Out There: What's Really Going on Inside Your Node_Modules Folder
Node Congress 2022Node Congress 2022
26 min
It's a Jungle Out There: What's Really Going on Inside Your Node_Modules Folder
Top Content
Do you know what’s really going on in your node_modules folder? Software supply chain attacks have exploded over the past 12 months and they’re only accelerating in 2022 and beyond. We’ll dive into examples of recent supply chain attacks and what concrete steps you can take to protect your team from this emerging threat.
You can check the slides for Feross' talk here.

Workshops on related topic

React Performance Debugging Masterclass
React Summit 2023React Summit 2023
170 min
React Performance Debugging Masterclass
Top Content
Featured WorkshopFree
Ivan Akulov
Ivan Akulov
Ivan’s first attempts at performance debugging were chaotic. He would see a slow interaction, try a random optimization, see that it didn't help, and keep trying other optimizations until he found the right one (or gave up).
Back then, Ivan didn’t know how to use performance devtools well. He would do a recording in Chrome DevTools or React Profiler, poke around it, try clicking random things, and then close it in frustration a few minutes later. Now, Ivan knows exactly where and what to look for. And in this workshop, Ivan will teach you that too.
Here’s how this is going to work. We’ll take a slow app → debug it (using tools like Chrome DevTools, React Profiler, and why-did-you-render) → pinpoint the bottleneck → and then repeat, several times more. We won’t talk about the solutions (in 90% of the cases, it’s just the ol’ regular useMemo() or memo()). But we’ll talk about everything that comes before – and learn how to analyze any React performance problem, step by step.
(Note: This workshop is best suited for engineers who are already familiar with how useMemo() and memo() work – but want to get better at using the performance tools around React. Also, we’ll be covering interaction performance, not load speed, so you won’t hear a word about Lighthouse 🤐)
Building WebApps That Light Up the Internet with QwikCity
JSNation 2023JSNation 2023
170 min
Building WebApps That Light Up the Internet with QwikCity
Featured WorkshopFree
Miško Hevery
Miško Hevery
Building instant-on web applications at scale have been elusive. Real-world sites need tracking, analytics, and complex user interfaces and interactions. We always start with the best intentions but end up with a less-than-ideal site.
QwikCity is a new meta-framework that allows you to build large-scale applications with constant startup-up performance. We will look at how to build a QwikCity application and what makes it unique. The workshop will show you how to set up a QwikCitp project. How routing works with layout. The demo application will fetch data and present it to the user in an editable form. And finally, how one can use authentication. All of the basic parts for any large-scale applications.
Along the way, we will also look at what makes Qwik unique, and how resumability enables constant startup performance no matter the application complexity.
Next.js 13: Data Fetching Strategies
React Day Berlin 2022React Day Berlin 2022
53 min
Next.js 13: Data Fetching Strategies
Top Content
WorkshopFree
Alice De Mauro
Alice De Mauro
- Introduction- Prerequisites for the workshop- Fetching strategies: fundamentals- Fetching strategies – hands-on: fetch API, cache (static VS dynamic), revalidate, suspense (parallel data fetching)- Test your build and serve it on Vercel- Future: Server components VS Client components- Workshop easter egg (unrelated to the topic, calling out accessibility)- Wrapping up
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.
React Performance Debugging
React Advanced Conference 2023React Advanced Conference 2023
148 min
React Performance Debugging
Workshop
Ivan Akulov
Ivan Akulov
Ivan’s first attempts at performance debugging were chaotic. He would see a slow interaction, try a random optimization, see that it didn't help, and keep trying other optimizations until he found the right one (or gave up).
Back then, Ivan didn’t know how to use performance devtools well. He would do a recording in Chrome DevTools or React Profiler, poke around it, try clicking random things, and then close it in frustration a few minutes later. Now, Ivan knows exactly where and what to look for. And in this workshop, Ivan will teach you that too.
Here’s how this is going to work. We’ll take a slow app → debug it (using tools like Chrome DevTools, React Profiler, and why-did-you-render) → pinpoint the bottleneck → and then repeat, several times more. We won’t talk about the solutions (in 90% of the cases, it’s just the ol’ regular useMemo() or memo()). But we’ll talk about everything that comes before – and learn how to analyze any React performance problem, step by step.
(Note: This workshop is best suited for engineers who are already familiar with how useMemo() and memo() work – but want to get better at using the performance tools around React. Also, we’ll be covering interaction performance, not load speed, so you won’t hear a word about Lighthouse 🤐)
Master JavaScript Patterns
JSNation 2024JSNation 2024
145 min
Master JavaScript Patterns
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