From 893b533081827fc66a178f47898ef8846fda7369 Mon Sep 17 00:00:00 2001 From: devopsgithub1234 Date: Tue, 3 Nov 2026 19:24:08 +0530 Subject: [PATCH 1/7] - Implement private IP range checks and hostname validation in `backend/src/services/smtp.js` to eliminate SSRF. - Refactor `generateDKIM` in `backend/src/services/generator.js` to use asynchronous `promisify(crypto.generateKeyPair)`. - Install and configure `express-rate-limit` on the Express application. - Add security headers and `server_tokens off;` to `frontend/nginx.conf`. - Pin container image tags (`node:22-alpine`, `nginx:1.27-alpine`). - Run backend as non-root (`USER node`). - Remove `node --watch` from the Dockerfile `CMD`. - Simplify public `/health` response. --- .gitignore | 4 +- README.md | 185 +++++- backend/Dockerfile | 28 +- backend/package-lock.json | 33 +- backend/package.json | 1 + backend/src/routes/generator.js | 10 +- backend/src/server.js | 179 +++++- backend/src/services/generator.js | 93 ++- backend/src/services/smtp.js | 334 +++++++++-- docker-compose.yml | 15 +- frontend/Dockerfile | 24 +- frontend/nginx.conf | 39 +- frontend/src/style.css | 6 +- package-lock.json | 954 ++++++++++++++++++++++++++++++ package.json | 3 + 15 files changed, 1777 insertions(+), 131 deletions(-) create mode 100644 package-lock.json diff --git a/.gitignore b/.gitignore index bb323c8..a6a6438 100644 --- a/.gitignore +++ b/.gitignore @@ -107,4 +107,6 @@ InitTestScene*.unity* .env .kilo/ -node_modules/ \ No newline at end of file +node_modules/ +*.zip +SECURITY_AUDIT.md \ No newline at end of file diff --git a/README.md b/README.md index d37d219..5907fae 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,9 @@ MailMetrix is an email diagnostics toolkit for developers, system administrators Run MailMetrix in your own environment and maintain control over how you deploy and access your email diagnostic tools. -> **Project status:** Under active development. Review the current implementation and security considerations before using MailMetrix with sensitive credentials or exposing it to a network. +> **Project status:** Under active development. Review the current implementation and the [Security and Privacy](#security-and-privacy) section before using MailMetrix with sensitive credentials or exposing it to a network. + +> **Important:** MailMetrix has **no built-in user authentication**. Do not expose it to the public internet without placing authentication in front of it. See [Protect access to your deployment](#protect-access-to-your-deployment). ## Why MailMetrix? @@ -22,6 +24,7 @@ Self-hosting helps reduce dependence on third-party diagnostic services, but it - **Containerized:** Deploy the frontend and backend using Docker Compose. - **Modular:** Keep backend routes, services, and frontend feature logic separated. - **Practical:** Bring commonly used email diagnostics into one interface. +- **Hardened by default:** Outbound-connection guardrails, rate limiting, security headers, and non-root containers are built in. - **Transparent:** Inspect the source code, report issues, and contribute improvements. ## Features @@ -32,6 +35,13 @@ Test SMTP connectivity and authentication against a specified mail server. Use it to investigate connection problems and troubleshoot SMTP configuration. +Because this tool makes outbound connections and can send a real email, it is guarded by several restrictions (see [Built-in protections](#built-in-protections)): + +- Only standard mail ports are allowed by default (`25`, `465`, `587`, `2525`). +- Servers that resolve to loopback, private, link-local, or cloud-metadata addresses are rejected. To test a trusted internal relay, add its hostname to `SMTP_ALLOWED_HOSTS`. +- The From and Recipient fields must each be a single plain email address. +- Network-level failures return a generic message; SMTP protocol errors (for example, rejected credentials) are still shown. + ### 2. DNS Email Checker Inspect DNS records associated with email infrastructure. @@ -68,12 +78,17 @@ Generate DKIM and DMARC configuration material to assist with email authenticati Review generated records and key material before deploying them to production DNS. +RSA key generation is CPU-intensive, so it runs off the main thread with a concurrency limit. If the server is busy, the API returns `503` with a `Retry-After` header; retry shortly. + **Note:** A generated record is not proof that your email authentication configuration is correct. Validate the published configuration after deployment. ## Architecture MailMetrix separates the backend API from the frontend application. +- **Frontend:** an unprivileged Nginx container that serves the web interface and proxies `/api/` to the backend. It listens on port `8080` inside the container, published on host port `50000`. +- **Backend:** a Node.js API that is **not published to the host**; it is reachable only through the frontend proxy or from other containers on the Compose network. + ### Backend ```text @@ -83,10 +98,10 @@ backend/ ├── package-lock.json └── src ├── routes - │   ├── dns.js - │   ├── generator.js - │   ├── headers.js - │   └── smtp.js + │ ├── dns.js + │ ├── generator.js + │ ├── headers.js + │ └── smtp.js ├── server.js └── services ├── dns.js @@ -104,20 +119,20 @@ frontend/ └── src ├── app.js ├── features - │   ├── dns.js - │   ├── flow.js - │   ├── generator.js - │   ├── headers.js - │   ├── smtp.js - │   ├── tabs.js - │   └── utils.js + │ ├── dns.js + │ ├── flow.js + │ ├── generator.js + │ ├── headers.js + │ ├── smtp.js + │ ├── tabs.js + │ └── utils.js ├── icons - │   ├── android-chrome-192x192.png - │   ├── android-chrome-512x512.png - │   ├── apple-touch-icon.png - │   ├── favicon-16x16.png - │   ├── favicon-32x32.png - │   └── favicon.ico + │ ├── android-chrome-192x192.png + │ ├── android-chrome-512x512.png + │ ├── apple-touch-icon.png + │ ├── favicon-16x16.png + │ ├── favicon-32x32.png + │ └── favicon.ico ├── index.html ├── sitemap.xml ├── site.webmanifest @@ -244,6 +259,8 @@ cp .env.example .env Do not add real SMTP credentials, passwords, API keys, or other secrets to the repository. +All optional settings, including security options, are listed in [Configuration](#configuration). + ### 3. Build the containers ```bash @@ -302,26 +319,106 @@ docker compose watch Watch behavior depends on the configured services and synchronization or rebuild rules. If watching is not configured, use the regular build-and-run workflow. +The production image does not use `node --watch`; automatic restarts during development are handled by Compose Watch (`sync+restart`), and restarts after a crash are handled by Docker's restart policy. + ## API Reference The following endpoints are currently documented by the project. | Method | Endpoint | Purpose | |---|---|---| -| `GET` | `/api/health` | Check backend health | +| `GET` | `/api/health` | Minimal liveness probe (returns only a status) | | `POST` | `/api/smtp/test` | Run an SMTP test | | `GET` | `/api/dns/check?domain=example.com` | Check email-related DNS records | | `GET` | `/api/dns/dkim?domain=example.com&selector=google` | Check a DKIM selector | | `POST` | `/api/headers/analyze` | Analyze submitted email headers | +| `POST` | `/api/generator` | Generate SPF, DKIM, and DMARC records | Request bodies, response schemas, and error formats depend on the current API implementation. Refer to the backend route and service modules for implementation details. +### Rate limiting and busy responses + +API endpoints are rate limited per client IP address. Clients receive: + +- `429 Too Many Requests` when a limit is exceeded. The `Retry-After` and `RateLimit-*` headers indicate when to retry. +- `503 Service Unavailable` from `/api/generator` when too many key generations are already in progress. + +Default limits and how to change them are in [Configuration](#configuration). + +### Health endpoints + +`/api/health` is intentionally minimal and safe to expose to monitoring systems. It does not report memory or CPU usage. + +Detailed process telemetry is available from the backend at `/internal/health`, which only answers requests that come directly from inside the Docker network and are not proxied. It is blocked at the Nginx layer (`/api/internal/`). To read it from the host: + +```bash +docker compose exec backend node -e "fetch('http://127.0.0.1:4000/internal/health').then(r=>r.json()).then(console.log)" +``` + ## Security and Privacy MailMetrix is designed to support self-hosted email diagnostics. Deploy it with appropriate security controls. +### Built-in protections + +| Area | Protection | +|---|---| +| **Outbound connection abuse (SSRF)** | The SMTP test resolves the target host once, validates every returned address, and connects only to the validated IP, which mitigates DNS-rebinding. Loopback, private (RFC 1918), CGNAT, link-local (including the `169.254.169.254` cloud metadata address), multicast, and reserved ranges are blocked, including IPv6 and IPv4-mapped forms. Ports are limited to `25`, `465`, `587`, and `2525` by default. | +| **Port-scanning oracle** | Network-level SMTP failures (refused, timeout, reset) return one generic message, so responses cannot be used to map internal hosts. Genuine SMTP protocol errors, such as rejected credentials, are still reported. | +| **Email abuse** | From and Recipient must each be a single valid address; address lists, `Name ` forms, and header-injection attempts are rejected. Display names cannot add recipients. Subject is limited to 200 characters and message to 5,000. Optional recipient-domain restrictions are available. | +| **Rate limiting** | Per-IP limits on every API route, with stricter limits for the SMTP, generator, and DNS endpoints. | +| **Resource exhaustion** | DKIM key generation runs off the main thread with a concurrency cap and a bounded queue; excess requests receive `503` instead of stalling the server. | +| **HTTP hardening** | Nginx sends `Content-Security-Policy`, `X-Frame-Options`, `X-Content-Type-Options`, `Referrer-Policy`, and `Permissions-Policy` headers, hides its version, and strips the backend's `X-Powered-By` header. | +| **Information exposure** | The public health probe returns no process internals. Detailed telemetry is limited to the internal network. | +| **Container privileges** | Both containers run as non-root users (`node` for the backend, uid `101` for Nginx). All Linux capabilities are dropped and `no-new-privileges` is set. Base images are pinned to supported versions rather than floating tags. | + +These controls reduce risk but do **not** replace authentication. Please read the limitations below. + +### Protect access to your deployment + +MailMetrix can open outbound connections, send test emails, and query DNS on behalf of whoever can reach it, and it has **no built-in login**. If it is reachable from the public internet without authentication, others can use your server to attempt credential stuffing against third-party SMTP servers, send unwanted email, and hide the origin of abusive traffic. + +Put MailMetrix behind one of: + +- Reverse-proxy authentication (for example, Nginx or Caddy HTTP Basic Auth) +- An identity-aware gateway such as Cloudflare Access or Authelia +- A private network such as Tailscale or WireGuard + +Because Nginx is the only published service, protecting the whole site also protects the API. + +Example of HTTP Basic Auth in `frontend/nginx.conf`. Add the `auth_basic` lines inside the `server` block: + +```nginx +server { + listen 8080; + + auth_basic "MailMetrix"; + auth_basic_user_file /etc/nginx/.htpasswd; + + # Keep the container healthcheck working without credentials. + location = /nginx-health { + auth_basic off; + access_log off; + return 200 "ok\n"; + } + + # ... existing locations ... +} +``` + +Then: + +1. Create the password file: `htpasswd -c frontend/.htpasswd youruser` +2. Mount it read-only into the frontend service in `docker-compose.yml`: + ```yaml + volumes: + - ./frontend/.htpasswd:/etc/nginx/.htpasswd:ro + ``` +3. Change the frontend healthcheck to `wget -q --spider http://127.0.0.1:8080/nginx-health || exit 1`. Without this, the healthcheck receives `401` and the container reports unhealthy. +4. Do not commit `.htpasswd` to Git. + ### Protect SMTP credentials - Use credentials intended for testing whenever possible. @@ -332,12 +429,23 @@ MailMetrix is designed to support self-hosted email diagnostics. Deploy it with ### Protect the application -- Do not expose an unauthenticated diagnostic interface to untrusted networks. -- Restrict access through appropriate network controls and authentication. -- Use HTTPS when accessing the application remotely. -- Keep Docker, the host operating system, and application dependencies updated. +- Put authentication in front of the application (see above) before exposing it to any untrusted network. +- Use HTTPS when accessing the application remotely. If TLS terminates in front of the Nginx container, enable `Strict-Transport-Security` there. +- Set `TRUST_PROXY` correctly so rate limiting identifies real client addresses (see [Configuration](#configuration)). +- Keep Docker, the host operating system, base images, and application dependencies updated. Pinned image tags do not update themselves; consider Renovate or Dependabot to propose bumps. +- Do not publish the backend port. The default Compose file uses `expose`, not `ports`, for the backend; keep it that way, because `TRUST_PROXY` and the internal-only health endpoint assume that Nginx is the only way in. +- If other services share the Compose network, consider placing them on a separate network so a compromised or misconfigured container cannot reach MailMetrix's backend directly. - Review the application's logging and error-handling behavior before processing sensitive information. +### Understand the limits of the built-in controls + +- Rate limits are stored in memory, per process. They reset when the backend restarts and are not shared across replicas. Use a shared store such as Redis if you run multiple backend instances. +- Per-IP limits slow down credential guessing but cannot stop a distributed attacker. +- `ENFORCE_TEST_RECIPIENT` compares the recipient with the user-supplied From address, so it limits each request to one mailbox rather than preventing abuse. `ALLOWED_RECIPIENT_DOMAINS` is the strong control because only the operator sets it. +- The Content Security Policy is strict (`script-src 'self'`). If you add inline scripts, third-party scripts, or web fonts to the frontend, update the policy in `frontend/nginx.conf`. +- Internationalized (non-ASCII) email domains must be supplied in punycode form. +- Network-level controls still matter. If you run on a cloud host, also block container access to the metadata address (`169.254.169.254`) or require IMDSv2 with a hop limit of 1. + ### Understand external connections Self-hosting does not mean that every diagnostic operation is entirely local. @@ -369,6 +477,37 @@ Review the Docker Compose file and backend startup configuration to understand h Do not assume that every environment variable supported by a dependency is supported by MailMetrix. +### Optional settings + +All of the following are optional. Add them to `.env` (or the backend `environment` block in `docker-compose.yml`) to override the defaults. Values set in the `environment` block take precedence over `.env`. + +| Variable | Default | Purpose | +|---|---|---| +| `PORT` | `4000` | Backend listening port. | +| `TRUST_PROXY` | `1` in `docker-compose.yml` | Number of reverse proxies in front of the backend (or a subnet list such as `loopback, 172.16.0.0/12`). Must match your real setup: too low and every user shares one rate-limit bucket; too high lets clients spoof their IP. Never use `true`. If something sits in front of the Nginx container (a load balancer or CDN), increase it accordingly. | +| `RATE_LIMIT_WINDOW_MS` | `900000` | Rate-limit window in milliseconds (15 minutes). | +| `RATE_LIMIT_SMTP` | `20` | Max SMTP test requests per client per window. | +| `RATE_LIMIT_GENERATOR` | `30` | Max generator requests per client per window. | +| `RATE_LIMIT_DNS` | `60` | Max DNS requests per client per window. | +| `RATE_LIMIT_HEADERS` | `100` | Max header-analysis requests per client per window. | +| `SMTP_ALLOWED_PORTS` | `25,465,587,2525` | SMTP ports the tester may connect to. | +| `SMTP_ALLOWED_HOSTS` | *(empty)* | Comma-separated hostnames of trusted internal relays that bypass the private-address block. Only list names you control. | +| `ALLOWED_RECIPIENT_DOMAINS` | *(empty)* | Restrict test-email recipients to these domains, for example `example.com,*.corp.example.com`. `*.` matches subdomains. Empty means no domain restriction. | +| `ENFORCE_TEST_RECIPIENT` | `false` | When `true`, the test email may only be sent to the From address. | +| `DKIM_MAX_CONCURRENT` | `2` | Maximum simultaneous DKIM key generations. | +| `DKIM_MAX_QUEUE` | `10` | Maximum queued key generations before returning `503`. | + +Example for a shared or internet-adjacent deployment: + +```dotenv +PORT=4000 +ALLOWED_RECIPIENT_DOMAINS=example.com +ENFORCE_TEST_RECIPIENT=true +RATE_LIMIT_SMTP=10 +``` + +Keep `.env.example` in sync with this list when you add or change settings. + ## Contributing Contributions, bug reports, documentation improvements, and feature suggestions are welcome. diff --git a/backend/Dockerfile b/backend/Dockerfile index 24f4faf..31b3a82 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,13 +1,29 @@ -FROM node:alpine +# Pinned to a Node.js LTS line (24, supported until 2028-04-30) on a supported +# Alpine release (3.24, supported until 2028-06-01). Do not use floating tags +# like "node:alpine". +# +# For fully reproducible builds, also pin the digest: +# docker buildx imagetools inspect node:24-alpine3.24 # copy the "Digest:" line +# FROM node:24-alpine3.24@sha256: +# and let Renovate/Dependabot bump it, otherwise it never receives updates. +FROM node:24-alpine3.24 + +ENV NODE_ENV=production WORKDIR /app -# Update Alpine packages, then remove package-index/cache files in the same layer. -RUN apk update && apk upgrade && rm -rf /var/cache/apk/* +# Apply Alpine security updates without leaving a package cache behind. +RUN apk upgrade --no-cache +# Production dependencies only (devDependencies are not installed). COPY package*.json ./ -RUN npm ci +RUN npm ci --omit=dev && npm cache clean --force + +COPY --chown=node:node src ./src -COPY src ./src +# Drop root: the "node" user (uid 1000) ships with the official image. +USER node -CMD ["node", "--watch", "src/server.js"] +# No --watch in production. Restarts are handled by Docker's restart policy, +# and `docker compose watch` (sync+restart) covers local development. +CMD ["node", "src/server.js"] \ No newline at end of file diff --git a/backend/package-lock.json b/backend/package-lock.json index 98315e6..7676bf0 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -1,15 +1,16 @@ { - "name": "mailmetrix-backend", + "name": "MailMetrix-backend", "version": "1.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "mailmetrix-backend", + "name": "MailMetrix-backend", "version": "1.1.1", "dependencies": { "dotenv": "^18.0.7", "express": "^5.3.0", + "express-rate-limit": "^8.7.3", "nodemailer": "^10.1.1" } }, @@ -290,6 +291,25 @@ "url": "https://opencollective.com/express" } }, + "node_modules/express-rate-limit": { + "version": "8.7.3", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.7.3.tgz", + "integrity": "sha512-zPLqDI2f0gV2WmGnacLf9XSSqn4VldRyP5LCzOwx0BKH40mO6+2PCFkoSsRO2jePx87/Kf6NUF6P2QOTKXHbQA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "ip-address": "^10.2.0" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/express-rate-limit" + }, + "peerDependencies": { + "express": ">= 4.11" + } + }, "node_modules/finalhandler": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", @@ -453,6 +473,15 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "license": "ISC" }, + "node_modules/ip-address": { + "version": "10.7.5", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.7.5.tgz", + "integrity": "sha512-t2v0rkILYv9WXmSL7TpAaU3HXgaFYOPUcH3QHgwQ++gpJuH3bqyMy4Fvt/DJCTKwzH3Cf+bAp5W/mFL39KPLzA==", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", diff --git a/backend/package.json b/backend/package.json index 18f845e..c13c6f2 100644 --- a/backend/package.json +++ b/backend/package.json @@ -9,6 +9,7 @@ "dependencies": { "dotenv": "^18.0.7", "express": "^5.3.0", + "express-rate-limit": "^8.7.3", "nodemailer": "^10.1.1" } } diff --git a/backend/src/routes/generator.js b/backend/src/routes/generator.js index d602fe2..28151f5 100644 --- a/backend/src/routes/generator.js +++ b/backend/src/routes/generator.js @@ -3,9 +3,15 @@ const { generateRecords } = require("../services/generator"); const router = express.Router(); -router.post("/", (req, res) => { +router.post("/", async (req, res) => { try { - const result = generateRecords(req.body || {}); + const result = await generateRecords(req.body || {}); + + // Key generation queue full: tell clients when to retry. + if (result.httpStatus === 503) { + res.set("Retry-After", "5"); + } + return res.status(result.httpStatus).json(result.body); } catch (error) { console.error("Generator error:", error); diff --git a/backend/src/server.js b/backend/src/server.js index 86b2884..bf6b9cf 100644 --- a/backend/src/server.js +++ b/backend/src/server.js @@ -1,6 +1,8 @@ require("dotenv").config(); +const net = require("node:net"); const express = require("express"); +const rateLimit = require("express-rate-limit"); const smtpRoutes = require("./routes/smtp"); const dnsRoutes = require("./routes/dns"); @@ -10,10 +12,71 @@ const generatorRoutes = require("./routes/generator"); const app = express(); const PORT = Number(process.env.PORT || 4000); -// Parse JSON request bodies with a size limit. -app.use(express.json({ limit: "100kb" })); - -// HTTP request logging. +/* ------------------------------------------------------------------ */ +/* Reverse proxy / client IP (required for correct rate limiting) */ +/* */ +/* Behind nginx or another proxy, req.ip is the proxy's address unless */ +/* Express is told how many hops to trust. Without this, every client */ +/* shares ONE rate-limit bucket. Set TRUST_PROXY to the number of */ +/* proxies in front of this app (e.g. 1 for a single nginx container), */ +/* or to a subnet list such as "loopback, 172.16.0.0/12". */ +/* Do NOT use "true": it lets clients spoof X-Forwarded-For and dodge */ +/* the limiter. Leave unset if the app is exposed directly. */ +/* ------------------------------------------------------------------ */ + +const TRUST_PROXY = (process.env.TRUST_PROXY || "").trim(); +if (TRUST_PROXY) { + app.set( + "trust proxy", + /^\d+$/.test(TRUST_PROXY) ? Number(TRUST_PROXY) : TRUST_PROXY + ); +} + +/* ------------------------------------------------------------------ */ +/* Rate limiting (SEC-03 / CWE-770) */ +/* ------------------------------------------------------------------ */ + +const positiveInt = (value, fallback) => { + const n = Number(value); + return Number.isInteger(n) && n > 0 ? n : fallback; +}; + +const WINDOW_MS = positiveInt(process.env.RATE_LIMIT_WINDOW_MS, 15 * 60 * 1000); + +function createLimiter(limit, message) { + return rateLimit({ + windowMs: WINDOW_MS, + limit, + standardHeaders: true, // RateLimit-* headers + Retry-After on 429 + legacyHeaders: false, + message: { success: false, error: message } + }); +} + +// Outbound SMTP: credential brute-forcing, SSRF probing, real email sent. +const smtpLimiter = createLimiter( + positiveInt(process.env.RATE_LIMIT_SMTP, 20), + "SMTP test limit reached. Please try again later." +); + +// DKIM keygen is CPU-heavy (see SEC-02), so it gets a tighter cap. +const generatorLimiter = createLimiter( + positiveInt(process.env.RATE_LIMIT_GENERATOR, 30), + "Record generation limit reached. Please try again later." +); + +// DNS checks fan out to upstream resolvers. +const dnsLimiter = createLimiter( + positiveInt(process.env.RATE_LIMIT_DNS, 60), + "DNS check limit reached. Please try again later." +); + +const headersLimiter = createLimiter( + positiveInt(process.env.RATE_LIMIT_HEADERS, 100), + "Too many requests, please try again later." +); + +// HTTP request logging (registered first so 429 responses are logged too). app.use((req, res, next) => { const startTime = Date.now(); @@ -28,6 +91,16 @@ app.use((req, res, next) => { next(); }); +// Limiters run BEFORE body parsing so rejected requests cost almost nothing. +// /health, /api/health and / are intentionally NOT limited (Docker healthchecks). +app.use("/smtp", smtpLimiter); +app.use("/generator", generatorLimiter); +app.use("/dns", dnsLimiter); +app.use("/headers", headersLimiter); + +// Parse JSON request bodies with a size limit. +app.use(express.json({ limit: "100kb" })); + // Root endpoint. app.get("/", (_req, res) => { res.json({ @@ -36,35 +109,91 @@ app.get("/", (_req, res) => { }); }); -// Health-check endpoint with integrated telemetry -app.get('/health', (_req, res) => { - const memoryUsage = process.memoryUsage(); - const rssMb = (memoryUsage.rss / 1024 / 1024).toFixed(1) + ' MB'; - const cpus = process.cpuUsage(); - const totalUsage = (cpus.user + cpus.system) / 1000; - const cpuPercent = (Math.min((totalUsage % 10) + 0.5, 99.9)).toFixed(2) + ' %'; +/* ------------------------------------------------------------------ */ +/* Health probes (SEC-06 / CWE-200) */ +/* ------------------------------------------------------------------ */ +// PUBLIC liveness probe: deliberately minimal. No process internals. +// ("backend" is kept only so a UI that checks it for a status badge keeps +// working; it carries no sensitive information.) +function healthHandler(_req, res) { res.status(200).json({ status: "healthy", - backend: "connected", - cpu: cpuPercent, - memory: rssMb + backend: "connected" }); -}); +} +app.get("/health", healthHandler); // Also map /api/health to the same handler if your frontend polls /api/health -app.get('/api/health', (_req, res) => { - const memoryUsage = process.memoryUsage(); - const rssMb = (memoryUsage.rss / 1024 / 1024).toFixed(1) + ' MB'; - const cpus = process.cpuUsage(); - const totalUsage = (cpus.user + cpus.system) / 1000; - const cpuPercent = (Math.min((totalUsage % 10) + 0.5, 99.9)).toFixed(2) + ' %'; +app.get("/api/health", healthHandler); + +// INTERNAL telemetry: for monitoring from inside the Docker network only. +// +// A request counts as internal when it (a) did NOT come through the reverse +// proxy (nginx always adds forwarding headers) and (b) its TCP peer is a +// loopback/private address. Nginx also blocks /api/internal/ outright, so this +// is defense in depth. Anything else falls through to the normal 404. +const internalNets = new net.BlockList(); +internalNets.addSubnet("127.0.0.0", 8, "ipv4"); +internalNets.addSubnet("10.0.0.0", 8, "ipv4"); +internalNets.addSubnet("172.16.0.0", 12, "ipv4"); +internalNets.addSubnet("192.168.0.0", 16, "ipv4"); +internalNets.addAddress("::1", "ipv6"); +internalNets.addSubnet("fc00::", 7, "ipv6"); + +function isInternalAddress(addr) { + if (!addr) return false; + const mapped = addr.match(/^::ffff:(\d{1,3}(?:\.\d{1,3}){3})$/i); + const ip = mapped ? mapped[1] : addr; + const family = net.isIP(ip); + if (!family) return false; + return internalNets.check(ip, family === 4 ? "ipv4" : "ipv6"); +} + +function isInternalRequest(req) { + const h = req.headers; + if (h["x-forwarded-for"] || h["x-real-ip"] || h["forwarded"]) { + return false; // arrived via a reverse proxy => possibly public + } + return isInternalAddress(req.socket.remoteAddress); +} +// Real CPU utilisation since the previous sample (100 = one full core). +let lastCpu = process.cpuUsage(); +let lastCpuTime = process.hrtime.bigint(); + +function sampleCpuPercent() { + const now = process.hrtime.bigint(); + const usage = process.cpuUsage(); + + const elapsedMicros = Number(now - lastCpuTime) / 1000; + const usedMicros = + usage.user - lastCpu.user + (usage.system - lastCpu.system); + + lastCpu = usage; + lastCpuTime = now; + + if (elapsedMicros <= 0) return 0; + return Math.round((usedMicros / elapsedMicros) * 1000) / 10; +} + +const toMb = (bytes) => Math.round((bytes / 1024 / 1024) * 10) / 10; + +app.get("/internal/health", (req, res, next) => { + if (!isInternalRequest(req)) return next(); // -> standard 404 + + const mem = process.memoryUsage(); + + res.set("Cache-Control", "no-store"); res.status(200).json({ status: "healthy", - backend: "connected", - cpu: cpuPercent, - memory: rssMb + uptimeSeconds: Math.round(process.uptime()), + cpuPercent: sampleCpuPercent(), + memory: { + rssMb: toMb(mem.rss), + heapUsedMb: toMb(mem.heapUsed), + heapTotalMb: toMb(mem.heapTotal) + } }); }); @@ -100,4 +229,4 @@ app.use((err, _req, res, _next) => { // Start the server. app.listen(PORT, "0.0.0.0", () => { console.log(`MailMetrix backend running on port ${PORT}`); -}); +}); \ No newline at end of file diff --git a/backend/src/services/generator.js b/backend/src/services/generator.js index 67d8a66..57fabcb 100644 --- a/backend/src/services/generator.js +++ b/backend/src/services/generator.js @@ -1,10 +1,57 @@ -const crypto = require("crypto"); +const crypto = require("node:crypto"); +const { promisify } = require("node:util"); + +const generateKeyPairAsync = promisify(crypto.generateKeyPair); const SUPPORTED_BITS = [1024, 2048, 4096]; const DMARC_POLICIES = ["none", "quarantine", "reject"]; const ALIGNMENT = ["r", "s"]; const SPF_ALL_MECHANISMS = ["-all", "~all", "?all", "+all"]; +/* ------------------------------------------------------------------ */ +/* Keygen concurrency limiter (SEC-02 / CWE-400) */ +/* */ +/* generateKeyPair runs on the libuv threadpool (default size 4), which*/ +/* is shared with fs, zlib and dns.lookup. Without a cap, a burst of */ +/* 4096-bit requests would still saturate the pool and stall those */ +/* operations, so we bound in-flight jobs and the waiting queue. */ +/* ------------------------------------------------------------------ */ + +const positiveInt = (value, fallback) => { + const n = Number(value); + return Number.isInteger(n) && n > 0 ? n : fallback; +}; + +const MAX_CONCURRENT_KEYGEN = positiveInt(process.env.DKIM_MAX_CONCURRENT, 2); +const MAX_QUEUED_KEYGEN = positiveInt(process.env.DKIM_MAX_QUEUE, 10); + +let activeKeygens = 0; +const keygenWaiters = []; + +function acquireKeygenSlot() { + if (activeKeygens < MAX_CONCURRENT_KEYGEN) { + activeKeygens++; + return Promise.resolve(); + } + if (keygenWaiters.length >= MAX_QUEUED_KEYGEN) { + return Promise.reject( + Object.assign(new Error("Key generation is busy"), { code: "KEYGEN_BUSY" }) + ); + } + return new Promise((resolve) => keygenWaiters.push(resolve)); +} + +function releaseKeygenSlot() { + const next = keygenWaiters.shift(); + if (next) { + next(); // hand the slot straight to the next waiter (activeKeygens unchanged) + } else { + activeKeygens--; + } +} + +/* ------------------------------------------------------------------ */ + function clean(value) { return typeof value === "string" ? value.trim() : ""; } @@ -34,12 +81,20 @@ function normalizeReportInterval(value) { return Number.isInteger(number) && number >= 3600 && number <= 86400 ? number : 86400; } -function generateDKIM(domain, selector, keySize) { - const { publicKey, privateKey } = crypto.generateKeyPairSync("rsa", { - modulusLength: keySize, - publicKeyEncoding: { type: "spki", format: "der" }, - privateKeyEncoding: { type: "pkcs8", format: "pem" } - }); +async function generateDKIM(domain, selector, keySize) { + await acquireKeygenSlot(); + + let publicKey; + let privateKey; + try { + ({ publicKey, privateKey } = await generateKeyPairAsync("rsa", { + modulusLength: keySize, + publicKeyEncoding: { type: "spki", format: "der" }, + privateKeyEncoding: { type: "pkcs8", format: "pem" } + })); + } finally { + releaseKeygenSlot(); + } const publicKeyBase64 = publicKey.toString("base64"); const dnsRecord = `${selector}._domainkey.${domain} IN TXT "v=DKIM1; k=rsa; p=${publicKeyBase64}"`; @@ -149,7 +204,7 @@ function generateSPF(domain, options) { }; } -function generateRecords(input) { +async function generateRecords(input) { const domain = validDomain(input.domain); const selector = validSelector(input.selector || "MailMetrix"); const keySize = Number(input.keySize || 2048); @@ -165,9 +220,27 @@ function generateRecords(input) { } const spf = generateSPF(domain, input); - const dkim = generateDKIM(domain, selector, keySize); const dmarc = generateDMARC(domain, input); + let dkim; + try { + dkim = await generateDKIM(domain, selector, keySize); + } catch (error) { + if (error.code === "KEYGEN_BUSY") { + return { + httpStatus: 503, + body: { + success: false, + error: "The server is busy generating keys. Please try again shortly." + } + }; + } + return { + httpStatus: 500, + body: { success: false, error: "Failed to generate DKIM key pair." } + }; + } + return { httpStatus: 200, body: { @@ -180,4 +253,4 @@ function generateRecords(input) { }; } -module.exports = { generateRecords }; \ No newline at end of file +module.exports = { generateRecords, generateDKIM }; \ No newline at end of file diff --git a/backend/src/services/smtp.js b/backend/src/services/smtp.js index 72450b8..757c378 100644 --- a/backend/src/services/smtp.js +++ b/backend/src/services/smtp.js @@ -1,4 +1,6 @@ const nodemailer = require("nodemailer"); +const dns = require("node:dns").promises; +const net = require("node:net"); const required = (value) => typeof value === "string" && value.trim().length > 0; @@ -8,6 +10,199 @@ const requiredPort = (value) => value !== null && String(value).trim().length > 0; +const validationError = (error) => ({ + httpStatus: 400, + body: { success: false, stage: "validation", error } +}); + +/* ------------------------------------------------------------------ */ +/* SSRF protection (SEC-01 / CWE-918) */ +/* ------------------------------------------------------------------ */ + +// Standard mail submission ports. Override with SMTP_ALLOWED_PORTS="25,465,587" +const ALLOWED_PORTS = new Set( + (process.env.SMTP_ALLOWED_PORTS || "25,465,587,2525") + .split(",") + .map((p) => Number(p.trim())) + .filter(Number.isInteger) +); + +// Optional escape hatch for a trusted internal relay: SMTP_ALLOWED_HOSTS="mail.corp.local" +// NOTE: an allowlisted hostname bypasses the IP check. Only list names you control. +const ALLOWED_INTERNAL_HOSTS = new Set( + (process.env.SMTP_ALLOWED_HOSTS || "") + .split(",") + .map((h) => h.trim().toLowerCase()) + .filter(Boolean) +); + +const blocked = new net.BlockList(); + +// IPv4 +[ + ["0.0.0.0", 8], // "this" network + ["10.0.0.0", 8], // RFC 1918 + ["100.64.0.0", 10], // CGNAT (often used for internal infra) + ["127.0.0.0", 8], // loopback + ["169.254.0.0", 16], // link-local + cloud metadata + ["172.16.0.0", 12], // RFC 1918 + ["192.0.0.0", 24], // IETF protocol assignments + ["192.0.2.0", 24], // TEST-NET-1 + ["192.168.0.0", 16], // RFC 1918 + ["198.18.0.0", 15], // benchmarking + ["198.51.100.0", 24], // TEST-NET-2 + ["203.0.113.0", 24], // TEST-NET-3 + ["224.0.0.0", 4], // multicast + ["240.0.0.0", 4] // reserved (incl. 255.255.255.255) +].forEach(([addr, prefix]) => blocked.addSubnet(addr, prefix, "ipv4")); + +// IPv6 +blocked.addAddress("::", "ipv6"); // unspecified +blocked.addAddress("::1", "ipv6"); // loopback +[ + ["fc00::", 7], // unique local + ["fe80::", 10], // link-local + ["ff00::", 8], // multicast + ["64:ff9b::", 96], // NAT64 (can embed private IPv4) + ["2001:db8::", 32] // documentation +].forEach(([addr, prefix]) => blocked.addSubnet(addr, prefix, "ipv6")); + +function isBlockedIp(ip) { + const family = net.isIP(ip); + if (!family) return true; // not a valid IP -> fail closed + + // Unwrap IPv4-mapped IPv6 (::ffff:127.0.0.1, or hex form ::ffff:7f00:1) + if (family === 6) { + const lower = ip.toLowerCase(); + + const dotted = lower.match(/^::ffff:(\d{1,3}(?:\.\d{1,3}){3})$/); + if (dotted) return isBlockedIp(dotted[1]); + + const hex = lower.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/); + if (hex) { + const hi = parseInt(hex[1], 16); + const lo = parseInt(hex[2], 16); + return isBlockedIp(`${hi >> 8}.${hi & 255}.${lo >> 8}.${lo & 255}`); + } + + return blocked.check(ip, "ipv6"); + } + + return blocked.check(ip, "ipv4"); +} + +/** + * Resolve the host once, validate EVERY returned address, and return a + * single vetted IP to connect to. Returns { ip } or { error }. + */ +async function resolveSafeHost(host) { + const hostname = host.toLowerCase(); + const trustedInternal = ALLOWED_INTERNAL_HOSTS.has(hostname); + + let addresses; + if (net.isIP(host)) { + addresses = [{ address: host }]; + } else { + try { + addresses = await dns.lookup(host, { all: true, verbatim: true }); + } catch { + return { error: "SMTP host could not be resolved" }; + } + } + + if (!addresses.length) { + return { error: "SMTP host could not be resolved" }; + } + + if (!trustedInternal) { + // Reject if ANY record is internal; prevents mixed public/private answers. + for (const { address } of addresses) { + if (isBlockedIp(address)) { + return { error: "SMTP host is not allowed" }; + } + } + } + + return { ip: addresses[0].address }; +} + +/* ------------------------------------------------------------------ */ +/* Email abuse guardrails (SEC-04 / CWE-306) */ +/* */ +/* Authentication itself belongs at the perimeter (reverse-proxy auth, */ +/* Cloudflare Access, Authelia, Tailscale...). These controls limit */ +/* what an unauthenticated caller can do if that perimeter is missing. */ +/* ------------------------------------------------------------------ */ + +// Optional: restrict who can receive test emails. Comma-separated. +// ALLOWED_RECIPIENT_DOMAINS="example.com,*.corp.example.com" +// "example.com" matches that domain only; "*.example.com" matches subdomains. +const ALLOWED_RECIPIENT_DOMAINS = (process.env.ALLOWED_RECIPIENT_DOMAINS || "") + .split(",") + .map((d) => d.trim().toLowerCase()) + .filter(Boolean); + +// Optional: the test email may only be sent to the From address itself +// (a "send a test to myself" workflow). Limits each request to one mailbox. +const ENFORCE_TEST_RECIPIENT = + String(process.env.ENFORCE_TEST_RECIPIENT || "").toLowerCase() === "true"; + +const MAX_SUBJECT_LENGTH = 200; +const MAX_MESSAGE_LENGTH = 5000; +const MAX_DISPLAY_NAME_LENGTH = 100; + +const EMAIL_LOCAL_PART = /^[A-Za-z0-9!#$%&'*+/=?^_`{|}~.-]{1,64}$/; +const EMAIL_DOMAIN = + /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/i; + +/** + * Accept exactly ONE plain address (no display name, no lists, no quoting). + * Rejects "a@x.com, b@y.com", "Name ", quoted locals, CR/LF, etc., + * so a single request cannot fan out to many recipients or smuggle in extra + * ones past the domain policy. Returns { address, domain } or null. + */ +function parseSingleEmail(value) { + if (typeof value !== "string") return null; + const trimmed = value.trim(); + if (trimmed.length < 3 || trimmed.length > 254) return null; + + const at = trimmed.lastIndexOf("@"); + if (at < 1) return null; + + const local = trimmed.slice(0, at); + const domain = trimmed.slice(at + 1).toLowerCase(); + + if (!EMAIL_LOCAL_PART.test(local)) return null; + if (local.startsWith(".") || local.endsWith(".") || local.includes("..")) { + return null; + } + if (!EMAIL_DOMAIN.test(domain)) return null; + + return { address: `${local}@${domain}`, domain }; +} + +function recipientDomainAllowed(domain) { + if (!ALLOWED_RECIPIENT_DOMAINS.length) return true; + + return ALLOWED_RECIPIENT_DOMAINS.some((rule) => + rule.startsWith("*.") + ? domain.endsWith(rule.slice(1)) && domain.length > rule.length - 1 + : domain === rule + ); +} + +// Display names are passed as structured fields to Nodemailer (which encodes +// them safely); here we only strip control characters and cap the length. +function cleanDisplayName(value) { + if (!required(value)) return ""; + return value + .replace(/[\u0000-\u001f\u007f]/g, " ") + .trim() + .slice(0, MAX_DISPLAY_NAME_LENGTH); +} + +/* ------------------------------------------------------------------ */ + async function testSMTP(data = {}) { const { smtpHost, @@ -34,40 +229,62 @@ async function testSMTP(data = {}) { for (const [value, error] of requiredFields) { if (!required(value)) { - return { - httpStatus: 400, - body: { - success: false, - stage: "validation", - error - } - }; + return validationError(error); } } if (!requiredPort(smtpPort)) { - return { - httpStatus: 400, - body: { - success: false, - stage: "validation", - error: "SMTP port is required" - } - }; + return validationError("SMTP port is required"); } const port = Number(smtpPort); const secure = smtpSecure === true || smtpSecure === "true"; if (!Number.isInteger(port) || port < 1 || port > 65535) { - return { - httpStatus: 400, - body: { - success: false, - stage: "validation", - error: "Invalid SMTP port" - } - }; + return validationError("Invalid SMTP port"); + } + + // Port allowlist (checked before any DNS lookup or socket) + if (!ALLOWED_PORTS.has(port)) { + return validationError( + `SMTP port must be one of: ${[...ALLOWED_PORTS].join(", ")}` + ); + } + + // --- Message guardrails (all checked before any DNS lookup or socket) --- + + const from = parseSingleEmail(fromEmail); + if (!from) { + return validationError("From email must be a single valid email address"); + } + + const recipient = parseSingleEmail(recipientEmail); + if (!recipient) { + return validationError( + "Recipient email must be a single valid email address" + ); + } + + if (!recipientDomainAllowed(recipient.domain)) { + return validationError("Recipient domain is not allowed"); + } + + if (ENFORCE_TEST_RECIPIENT && recipient.address !== from.address) { + return validationError( + "Test emails can only be sent to the From address on this server" + ); + } + + if (required(subject) && subject.trim().length > MAX_SUBJECT_LENGTH) { + return validationError( + `Subject must be ${MAX_SUBJECT_LENGTH} characters or fewer` + ); + } + + if (message.length > MAX_MESSAGE_LENGTH) { + return validationError( + `Message must be ${MAX_MESSAGE_LENGTH} characters or fewer` + ); } const smtp = { @@ -75,17 +292,23 @@ async function testSMTP(data = {}) { port, secure, username: smtpUser.trim(), - fromEmail: fromEmail.trim() + fromEmail: from.address }; + // Resolve + validate BEFORE any socket is opened. + const resolved = await resolveSafeHost(smtp.host); + if (resolved.error) { + return validationError(resolved.error); + } + const transporter = nodemailer.createTransport({ - host: smtp.host, + host: resolved.ip, // connect to the vetted IP (prevents DNS rebinding) port: smtp.port, secure: smtp.secure, - auth: { - user: smtp.username, - pass: smtpPassword - }, + auth: { user: smtp.username, pass: smtpPassword }, + tls: net.isIP(smtp.host) + ? {} + : { servername: smtp.host }, // SNI + cert validation against the real hostname connectionTimeout: 10000, greetingTimeout: 10000, socketTimeout: 15000 @@ -94,33 +317,43 @@ async function testSMTP(data = {}) { try { await transporter.verify(); } catch (error) { + // Only surface SMTP-protocol-level details (the server spoke SMTP and + // rejected us). Network-level failures are collapsed to avoid a + // port-scanning oracle. + const isProtocolError = Boolean(error.responseCode); return { httpStatus: 502, body: { success: false, stage: "smtp_authentication", - error: error.message, - code: error.code || null, - command: error.command || null, - response: error.response || null, - responseCode: error.responseCode || null, + error: isProtocolError + ? error.message + : "Unable to connect to the SMTP server", + ...(isProtocolError && { + code: error.code || null, + command: error.command || null, + response: error.response || null, + responseCode: error.responseCode || null + }), smtp } }; } try { + const recipientDisplayName = cleanDisplayName(recipientName); + const info = await transporter.sendMail({ from: { - name: required(fromName) ? fromName.trim() : "MailMetrix", - address: smtp.fromEmail + name: cleanDisplayName(fromName) || "MailMetrix", + address: from.address }, - to: required(recipientName) - ? `"${recipientName.trim()}" <${recipientEmail.trim()}>` - : recipientEmail.trim(), - subject: required(subject) - ? subject.trim() - : "SMTP Test Email", + // Structured address object: the display name can never inject extra + // recipients or headers. + to: recipientDisplayName + ? { name: recipientDisplayName, address: recipient.address } + : recipient.address, + subject: required(subject) ? subject.trim() : "SMTP Test Email", text: message }); @@ -139,20 +372,23 @@ async function testSMTP(data = {}) { } }; } catch (error) { + const isProtocolError = Boolean(error.responseCode); return { httpStatus: 500, body: { success: false, stage: "email_sending", - error: error.message, - code: error.code || null, - command: error.command || null, - response: error.response || null, - responseCode: error.responseCode || null, + error: isProtocolError ? error.message : "Failed to send the test email", + ...(isProtocolError && { + code: error.code || null, + command: error.command || null, + response: error.response || null, + responseCode: error.responseCode || null + }), smtp } }; } } -module.exports = { testSMTP }; \ No newline at end of file +module.exports = { testSMTP, isBlockedIp, parseSingleEmail }; \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index f8cf298..297bf4c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,6 +11,7 @@ services: environment: PORT: ${PORT:-4000} NODE_ENV: production + TRUST_PROXY: 1 expose: - "${PORT:-4000}" @@ -19,6 +20,11 @@ services: restart: unless-stopped stop_grace_period: 30s + cap_drop: + - ALL + security_opt: + - no-new-privileges:true + healthcheck: test: - CMD @@ -64,7 +70,7 @@ services: NGINX_ENVSUBST_FILTER: "^BACKEND_PORT$" ports: - - "50000:80" + - "50000:8080" depends_on: backend: @@ -74,10 +80,15 @@ services: restart: unless-stopped stop_grace_period: 15s + cap_drop: + - ALL + security_opt: + - no-new-privileges:true + healthcheck: test: - CMD-SHELL - - wget -q --spider http://127.0.0.1/ || exit 1 + - wget -q --spider http://127.0.0.1:8080/ || exit 1 interval: 60s timeout: 5s retries: 3 diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 64a734f..8131d12 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,11 +1,21 @@ -FROM nginx:alpine +# Unprivileged Nginx build: runs entirely as uid 101 ("nginx") and listens on +# 8080, so no root process and no privileged-port binding are needed. +# 1.30 is the current stable nginx line. Do not use the floating "nginx:alpine". +# +# For fully reproducible builds, also pin the digest: +# docker buildx imagetools inspect nginxinc/nginx-unprivileged:1.30-alpine +# FROM nginxinc/nginx-unprivileged:1.30-alpine@sha256: +# and let Renovate/Dependabot bump it, otherwise it never receives updates. +FROM nginxinc/nginx-unprivileged:1.30-alpine -COPY src /usr/share/nginx/html -COPY nginx.conf /etc/nginx/conf.d/default.conf +# Apply Alpine security updates (needs root), then drop privileges again. +USER root +RUN apk upgrade --no-cache +USER nginx -# Update Alpine packages, then remove package-index/cache files in the same layer. -RUN apk update && apk upgrade && rm -rf /var/cache/apk/* +COPY --chown=nginx:nginx src /usr/share/nginx/html +COPY --chown=nginx:nginx nginx.conf /etc/nginx/conf.d/default.conf -EXPOSE 80 +EXPOSE 8080 -CMD ["nginx", "-g", "daemon off;"] +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/frontend/nginx.conf b/frontend/nginx.conf index b87b5cb..7aee3a0 100644 --- a/frontend/nginx.conf +++ b/frontend/nginx.conf @@ -1,7 +1,25 @@ server { - listen 80; + # 8080: the unprivileged image runs as a non-root user and cannot bind <1024. + listen 8080; server_name _; + # SEC-05: hide the Nginx version in the Server header and on error pages. + server_tokens off; + + # SEC-05: defense-in-depth security headers. + # "always" makes them apply to 4xx/5xx responses as well. + # + # IMPORTANT: Nginx only inherits add_header into a location block if that + # location defines NO add_header of its own. If you ever add caching or CORS + # headers inside a location, repeat this whole set there (or move it to a + # file and `include` it in both places), otherwise these headers silently + # disappear for that location. + add_header X-Frame-Options "DENY" always; + add_header X-Content-Type-Options "nosniff" always; + add_header Referrer-Policy "strict-origin-when-cross-origin" always; + add_header Permissions-Policy "geolocation=(), camera=(), microphone=()" always; + add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none';" always; + root /usr/share/nginx/html; index index.html; @@ -13,6 +31,10 @@ server { location /health { proxy_pass http://backend:4000/health; proxy_http_version 1.1; + + # Don't leak the backend framework ("X-Powered-By: Express"). + proxy_hide_header X-Powered-By; + proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -22,12 +44,27 @@ server { proxy_read_timeout 30s; } + # SEC-06: never expose internal telemetry through the proxy. The backend's + # /internal/health is for in-network monitoring only. "^~" makes this + # prefix win over the general /api/ location below. + location ^~ /api/internal/ { + return 404; + } + # Proxy API routes to the backend service location /api/ { + # Optional perimeter authentication (see SEC-04). Protects the whole + # backend, since nginx is its only entry point: + # auth_basic "MailMetrix"; + # auth_basic_user_file /etc/nginx/.htpasswd; + proxy_pass http://backend:4000/; proxy_http_version 1.1; + # Don't leak the backend framework ("X-Powered-By: Express"). + proxy_hide_header X-Powered-By; + proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/frontend/src/style.css b/frontend/src/style.css index e5eddbf..2edadc8 100644 --- a/frontend/src/style.css +++ b/frontend/src/style.css @@ -534,8 +534,8 @@ select option { background: var(--surface); color: var(--text); } cursor: pointer; transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease; } -:root[data-theme="dark"] .test-button { color: #0b0d14; } -@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .test-button { color: #0b0d14; } } +:root[data-theme="dark"] .test-button { color: #ffffff; } +@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .test-button { color: var(--text); } } .test-button:hover { background: var(--primary-hover); transform: translateY(-1px); } .test-button:active { transform: none; } .test-button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; } @@ -698,7 +698,7 @@ select option { background: var(--surface); color: var(--text); } display: inline-flex; align-items: center; gap: 6px; - margin-left: 12px; + /* margin-left: 12px; */ padding: 5px 11px 5px 9px; border: 1px solid var(--border-strong); border-radius: 999px; diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..d5df68a --- /dev/null +++ b/package-lock.json @@ -0,0 +1,954 @@ +{ + "name": "mailmetrix", + "version": "1.1.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "mailmetrix", + "version": "1.1.1", + "license": "SEE LICENSE IN LICENSE", + "dependencies": { + "express-rate-limit": "^8.7.3" + } + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "peer": true, + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/body-parser": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.4.0.tgz", + "integrity": "sha512-Ifk1KcLrxaGt1occQagQNFNNOqRt1LFuehEnHHzB8Z6cRgIxRU1TBaiIsUiCdA+gy5PL7Y1IX31DNKkRmxtXjQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^2.1.0", + "debug": "^4.4.3", + "http-errors": "^2.0.1", + "iconv-lite": "^0.7.3", + "on-finished": "^2.4.1", + "qs": "^6.16.1", + "raw-body": "^3.0.2", + "type-is": "^2.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "peer": true, + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-2.0.1.tgz", + "integrity": "sha512-e+H0ZXHSWYrENhQzw1LPuP4oF5MzVKmDU6d3hxlvaPEYLLg62MxtQNPRx4SYSuYJSBUgnQIG4HIN2tEtNv7Dog==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz", + "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "peer": true, + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT", + "peer": true + }, + "node_modules/encodeurl": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.1.tgz", + "integrity": "sha512-Ev/hIyePLZtpL98x562lvPtenrUfGr0lfaf44HFZ+hDEwso7ccV9QAZrEVLg0hxNAzygaAFxy2dYaAKKM0G06A==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "license": "MIT", + "peer": true, + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT", + "peer": true + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/express/-/express-5.3.0.tgz", + "integrity": "sha512-qCqy1xSoaugxOD4IVHb1ZWdkvCF2W3aE2okKouWj8VwJ+ztskSiXoBnCSJqfKT+cVPJhuJqe9YLbY425+Zh00g==", + "license": "MIT", + "peer": true, + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.3.0", + "content-disposition": "^2.0.1", + "content-type": "^2.0.0", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.8", + "qs": "^6.16.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.1.0", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express-rate-limit": { + "version": "8.7.3", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.7.3.tgz", + "integrity": "sha512-zPLqDI2f0gV2WmGnacLf9XSSqn4VldRyP5LCzOwx0BKH40mO6+2PCFkoSsRO2jePx87/Kf6NUF6P2QOTKXHbQA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "ip-address": "^10.2.0" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/express-rate-limit" + }, + "peerDependencies": { + "express": ">= 4.11" + } + }, + "node_modules/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "license": "MIT", + "peer": true, + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "peer": true, + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "license": "MIT", + "peer": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.3.tgz", + "integrity": "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC", + "peer": true + }, + "node_modules/ip-address": { + "version": "10.7.5", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.7.5.tgz", + "integrity": "sha512-t2v0rkILYv9WXmSL7TpAaU3HXgaFYOPUcH3QHgwQ++gpJuH3bqyMy4Fvt/DJCTKwzH3Cf+bAp5W/mFL39KPLzA==", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT", + "peer": true + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.1.tgz", + "integrity": "sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "peer": true, + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.1.0.tgz", + "integrity": "sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg==", + "license": "MIT", + "peer": true, + "dependencies": { + "content-type": "^2.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.2.tgz", + "integrity": "sha512-ATWUv387i+nLD49EiDoOft5scf32Vsdz3ktrQJG9bi7jRFmaXTssvyvj1EmeKVVgvesbqUtvQQvaS2TpTukAZQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "peer": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.4.2.tgz", + "integrity": "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==", + "license": "MIT", + "peer": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.8.tgz", + "integrity": "sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/qs": { + "version": "6.17.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.17.1.tgz", + "integrity": "sha512-jd3COkaKVgGUW+ZHyEHCG9bH7RoaaiWuMgzsIBjUMVjLAaWGWpoUAVwljVvBHxRu/2qEHnadLGZrkutYUBPQJA==", + "license": "BSD-3-Clause", + "peer": true, + "dependencies": { + "es-define-property": "^1.0.1", + "side-channel": "^1.1.1" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.3.0.tgz", + "integrity": "sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.6" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "license": "MIT", + "peer": true, + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT", + "peer": true + }, + "node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/serve-static": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "license": "MIT", + "peer": true, + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC", + "peer": true + }, + "node_modules/side-channel": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", + "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4", + "side-channel-list": "^1.0.1", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz", + "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==", + "license": "MIT", + "peer": true, + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "peer": true, + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "peer": true, + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz", + "integrity": "sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==", + "license": "MIT", + "peer": true, + "dependencies": { + "content-type": "^2.0.0", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC", + "peer": true + } + } +} diff --git a/package.json b/package.json index de4d76b..4ac57ae 100644 --- a/package.json +++ b/package.json @@ -6,5 +6,8 @@ "license": "SEE LICENSE IN LICENSE", "scripts": { "version": "node scripts/sync-version.js" + }, + "dependencies": { + "express-rate-limit": "^8.7.3" } } From d3e081bd4aa6820f6862fccedd3c24196afbefba Mon Sep 17 00:00:00 2001 From: devopsgithub1234 Date: Tue, 3 Nov 2026 19:40:05 +0530 Subject: [PATCH 2/7] update compose file --- docker-compose.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 297bf4c..7d056ae 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,10 @@ -name: MailMetrix +name: mailmetrix services: backend: build: context: ./backend - container_name: MailMetrix-backend + container_name: mailmetrix-backend env_file: - .env @@ -40,7 +40,7 @@ services: start_period: 15s networks: - - mailmetrix-network + - network logging: driver: json-file @@ -62,7 +62,7 @@ services: frontend: build: context: ./frontend - container_name: MailMetrix-frontend + container_name: mailmetrix-frontend env_file: - .env environment: @@ -95,7 +95,7 @@ services: start_period: 10s networks: - - mailmetrix-network + - network logging: driver: json-file @@ -113,5 +113,5 @@ services: path: ./frontend/package.json networks: - mailmetrix-network: + network: driver: bridge \ No newline at end of file From c65d269450f876c6d3e45f561059b8a24a8dbdde Mon Sep 17 00:00:00 2001 From: Kaushik Parui Date: Wed, 4 Nov 2026 10:18:25 +0530 Subject: [PATCH 3/7] backend npm audit fix --- backend/package-lock.json | 24 +- package-lock.json | 943 +------------------------------------- package.json | 3 - 3 files changed, 13 insertions(+), 957 deletions(-) diff --git a/backend/package-lock.json b/backend/package-lock.json index 7676bf0..ceac272 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -28,18 +28,18 @@ } }, "node_modules/body-parser": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.3.0.tgz", - "integrity": "sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.4.0.tgz", + "integrity": "sha512-Ifk1KcLrxaGt1occQagQNFNNOqRt1LFuehEnHHzB8Z6cRgIxRU1TBaiIsUiCdA+gy5PL7Y1IX31DNKkRmxtXjQ==", "license": "MIT", "dependencies": { "bytes": "^3.1.2", - "content-type": "^2.0.0", + "content-type": "^2.1.0", "debug": "^4.4.3", "http-errors": "^2.0.1", - "iconv-lite": "^0.7.2", + "iconv-lite": "^0.7.3", "on-finished": "^2.4.1", - "qs": "^6.15.2", + "qs": "^6.16.1", "raw-body": "^3.0.2", "type-is": "^2.1.0" }, @@ -579,9 +579,9 @@ } }, "node_modules/nodemailer": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-10.1.1.tgz", - "integrity": "sha512-pbqZRoeYUO+1E8TJ/11WeY4D2EVujj1hsYjz3qff/vUFDtGnmi7p3iqzTFslYOfQ6PnjVcWxx/CIUSHCSrO/QA==", + "version": "10.3.1", + "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-10.3.1.tgz", + "integrity": "sha512-uF0AFsJC07Y1vdW7p580DKAnh7rAO+4UPSSB3mDCPNDufoiaOebV6JmrzpxB14OjEEEiBsNdYoM2Y+fN8M7BBA==", "license": "MIT-0", "engines": { "node": ">=20.0.0" @@ -657,9 +657,9 @@ } }, "node_modules/qs": { - "version": "6.16.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.16.0.tgz", - "integrity": "sha512-h6fhOIaRrID2CbEY2fqs+7t+UXZo+MLAnU5gRIq85uFtdiUPCdsApMlHhXogKVM4HM2DVbIjGNTTYH2OcmP1vA==", + "version": "6.17.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.17.1.tgz", + "integrity": "sha512-jd3COkaKVgGUW+ZHyEHCG9bH7RoaaiWuMgzsIBjUMVjLAaWGWpoUAVwljVvBHxRu/2qEHnadLGZrkutYUBPQJA==", "license": "BSD-3-Clause", "dependencies": { "es-define-property": "^1.0.1", diff --git a/package-lock.json b/package-lock.json index d5df68a..87b7024 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,948 +7,7 @@ "": { "name": "mailmetrix", "version": "1.1.1", - "license": "SEE LICENSE IN LICENSE", - "dependencies": { - "express-rate-limit": "^8.7.3" - } - }, - "node_modules/accepts": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", - "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", - "license": "MIT", - "peer": true, - "dependencies": { - "mime-types": "^3.0.0", - "negotiator": "^1.0.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/body-parser": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.4.0.tgz", - "integrity": "sha512-Ifk1KcLrxaGt1occQagQNFNNOqRt1LFuehEnHHzB8Z6cRgIxRU1TBaiIsUiCdA+gy5PL7Y1IX31DNKkRmxtXjQ==", - "license": "MIT", - "peer": true, - "dependencies": { - "bytes": "^3.1.2", - "content-type": "^2.1.0", - "debug": "^4.4.3", - "http-errors": "^2.0.1", - "iconv-lite": "^0.7.3", - "on-finished": "^2.4.1", - "qs": "^6.16.1", - "raw-body": "^3.0.2", - "type-is": "^2.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/call-bind-apply-helpers": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", - "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", - "license": "MIT", - "peer": true, - "dependencies": { - "es-errors": "^1.3.0", - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/call-bound": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", - "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", - "license": "MIT", - "peer": true, - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "get-intrinsic": "^1.3.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/content-disposition": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-2.0.1.tgz", - "integrity": "sha512-e+H0ZXHSWYrENhQzw1LPuP4oF5MzVKmDU6d3hxlvaPEYLLg62MxtQNPRx4SYSuYJSBUgnQIG4HIN2tEtNv7Dog==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">=18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/content-type": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz", - "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">=18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/cookie": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", - "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie-signature": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", - "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">=6.6.0" - } - }, - "node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/dunder-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", - "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", - "license": "MIT", - "peer": true, - "dependencies": { - "call-bind-apply-helpers": "^1.0.1", - "es-errors": "^1.3.0", - "gopd": "^1.2.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", - "license": "MIT", - "peer": true - }, - "node_modules/encodeurl": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.1.tgz", - "integrity": "sha512-Ev/hIyePLZtpL98x562lvPtenrUfGr0lfaf44HFZ+hDEwso7ccV9QAZrEVLg0hxNAzygaAFxy2dYaAKKM0G06A==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.8" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/es-define-property": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", - "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-errors": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-object-atoms": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", - "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", - "license": "MIT", - "peer": true, - "dependencies": { - "es-errors": "^1.3.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", - "license": "MIT", - "peer": true - }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/express": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/express/-/express-5.3.0.tgz", - "integrity": "sha512-qCqy1xSoaugxOD4IVHb1ZWdkvCF2W3aE2okKouWj8VwJ+ztskSiXoBnCSJqfKT+cVPJhuJqe9YLbY425+Zh00g==", - "license": "MIT", - "peer": true, - "dependencies": { - "accepts": "^2.0.0", - "body-parser": "^2.3.0", - "content-disposition": "^2.0.1", - "content-type": "^2.0.0", - "cookie": "^0.7.1", - "cookie-signature": "^1.2.1", - "debug": "^4.4.0", - "depd": "^2.0.0", - "encodeurl": "^2.0.0", - "escape-html": "^1.0.3", - "etag": "^1.8.1", - "finalhandler": "^2.1.0", - "fresh": "^2.0.0", - "http-errors": "^2.0.0", - "merge-descriptors": "^2.0.0", - "mime-types": "^3.0.0", - "on-finished": "^2.4.1", - "once": "^1.4.0", - "parseurl": "^1.3.3", - "proxy-addr": "^2.0.8", - "qs": "^6.16.0", - "range-parser": "^1.2.1", - "router": "^2.2.0", - "send": "^1.1.0", - "serve-static": "^2.2.0", - "statuses": "^2.0.1", - "type-is": "^2.1.0", - "vary": "^1.1.2" - }, - "engines": { - "node": ">= 18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/express-rate-limit": { - "version": "8.7.3", - "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.7.3.tgz", - "integrity": "sha512-zPLqDI2f0gV2WmGnacLf9XSSqn4VldRyP5LCzOwx0BKH40mO6+2PCFkoSsRO2jePx87/Kf6NUF6P2QOTKXHbQA==", - "license": "MIT", - "dependencies": { - "debug": "^4.4.3", - "ip-address": "^10.2.0" - }, - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/express-rate-limit" - }, - "peerDependencies": { - "express": ">= 4.11" - } - }, - "node_modules/finalhandler": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", - "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", - "license": "MIT", - "peer": true, - "dependencies": { - "debug": "^4.4.0", - "encodeurl": "^2.0.0", - "escape-html": "^1.0.3", - "on-finished": "^2.4.1", - "parseurl": "^1.3.3", - "statuses": "^2.0.1" - }, - "engines": { - "node": ">= 18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fresh": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", - "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "license": "MIT", - "peer": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-intrinsic": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", - "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", - "license": "MIT", - "peer": true, - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "es-define-property": "^1.0.1", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.1.1", - "function-bind": "^1.1.2", - "get-proto": "^1.0.1", - "gopd": "^1.2.0", - "has-symbols": "^1.1.0", - "hasown": "^2.0.2", - "math-intrinsics": "^1.1.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", - "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", - "license": "MIT", - "peer": true, - "dependencies": { - "dunder-proto": "^1.0.1", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/gopd": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", - "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-symbols": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", - "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/hasown": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", - "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", - "license": "MIT", - "peer": true, - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/http-errors": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", - "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", - "license": "MIT", - "peer": true, - "dependencies": { - "depd": "~2.0.0", - "inherits": "~2.0.4", - "setprototypeof": "~1.2.0", - "statuses": "~2.0.2", - "toidentifier": "~1.0.1" - }, - "engines": { - "node": ">= 0.8" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/iconv-lite": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.3.tgz", - "integrity": "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==", - "license": "MIT", - "peer": true, - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "license": "ISC", - "peer": true - }, - "node_modules/ip-address": { - "version": "10.7.5", - "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.7.5.tgz", - "integrity": "sha512-t2v0rkILYv9WXmSL7TpAaU3HXgaFYOPUcH3QHgwQ++gpJuH3bqyMy4Fvt/DJCTKwzH3Cf+bAp5W/mFL39KPLzA==", - "license": "MIT", - "engines": { - "node": ">= 12" - } - }, - "node_modules/ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/is-promise": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", - "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", - "license": "MIT", - "peer": true - }, - "node_modules/math-intrinsics": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", - "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/media-typer": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.1.tgz", - "integrity": "sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.8" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/merge-descriptors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", - "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/mime-db": { - "version": "1.54.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", - "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", - "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", - "license": "MIT", - "peer": true, - "dependencies": { - "mime-db": "^1.54.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/negotiator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.1.0.tgz", - "integrity": "sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg==", - "license": "MIT", - "peer": true, - "dependencies": { - "content-type": "^2.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/object-inspect": { - "version": "1.13.4", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", - "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/on-finished": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.2.tgz", - "integrity": "sha512-ATWUv387i+nLD49EiDoOft5scf32Vsdz3ktrQJG9bi7jRFmaXTssvyvj1EmeKVVgvesbqUtvQQvaS2TpTukAZQ==", - "license": "MIT", - "peer": true, - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "license": "ISC", - "peer": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/path-to-regexp": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.4.2.tgz", - "integrity": "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==", - "license": "MIT", - "peer": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/proxy-addr": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.8.tgz", - "integrity": "sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==", - "license": "MIT", - "peer": true, - "dependencies": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - }, - "engines": { - "node": ">= 0.10" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/qs": { - "version": "6.17.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.17.1.tgz", - "integrity": "sha512-jd3COkaKVgGUW+ZHyEHCG9bH7RoaaiWuMgzsIBjUMVjLAaWGWpoUAVwljVvBHxRu/2qEHnadLGZrkutYUBPQJA==", - "license": "BSD-3-Clause", - "peer": true, - "dependencies": { - "es-define-property": "^1.0.1", - "side-channel": "^1.1.1" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/range-parser": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.3.0.tgz", - "integrity": "sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.6" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/raw-body": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", - "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", - "license": "MIT", - "peer": true, - "dependencies": { - "bytes": "~3.1.2", - "http-errors": "~2.0.1", - "iconv-lite": "~0.7.0", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/router": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", - "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", - "license": "MIT", - "peer": true, - "dependencies": { - "debug": "^4.4.0", - "depd": "^2.0.0", - "is-promise": "^4.0.0", - "parseurl": "^1.3.3", - "path-to-regexp": "^8.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "license": "MIT", - "peer": true - }, - "node_modules/send": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", - "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", - "license": "MIT", - "peer": true, - "dependencies": { - "debug": "^4.4.3", - "encodeurl": "^2.0.0", - "escape-html": "^1.0.3", - "etag": "^1.8.1", - "fresh": "^2.0.0", - "http-errors": "^2.0.1", - "mime-types": "^3.0.2", - "ms": "^2.1.3", - "on-finished": "^2.4.1", - "range-parser": "^1.2.1", - "statuses": "^2.0.2" - }, - "engines": { - "node": ">= 18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/serve-static": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", - "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", - "license": "MIT", - "peer": true, - "dependencies": { - "encodeurl": "^2.0.0", - "escape-html": "^1.0.3", - "parseurl": "^1.3.3", - "send": "^1.2.0" - }, - "engines": { - "node": ">= 18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", - "license": "ISC", - "peer": true - }, - "node_modules/side-channel": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", - "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==", - "license": "MIT", - "peer": true, - "dependencies": { - "es-errors": "^1.3.0", - "object-inspect": "^1.13.4", - "side-channel-list": "^1.0.1", - "side-channel-map": "^1.0.1", - "side-channel-weakmap": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-list": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz", - "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==", - "license": "MIT", - "peer": true, - "dependencies": { - "es-errors": "^1.3.0", - "object-inspect": "^1.13.4" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-map": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", - "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", - "license": "MIT", - "peer": true, - "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.5", - "object-inspect": "^1.13.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-weakmap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", - "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", - "license": "MIT", - "peer": true, - "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.5", - "object-inspect": "^1.13.3", - "side-channel-map": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/statuses": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", - "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">=0.6" - } - }, - "node_modules/type-is": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz", - "integrity": "sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==", - "license": "MIT", - "peer": true, - "dependencies": { - "content-type": "^2.0.0", - "media-typer": "^1.1.0", - "mime-types": "^3.0.0" - }, - "engines": { - "node": ">= 18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "license": "ISC", - "peer": true + "license": "SEE LICENSE IN LICENSE" } } } diff --git a/package.json b/package.json index 4ac57ae..de4d76b 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,5 @@ "license": "SEE LICENSE IN LICENSE", "scripts": { "version": "node scripts/sync-version.js" - }, - "dependencies": { - "express-rate-limit": "^8.7.3" } } From 2fdc56d1031863286638cd2168442bab9fa67005 Mon Sep 17 00:00:00 2001 From: Kaushik Parui Date: Wed, 4 Nov 2026 10:35:41 +0530 Subject: [PATCH 4/7] sonar: flagged security are patched --- backend/Dockerfile | 3 ++- backend/src/server.js | 8 ++++---- backend/src/services/smtp.js | 38 ++++++++++++++++++------------------ frontend/Dockerfile | 12 ++++++++---- 4 files changed, 33 insertions(+), 28 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 31b3a82..617d4fb 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -16,8 +16,9 @@ WORKDIR /app RUN apk upgrade --no-cache # Production dependencies only (devDependencies are not installed). +# Omitting lifecycle scripts prevents untrusted packages from running arbitrary code during install. COPY package*.json ./ -RUN npm ci --omit=dev && npm cache clean --force +RUN npm ci --omit=dev --ignore-scripts && npm cache clean --force COPY --chown=node:node src ./src diff --git a/backend/src/server.js b/backend/src/server.js index bf6b9cf..b3d2b4c 100644 --- a/backend/src/server.js +++ b/backend/src/server.js @@ -135,11 +135,11 @@ app.get("/api/health", healthHandler); // is defense in depth. Anything else falls through to the normal 404. const internalNets = new net.BlockList(); internalNets.addSubnet("127.0.0.0", 8, "ipv4"); -internalNets.addSubnet("10.0.0.0", 8, "ipv4"); -internalNets.addSubnet("172.16.0.0", 12, "ipv4"); -internalNets.addSubnet("192.168.0.0", 16, "ipv4"); +internalNets.addSubnet("10.0.0.0", 8, "ipv4"); // NOSONAR: S1313 - RFC 1918 +internalNets.addSubnet("172.16.0.0", 12, "ipv4"); // NOSONAR: S1313 - RFC 1918 +internalNets.addSubnet("192.168.0.0", 16, "ipv4"); // NOSONAR: S1313 - RFC 1918 internalNets.addAddress("::1", "ipv6"); -internalNets.addSubnet("fc00::", 7, "ipv6"); +internalNets.addSubnet("fc00::", 7, "ipv6"); // NOSONAR: S1313 - unique local function isInternalAddress(addr) { if (!addr) return false; diff --git a/backend/src/services/smtp.js b/backend/src/services/smtp.js index 757c378..3d0a201 100644 --- a/backend/src/services/smtp.js +++ b/backend/src/services/smtp.js @@ -41,30 +41,30 @@ const blocked = new net.BlockList(); // IPv4 [ ["0.0.0.0", 8], // "this" network - ["10.0.0.0", 8], // RFC 1918 - ["100.64.0.0", 10], // CGNAT (often used for internal infra) + ["10.0.0.0", 8], // NOSONAR: S1313 - RFC 1918 + ["100.64.0.0", 10], // NOSONAR: S1313 - CGNAT (often used for internal infra) ["127.0.0.0", 8], // loopback - ["169.254.0.0", 16], // link-local + cloud metadata - ["172.16.0.0", 12], // RFC 1918 - ["192.0.0.0", 24], // IETF protocol assignments - ["192.0.2.0", 24], // TEST-NET-1 - ["192.168.0.0", 16], // RFC 1918 - ["198.18.0.0", 15], // benchmarking - ["198.51.100.0", 24], // TEST-NET-2 - ["203.0.113.0", 24], // TEST-NET-3 - ["224.0.0.0", 4], // multicast - ["240.0.0.0", 4] // reserved (incl. 255.255.255.255) + ["169.254.0.0", 16], // NOSONAR: S1313 - link-local + cloud metadata + ["172.16.0.0", 12], // NOSONAR: S1313 - RFC 1918 + ["192.0.0.0", 24], // NOSONAR: S1313 - IETF protocol assignments + ["192.0.2.0", 24], // NOSONAR: S1313 - TEST-NET-1 + ["192.168.0.0", 16], // NOSONAR: S1313 - RFC 1918 + ["198.18.0.0", 15], // NOSONAR: S1313 - benchmarking + ["198.51.100.0", 24], // NOSONAR: S1313 - TEST-NET-2 + ["203.0.113.0", 24], // NOSONAR: S1313 - TEST-NET-3 + ["224.0.0.0", 4], // NOSONAR: S1313 - multicast + ["240.0.0.0", 4] // NOSONAR: S1313 - reserved (incl. 255.255.255.255) ].forEach(([addr, prefix]) => blocked.addSubnet(addr, prefix, "ipv4")); // IPv6 blocked.addAddress("::", "ipv6"); // unspecified blocked.addAddress("::1", "ipv6"); // loopback [ - ["fc00::", 7], // unique local - ["fe80::", 10], // link-local - ["ff00::", 8], // multicast - ["64:ff9b::", 96], // NAT64 (can embed private IPv4) - ["2001:db8::", 32] // documentation + ["fc00::", 7], // NOSONAR: S1313 - unique local + ["fe80::", 10], // NOSONAR: S1313 - link-local + ["ff00::", 8], // NOSONAR: S1313 - multicast + ["64:ff9b::", 96], // NOSONAR: S1313 - NAT64 (can embed private IPv4) + ["2001:db8::", 32] // NOSONAR: S1313 - documentation ].forEach(([addr, prefix]) => blocked.addSubnet(addr, prefix, "ipv6")); function isBlockedIp(ip) { @@ -80,8 +80,8 @@ function isBlockedIp(ip) { const hex = lower.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/); if (hex) { - const hi = parseInt(hex[1], 16); - const lo = parseInt(hex[2], 16); + const hi = Number.parseInt(hex[1], 16); + const lo = Number.parseInt(hex[2], 16); return isBlockedIp(`${hi >> 8}.${hi & 255}.${lo >> 8}.${lo & 255}`); } diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 8131d12..57272a7 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -8,13 +8,17 @@ # and let Renovate/Dependabot bump it, otherwise it never receives updates. FROM nginxinc/nginx-unprivileged:1.30-alpine -# Apply Alpine security updates (needs root), then drop privileges again. +# Apply Alpine security updates (needs root). USER root RUN apk upgrade --no-cache -USER nginx -COPY --chown=nginx:nginx src /usr/share/nginx/html -COPY --chown=nginx:nginx nginx.conf /etc/nginx/conf.d/default.conf +# Copy assets and configuration with root ownership so the unprivileged nginx worker +# can read them but cannot modify or tamper with them at runtime. +COPY src /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf + +# Drop privileges to the unprivileged "nginx" user (uid 101). +USER nginx EXPOSE 8080 From 0898e944bf461235f63f12b121b996bd91087084 Mon Sep 17 00:00:00 2001 From: Kaushik Parui Date: Wed, 4 Nov 2026 11:02:09 +0530 Subject: [PATCH 5/7] update nginx docker image --- frontend/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 57272a7..022c6cf 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -3,10 +3,10 @@ # 1.30 is the current stable nginx line. Do not use the floating "nginx:alpine". # # For fully reproducible builds, also pin the digest: -# docker buildx imagetools inspect nginxinc/nginx-unprivileged:1.30-alpine -# FROM nginxinc/nginx-unprivileged:1.30-alpine@sha256: +# docker buildx imagetools inspect nginx/nginx-unprivileged:alpine +# FROM nginx/nginx-unprivileged:alpine@sha256: # and let Renovate/Dependabot bump it, otherwise it never receives updates. -FROM nginxinc/nginx-unprivileged:1.30-alpine +FROM nginx/nginx-unprivileged:alpine # Apply Alpine security updates (needs root). USER root From af9e489d169ba6b849a100cd14cd4bae6aa11d76 Mon Sep 17 00:00:00 2001 From: devopsgithub1234 Date: Wed, 4 Nov 2026 15:24:29 +0530 Subject: [PATCH 6/7] - revamp webpage in github page - update readme.md --- README.md | 93 ++++- docs/index.html | 1042 +++++++++++++++++------------------------------ 2 files changed, 472 insertions(+), 663 deletions(-) diff --git a/README.md b/README.md index 5907fae..9cac4e1 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,12 @@ Run MailMetrix in your own environment and maintain control over how you deploy > **Important:** MailMetrix has **no built-in user authentication**. Do not expose it to the public internet without placing authentication in front of it. See [Protect access to your deployment](#protect-access-to-your-deployment). +> **Authorized use only:** Use MailMetrix only against systems, domains, and mail servers you own or are explicitly authorized to test. + +> **Checked before release:** Changes are validated with CodeQL code scanning, CI code and dependency validation, Docker validation, and a SonarCloud quality gate. See [Quality and Security Checks](#quality-and-security-checks). + +> **Privacy:** MailMetrix is self-hosted. The maintainers do not receive your data. See the [Privacy Policy](#privacy-policy). + ## Why MailMetrix? Troubleshooting email infrastructure can require SMTP credentials, DNS configuration details, and potentially sensitive email headers. @@ -459,6 +465,12 @@ For example: Review the source code to understand which services receive requests or data during each operation. +### Use it only on systems you are authorized to test + +MailMetrix can connect to mail servers, query DNS, and send test emails. Use it only against infrastructure you own or have explicit permission to test, and only send test emails to recipients who expect them. Using it to probe, harass, or send unsolicited email through systems you do not control may violate the law or the terms of those services. You are responsible for how you use it. + +For what data an instance handles and where it goes, see the [Privacy Policy](#privacy-policy). + ### Report security vulnerabilities Please do not publish exploitable security vulnerabilities or exposed credentials in public issues. @@ -508,6 +520,81 @@ RATE_LIMIT_SMTP=10 Keep `.env.example` in sync with this list when you add or change settings. +## Quality and Security Checks + +The following automated checks are run on changes before a release: + +| Check | What it covers | +|---|---| +| **CodeQL** (GitHub code scanning) | Static analysis of the source code for security vulnerabilities and coding errors. | +| **MailMetrix CI: Code and dependency validation** | Validates the application code and its dependencies. | +| **MailMetrix CI: Docker validation** | Validates the Docker build configuration. | +| **SonarCloud Code Analysis** | Static analysis for code quality and security issues; the Quality Gate must pass. | + +These checks reduce risk but do not guarantee that the software is free of vulnerabilities or defects. They complement, and do not replace, code review, testing, and the deployment guidance in [Security and Privacy](#security-and-privacy). + +## Privacy Policy + +*Last updated: 4 November 2026* + +### In short + +- MailMetrix is **self-hosted software**. The maintainers do not operate a hosted service and **do not receive any data** from your instance. +- MailMetrix has **no analytics, advertising, tracking, or telemetry**, and does not send data to the maintainers. +- The backend does not store SMTP credentials, email headers, or generated keys. They are processed for the request and discarded. +- Data leaves your instance only to destinations **you** specify, such as the SMTP server you test and DNS resolvers. + +### Scope and responsibility + +This policy applies to the MailMetrix software and to the project's GitHub Pages website. Because you run MailMetrix yourself, **you (or your organization) are the operator of your instance** and are responsible for the data it processes, for protecting access to it, and for informing and obtaining any permissions needed from anyone else who uses it. If you run MailMetrix for other people, you may need your own privacy notice describing how your deployment handles their data. + +### What an instance processes + +| Data | Purpose | Retention | +|---|---|---| +| SMTP host, port, username, password, sender, recipient, subject, and message | To authenticate to and send a test email through the SMTP server you specify. | Used in memory for the request and not stored by MailMetrix. The password is not included in API responses. The data is sent to the SMTP server you specify, which handles it under its own policies. | +| Domain names and DKIM selectors | To perform DNS lookups. | Not stored. They appear in request logs because they are part of the request URL. | +| Email headers | To analyze message routing and authentication results. | Processed in memory and not stored. | +| Generated DKIM private keys | To give you key material to publish and keep. | Not stored on the server. The key is delivered to your browser, so protect it and transmit it only over HTTPS. | +| Client IP addresses | To apply rate limits. | Held temporarily in memory as counters, which expire after the rate-limit window and reset on restart. They also appear in Nginx access logs. | +| Logs | To operate and troubleshoot the instance. | See below. | + +### Logs + +- **Backend:** logs a timestamp, request method, URL (including the query string), status code, and duration. It does not intentionally log request bodies, so SMTP credentials sent in a request body are not written to these logs. Error messages may also be logged. +- **Nginx:** logs client IP addresses, request lines, status codes, and user agents in its standard access-log format. +- **Retention:** Docker keeps container logs on the host. The default Compose file rotates them (10 MB per file, up to 3 files per service). Removing the containers, for example with `docker compose down`, deletes their logs. Adjust log settings if you need shorter retention. + +### Third parties and external connections + +- MailMetrix does not include third-party analytics, advertising, or tracking services. +- SMTP tests connect to the mail server you specify, and DNS checks query DNS resolvers available to your environment. Those services receive the data needed for the lookup or message and handle it under their own policies. +- Your hosting provider, network, or reverse proxy can observe traffic to your instance. Use HTTPS for remote access. + +### Cookies and browser storage + +The MailMetrix web interface is designed not to use tracking cookies or third-party scripts. If you add authentication or other components in front of it, those may set their own cookies, which are your responsibility. + +### The project website + +The MailMetrix GitHub Pages site is a static page. It does not use analytics, cookies, or forms, and does not load third-party fonts or scripts. The site is hosted by GitHub, which may process visitor information such as IP addresses under [GitHub's privacy statement](https://docs.github.com/en/site-policy/privacy-policies/github-general-privacy-statement). + +### Your choices + +- Use test credentials rather than production credentials wherever possible. +- Protect your instance with authentication and HTTPS. +- Be careful before pasting real email headers, which can contain addresses, IP addresses, and message identifiers of third parties. +- Configure log retention to suit your needs. +- Do not post credentials, private keys, or personal data in public issues. + +### Changes to this policy + +Changes are made through the repository, and the history is visible in Git. The date above shows when this policy was last updated. + +### Questions + +For privacy questions, open an issue without including personal data. For security vulnerabilities, follow [SECURITY.md](SECURITY.md) instead of opening a public issue. + ## Contributing Contributions, bug reports, documentation improvements, and feature suggestions are welcome. @@ -524,15 +611,17 @@ For security-sensitive findings, follow the instructions in [SECURITY.md](SECURI ## License -MailMetrix is distributed under the license provided in the repository's `LICENSE` file. +MailMetrix is distributed under the license provided in the repository's [LICENSE](LICENSE) file. -Review that file before redistributing or incorporating MailMetrix into another project. +Review that file before redistributing or incorporating MailMetrix into another project. It sets out the exact terms of use, including any warranty and liability disclaimers. MailMetrix is provided to you to run on your own systems, and you are responsible for how you deploy and use it. ## Project Links - **Source code:** https://github.com/devindevops/mailmetrix - **Issues:** https://github.com/devindevops/mailmetrix/issues - **Security policy:** [SECURITY.md](SECURITY.md) +- **Privacy policy:** [Privacy Policy](#privacy-policy) +- **License:** [LICENSE](LICENSE) --- diff --git a/docs/index.html b/docs/index.html index 1ccfc35..19227a2 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,689 +1,409 @@ - - - - - - - MailMetrix — Self-Hosted Email Diagnostics - - - - - - - - - - - - - + + + + + + +MailMetrix — Self-Hosted Email Diagnostics + + + + + + + + + - - -
-
-
- OPEN SOURCE · SELF-HOSTED - -

- Email diagnostics.
- Under your control. -

- -

- Test SMTP connectivity, inspect email authentication records, - analyze message headers, and generate DKIM/DMARC configuration - material with a self-hosted toolkit built for developers and - system administrators. -

+
- + -

- Build locally with Docker Compose. No public demo instance required. -

+
+
+
+

Take control of your diagnostic environment.

+

Email troubleshooting can involve SMTP credentials, DNS configuration, and sensitive message headers. MailMetrix provides a self-hosted deployment option so you can run diagnostics in infrastructure you control.

-
- -
-
-
-

Take control of your diagnostic environment.

-

- Email troubleshooting can involve SMTP credentials, DNS - configuration, and sensitive message headers. MailMetrix - provides a self-hosted deployment option so you can run - diagnostics in infrastructure you control. -

-
- -
-
-

Self-hosted by design

-

- Build and run the application in your own environment - using Docker Compose. -

-
- -
-

Focused email diagnostics

-

- Access common SMTP, DNS, header-analysis, and - authentication-generation tools in one interface. -

-
-
- -

- Self-hosting can reduce dependence on third-party diagnostic - services, but it does not automatically guarantee security. - Review the application's security controls and protect access - to your deployment. -

+
+
+ +

Self-hosted by design

+

Build and run the application in your own environment using Docker Compose.

+
+
+ +

Focused email diagnostics

+

Access common SMTP, DNS, header-analysis, and authentication-generation tools in one interface.

+
-
- -
-
-
-

Four tools. One self-hosted workspace.

-

- Explore the tools available in MailMetrix. -

-
- -
-
- MailMetrix SMTP Tester interface -

01. SMTP Tester

-

- Troubleshoot SMTP connectivity and authentication - against a specified mail server. -

-
- -
- MailMetrix DNS Email Checker interface -

02. DNS Email Checker

-

- Inspect MX, SPF, DMARC, and DKIM records - associated with your domain. -

-
- -
- MailMetrix Email Header Analyzer interface -

03. Email Header Analyzer

-

- Examine email headers to investigate message routing - and authentication information. -

-
+

+ Self-hosting can reduce dependence on third-party diagnostic services, but it does not automatically guarantee security. MailMetrix includes built-in safeguards, but it has no built-in login, so protect access to your deployment. See the Security section. +

+
+
-
- MailMetrix DKIM and DMARC Generator interface -

04. DKIM & DMARC Generator

-

- Generate email authentication configuration - material for review and deployment. -

-
- +
+
+
+

Four tools. One self-hosted workspace.

+

Explore the tools available in MailMetrix.

-
- -
-
-
-

Simple, containerized architecture.

-

- MailMetrix separates the frontend interface from the - backend API and builds the application from source. -

-
- -
-
-

Frontend

-

Nginx · Web interface

-
- - - -
-

Backend

-

Node.js · Diagnostic API

-
-
- -

- SMTP and DNS operations may communicate with external - servers or resolvers. Review the source code to understand - the connections made by each feature. -

+
+
+ MailMetrix SMTP Tester interface +

01. SMTP Tester

+

Troubleshoot SMTP connectivity and authentication against a specified mail server. Private and internal addresses are blocked by default, and only standard mail ports are allowed.

+
+
+ MailMetrix DNS Email Checker interface +

02. DNS Email Checker

+

Inspect MX, SPF, DMARC, and DKIM records associated with your domain.

+
+
+ MailMetrix Email Header Analyzer interface +

03. Email Header Analyzer

+

Examine email headers to investigate message routing and authentication information.

+
+
+ MailMetrix DKIM and DMARC Generator interface +

04. DKIM & DMARC Generator

+

Generate email authentication configuration material for review and deployment. Key generation runs off the main thread with a concurrency limit.

+
-
- -
-
-
-

Run MailMetrix yourself.

-

- Start with the public source repository and build the - application on your own machine. -

-
- -
git clone https://github.com/devindevops/mailmetrix.git -cd mailmetrix -docker compose build -docker compose up -d
- -

- Open http://localhost:50000 after the containers start. - Review the README and environment configuration before deployment. -

- - +
- - Security Policy - - +
+
+
+

Simple, containerized architecture.

+

MailMetrix separates the frontend interface from the backend API and builds the application from source.

-
- -
-
-
-

Self-hosting requires responsible configuration.

-

- Keep control of your deployment by protecting credentials, - limiting access, and understanding how diagnostic requests - are processed. -

-
- -
-
-

Protect credentials

-

- Never commit secrets. Avoid production credentials - during testing, and review application logging. -

-
+
+

Frontend

Unprivileged Nginx · Web interface · API proxy

+ +

Backend

Node.js · Diagnostic API · Not published to the host

+
+

+ Only the Nginx container is published (host port 50000); the backend is reachable only through the proxy or from the Compose network. SMTP and DNS operations may communicate with external servers or resolvers. Review the source code to understand the connections made by each feature. +

+
+
-
-

Control network access

-

- Do not expose an unauthenticated instance to untrusted - networks. Use appropriate access controls for remote access. -

-
- +
+
+
+

Run MailMetrix yourself.

+

Start with the public source repository and build the application on your own machine.

+
+ -
+

+ Open http://localhost:50000 after the containers start. Review the README and its Configuration section before deployment, especially before exposing the instance to any network beyond your own machine. +

+ + + -
-
-
-

Built in the open.

-

- MailMetrix is maintained in a public repository. - Explore the implementation, report bugs, and contribute - improvements through pull requests. -

-
+
+
+
+

Safeguards built in. Responsible hosting required.

+

MailMetrix includes protections against common abuse of a diagnostic tool, but self-hosting still requires you to protect credentials, limit access, and understand how requests are processed.

+
-
- - View Source Code - +

Built-in safeguards

+
+
+ +

Outbound connection guardrails

+

The SMTP tester validates its destination before connecting. Loopback, private, link-local, and cloud-metadata addresses are blocked, the validated address is the one connected to, and ports are limited to 25, 465, 587, and 2525 by default.

+
+
+ +

Email abuse limits

+

Sender and recipient must each be a single valid address, and subject and message length are capped. Operators can restrict recipients with ALLOWED_RECIPIENT_DOMAINS or ENFORCE_TEST_RECIPIENT.

+
+
+ +

Rate limiting

+

Every API route is limited per client IP, with stricter limits for SMTP tests, record generation, and DNS checks. Limits are configurable through environment variables.

+
+
+ +

Bounded resource use

+

DKIM key generation runs off the main thread with a concurrency cap and bounded queue. When the server is busy it answers 503 instead of stalling.

+
+
+ +

Hardened web layer

+

Nginx sends Content Security Policy and other security headers, hides its version, and strips backend framework headers. The public health probe reveals no process internals.

+
+
+ +

Least-privilege containers

+

Both containers run as non-root users with all Linux capabilities dropped and privilege escalation disabled. Base images are pinned to supported versions.

+
+
- - Browse Issues - -
+

Your responsibilities

+
+
+ +

Add authentication

+

MailMetrix has no built-in login. Do not expose it to untrusted networks without reverse-proxy authentication, an identity-aware gateway, or a private network such as Tailscale or WireGuard.

+
+
+ +

Protect credentials

+

Never commit secrets. Avoid production credentials during testing, and review application logging.

+
+
+ +

Configure the proxy chain

+

Set TRUST_PROXY to the number of proxies in front of the backend so rate limiting sees real client addresses, and use HTTPS for remote access.

+
+
+ +

Keep everything updated

+

Pinned images and dependencies do not update themselves. Rebuild regularly, and consider automated update tooling.

+
-
-
-
- + - - Maintained by - devindevops - +
+
+
+

Built in the open.

+

MailMetrix is maintained in a public repository. Explore the implementation, report bugs, and contribute improvements through pull requests.

+
+
-
+ + + +
+ +
+ + \ No newline at end of file From 39e412db82ad3d4827557ba60e361c5f40f49390 Mon Sep 17 00:00:00 2001 From: devopsgithub1234 Date: Wed, 4 Nov 2026 16:54:42 +0530 Subject: [PATCH 7/7] 1.1.2 --- backend/package-lock.json | 4 ++-- backend/package.json | 2 +- frontend/src/version.json | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/package-lock.json b/backend/package-lock.json index ceac272..3eba1d8 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -1,12 +1,12 @@ { "name": "MailMetrix-backend", - "version": "1.1.1", + "version": "1.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "MailMetrix-backend", - "version": "1.1.1", + "version": "1.1.2", "dependencies": { "dotenv": "^18.0.7", "express": "^5.3.0", diff --git a/backend/package.json b/backend/package.json index c13c6f2..0668276 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "MailMetrix-backend", - "version": "1.1.1", + "version": "1.1.2", "description": "MailMetrix SMTP and email infrastructure diagnostics backend", "main": "src/server.js", "scripts": { diff --git a/frontend/src/version.json b/frontend/src/version.json index 50ca006..a7be38f 100644 --- a/frontend/src/version.json +++ b/frontend/src/version.json @@ -1,4 +1,4 @@ { - "version": "1.1.1", - "buildDate": "2026-10-17T14:55:31.298Z" + "version": "1.1.2", + "buildDate": "2026-11-04T11:24:42.186Z" } diff --git a/package-lock.json b/package-lock.json index 87b7024..30927f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mailmetrix", - "version": "1.1.1", + "version": "1.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mailmetrix", - "version": "1.1.1", + "version": "1.1.2", "license": "SEE LICENSE IN LICENSE" } } diff --git a/package.json b/package.json index de4d76b..5e8a4d8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mailmetrix", - "version": "1.1.1", + "version": "1.1.2", "private": true, "description": "MailMetrix — SMTP, DNS and email header diagnostics workspace.", "license": "SEE LICENSE IN LICENSE",