Skip to content

[SECURITY][MEDIUM] 'pnpm start' (serve package) serves app without any security headers #42

Description

@LucasMaupin

Summary

The start script uses the serve npm package (serve -s dist) as a production serving mode. The serve package adds no security headers by default, and the repo has no serve.json configuration file. Any deployment using pnpm start instead of the Docker image gets no X-Frame-Options, no CSP, no X-Content-Type-Options, and no Cache-Control: no-store on /env-config.js (which contains OSC_PAT). This path is documented in README.md as the local quickstart and may be used in non-Docker deployments.

CVSS Score

5.3 (Medium) — CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Category

OWASP A05 — Security Misconfiguration

Affected File(s)

  • package.json:10 ("start": "serve -s dist")

Steps to Reproduce

OPEN_LIVE_URL=http://localhost:3000 pnpm start
curl -I http://localhost:8080/
# No security headers — no CSP, X-Frame-Options, etc.

Remediation

Add a serve.json file to the repo root:

{
  "headers": [
    {
      "source": "**",
      "headers": [
        { "key": "X-Frame-Options", "value": "SAMEORIGIN" },
        { "key": "X-Content-Type-Options", "value": "nosniff" },
        { "key": "Referrer-Policy", "value": "strict-origin-when-cross-origin" }
      ]
    },
    {
      "source": "/env-config.js",
      "headers": [
        { "key": "Cache-Control", "value": "no-store, no-cache, must-revalidate" }
      ]
    }
  ]
}

Also add a note in README.md that the Docker image is the canonical production serving path.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: infrabugSomething isn't workinggood-first-issueWell-scoped, beginner-friendlypriority: P2ready-for-devHuman-triaged — safe for autonomous agent pickupsecuritySecurity vulnerabilitytriagedIssue has been reviewed and categorised

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions