@wraps.dev/cli 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -9,11 +9,11 @@ var __export = (target, all3) => {
9
9
  __defProp(target, name, { get: all3[name], enumerable: true });
10
10
  };
11
11
 
12
- // ../../node_modules/.pnpm/tsup@8.5.0_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.8.3/node_modules/tsup/assets/esm_shims.js
12
+ // ../../node_modules/.pnpm/tsup@8.5.0_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js
13
13
  import path from "path";
14
14
  import { fileURLToPath } from "url";
15
15
  var init_esm_shims = __esm({
16
- "../../node_modules/.pnpm/tsup@8.5.0_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.8.3/node_modules/tsup/assets/esm_shims.js"() {
16
+ "../../node_modules/.pnpm/tsup@8.5.0_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js"() {
17
17
  "use strict";
18
18
  }
19
19
  });
@@ -1536,6 +1536,7 @@ import {
1536
1536
  MailManagerClient as MailManagerClient2,
1537
1537
  StartArchiveSearchCommand
1538
1538
  } from "@aws-sdk/client-mailmanager";
1539
+ import DOMPurify from "isomorphic-dompurify";
1539
1540
  import { simpleParser } from "mailparser";
1540
1541
  function extractArchiveId(archiveArnOrId) {
1541
1542
  if (archiveArnOrId.startsWith("arn:")) {
@@ -4577,6 +4578,26 @@ async function startConsoleServer(config) {
4577
4578
  const app = express();
4578
4579
  const authToken = crypto.randomBytes(32).toString("hex");
4579
4580
  app.use(express.json());
4581
+ const requestCounts = /* @__PURE__ */ new Map();
4582
+ const RATE_LIMIT_WINDOW = 60 * 1e3;
4583
+ const RATE_LIMIT_MAX_REQUESTS = 1e3;
4584
+ app.use((req, res, next) => {
4585
+ const ip = req.ip || req.socket.remoteAddress || "unknown";
4586
+ const now = Date.now();
4587
+ const record = requestCounts.get(ip);
4588
+ if (!record || now > record.resetTime) {
4589
+ requestCounts.set(ip, { count: 1, resetTime: now + RATE_LIMIT_WINDOW });
4590
+ next();
4591
+ } else if (record.count < RATE_LIMIT_MAX_REQUESTS) {
4592
+ record.count++;
4593
+ next();
4594
+ } else {
4595
+ res.status(429).json({
4596
+ error: "Too many requests, please slow down",
4597
+ retryAfter: Math.ceil((record.resetTime - now) / 1e3)
4598
+ });
4599
+ }
4600
+ });
4580
4601
  app.use((_req, res, next) => {
4581
4602
  res.setHeader("X-Frame-Options", "DENY");
4582
4603
  res.setHeader("X-Content-Type-Options", "nosniff");