Security, Performance & Deployment Flashcards

OWASP Top 10 for Node.js Helmet, Rate Limiting Clustering, Load Balancing CI/CD, Docker, PM2 Performance Monitoring (New Relic, Prometheus) (52 cards)

1
Q

What is the OWASP Top 10?

A

The OWASP Top 10 is a list of the most critical web application security risks, such as Injection, Broken Authentication, and Cross-Site Scripting (XSS).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is Helmet in Node.js?

A

Helmet is a middleware for Express that sets various HTTP headers to secure apps from common web vulnerabilities.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is rate limiting in Express apps?

A

Rate limiting controls the number of requests a client can make to an API within a time window to prevent abuse or DoS attacks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is clustering in Node.js?

A

Clustering is a technique that allows Node.js to spawn multiple processes (workers) to handle concurrent connections on multicore systems.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a load balancer?

A

A load balancer distributes incoming traffic across multiple servers or instances to enhance reliability and performance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is CI/CD?

A

CI/CD (Continuous Integration/Continuous Deployment) automates code testing and deployment to improve software delivery efficiency and reliability.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is Docker?

A

Docker is a platform that uses containers to run software consistently across environments by packaging code with dependencies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is PM2 in Node.js?

A

PM2 is a production-grade process manager for Node.js applications that enables monitoring, clustering, and zero-downtime restarts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is New Relic used for?

A

New Relic is an APM (Application Performance Monitoring) tool that tracks performance metrics, errors, and transactions in real time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is Prometheus used for?

A

Prometheus is an open-source monitoring system that collects metrics from applications and supports alerting and visualization.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the advantages of using Helmet?

A

Helmet is simple to use, improves default security posture, and mitigates common attacks like clickjacking and MIME sniffing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the disadvantages of rate limiting?

A

If misconfigured, it can block legitimate users or degrade user experience during traffic spikes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are best practices for Node.js security?

A

Use Helmet, validate input, sanitize data, use HTTPS, manage dependencies, and follow OWASP guidelines.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a use case for Docker in Node.js apps?

A

Running a Node.js app in the same environment across development, testing, and production systems.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the impact of load balancing on system design?

A

It requires stateless services or external session storage and affects how services scale and failover.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How does clustering improve performance?

A

It allows better CPU utilization on multicore machines, increasing throughput and responsiveness.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is a CI/CD pipeline example?

A

GitHub Actions or Jenkins running tests, building a Docker image, and deploying to a server or Kubernetes cluster.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is the architectural implication of using PM2?

A

Enables zero-downtime deployments, process monitoring, and simplified log management in production.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is a performance benefit of Docker?

A

Isolated environments reduce conflicts, and container startup is faster than virtual machines.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is a fault tolerance advantage of clustering?

A

If one worker crashes, others continue to handle requests, reducing total application downtime.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is a monitoring best practice for production apps?

A

Track metrics like response time, error rate, memory usage, and use alerting tools like New Relic or Prometheus.

22
Q

What is a real-world tradeoff with Docker?

A

It adds an extra layer of complexity and may consume more resources than native environments in some cases.

23
Q

What’s a potential gotcha with rate limiting?

A

Clients behind the same IP (e.g., proxies) may get unfairly rate-limited if IP-based logic is used.

24
Q

What’s a common interview question about OWASP?

A

Can you explain some OWASP Top 10 risks and how to prevent them in Node.js applications?

25
What’s a common interview question about clustering?
How does Node.js handle multi-core processing and how do you manage multiple processes?
26
What’s a common interview question on CI/CD?
Describe a CI/CD pipeline you’ve implemented and the tools used for testing and deployment.
27
What is the advantage of using Prometheus with Grafana?
Grafana provides visual dashboards and alerting on Prometheus metrics, improving observability.
28
What is the role of secure headers in Helmet?
Secure headers reduce risks from XSS, CSRF, clickjacking, and other browser-based attacks.
29
What is an example of a rate-limiting package in Express?
express-rate-limit is a popular middleware used to throttle incoming requests.
30
How does load balancing support fault tolerance?
If one instance fails, traffic is routed to healthy ones, ensuring uninterrupted service.
31
What’s a disadvantage of using clustering?
It doesn't share memory, so shared state must be managed via external tools like Redis.
32
What’s a CI/CD deployment risk?
A bad deploy can affect users quickly; rollbacks and automated testing are critical safeguards.
33
What’s a performance gotcha with PM2?
Misconfigured cluster mode can create bottlenecks if shared resources are not managed correctly.
34
What is a Docker image?
A Docker image is a lightweight, standalone package of software that includes everything needed to run an app.
35
What is zero-downtime deployment in PM2?
Using `pm2 reload`, the app restarts gracefully without dropping connections or causing user impact.
36
What’s an example of an OWASP issue and a fix?
Injection attacks can be mitigated by using parameterized queries with database clients like `pg` or `mongoose`.
37
What’s the benefit of infrastructure as code in CI/CD?
Automates consistent, reproducible environment setup and deployment.
38
What’s the impact of improper clustering configuration?
Can lead to race conditions or data inconsistency if state isn't shared properly.
39
What’s a common performance bottleneck in Node.js apps?
Blocking I/O operations or CPU-intensive tasks can degrade responsiveness.
40
What’s a monitoring best practice in Dockerized apps?
Expose metrics endpoints and run exporters like node_exporter for Prometheus.
41
What’s a Helm alternative for Kubernetes deployment?
Kustomize is another popular tool for managing Kubernetes manifests.
42
What’s the benefit of externalizing secrets in Docker?
Using environment variables or secret managers prevents hardcoding sensitive data into images.
43
What’s a tradeoff of using New Relic?
Provides rich metrics and insights but can add noticeable overhead or cost in large-scale apps.
44
What is a potential rate-limiting gotcha in distributed systems?
Local rate limiters won’t sync across instances; use a shared store like Redis for consistency.
45
How does CI/CD impact team productivity?
It speeds up feedback loops, reduces manual errors, and allows teams to ship faster and more reliably.
46
What’s a best practice for secure Dockerfiles?
Use minimal base images, avoid running as root, and scan for vulnerabilities with tools like Snyk.
47
How does Prometheus gather data?
It pulls metrics from targets using HTTP endpoints and stores them in a time-series database.
48
What is the purpose of Docker Compose?
Docker Compose defines and runs multi-container applications using a simple YAML configuration file.
49
How does rate limiting help with DDoS protection?
It reduces the impact of malicious traffic by blocking excessive requests from a single source.
50
How do clusters handle requests in Node.js?
Each worker listens on the same port and the OS or master process balances the load between them.
51
What is a security risk with outdated Node.js packages?
They may contain known vulnerabilities that can be exploited if not patched regularly.
52
What’s a common interview question on Docker?
How do you build, run, and debug a Node.js app using Docker and Docker Compose?