Skip to content

Commit 30f8da4

Browse files
Merge pull request #114 from built-on-openfin/dev/nick/vulns
Remediate medium-severity snyk vulnerabilities
2 parents a7f38dd + 4851c9d commit 30f8da4

File tree

3 files changed

+24
-0
lines changed
  • how-to
    • use-dynamic-manifest/basic/server/src
    • use-logging
      • use-log-uploader-with-self-hosted-service
      • use-logging-custom-apis/server/src

3 files changed

+24
-0
lines changed

how-to/use-dynamic-manifest/basic/server/src/index.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
11
import express from "express";
2+
import rateLimit from "express-rate-limit";
23
import path from "path";
34

45
const app = express();
56

7+
// Disable X-Powered-By header for security
8+
app.disable("x-powered-by");
9+
10+
// Configure rate limiting to prevent DoS attacks
11+
const limiter = rateLimit({
12+
windowMs: 15 * 60 * 1000, // 15 minutes
13+
max: 100, // Limit each IP to 100 requests per windowMs
14+
message: {
15+
error: "Too many requests from this IP, please try again later."
16+
},
17+
standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers
18+
legacyHeaders: false // Disable the `X-RateLimit-*` headers
19+
});
20+
21+
// Apply rate limiting to all requests
22+
app.use(limiter);
23+
624
const mainPath = path.join(__dirname, "..", "..", "public");
725
const port = 5050;
826

how-to/use-logging/use-log-uploader-with-self-hosted-service/server.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import path from "path";
55

66
const app = express();
77

8+
// Disable X-Powered-By header for security
9+
app.disable("x-powered-by");
10+
811
app.use(express.json());
912

1013
// Serve static files from the "public" directory

how-to/use-logging/use-logging-custom-apis/server/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import multer from "multer";
33
import path from "path";
44
const app = express();
55

6+
// Disable X-Powered-By header for security
7+
app.disable("x-powered-by");
8+
69
/** COMMON SERVER CONFIGURATION */
710
const mainPath = path.join(__dirname, "..", "..", "public");
811
const commonPath = path.join(__dirname, "..", "..", "..", "common", "public");

0 commit comments

Comments
 (0)