Skip to content

[FEATURE] add HTTP security headers #273

Description

@Nandhu2004

Feature Description

Add HTTP security headers to the application via the headers() function in next.config.ts.

Problem It Solves

Currently, the app sends no HTTP security headers, leaving it vulnerable to common web attacks such as:

  • Clickjacking — the site can be embedded in iframes on malicious pages
  • MIME sniffing — browsers may misinterpret response content types
  • Excessive data leakage — referrer headers expose more info than needed

Proposed Solution

Update next.config.ts to include an async headers() function that applies the following headers to all routes (/(.*)):

  • X-Frame-Options: SAMEORIGIN — prevents clickjacking
  • X-Content-Type-Options: nosniff — stops MIME sniffing
  • Referrer-Policy: strict-origin-when-cross-origin — limits referrer leakage
  • Permissions-Policy — disables unused browser APIs (camera, mic, geolocation)
  • X-DNS-Prefetch-Control: on — allows DNS prefetching for performance

I'd like to work on this as part of GSSoC 26. Could a maintainer please assign this issue to me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions