Skip to content

Add security headers to next.config.js #162

@Ayush-Patel-56

Description

@Ayush-Patel-56

Problem

The app has no HTTP security headers. No X-Frame-Options, no content type sniffing protection, nothing. Basic hardening for any production app.

Fix

Add headers in next.config.js:

async headers() {
  return [{
    source: '/(.*)',
    headers: [
      { key: 'X-Frame-Options', value: 'DENY' },
      { key: 'X-Content-Type-Options', value: 'nosniff' },
      { key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },
      { key: 'Permissions-Policy', value: 'camera=(), microphone=()' },
    ],
  }];
}

CSP can be a follow-up since it needs more tuning - start with these safe ones.

Metadata

Metadata

Labels

GSSOC26GirlScript Summer of Code 2026NSoC'26backendBackend / API / DB relatedenhancementNew feature or requestlevel:intermediateIntermediate level difficultytype:securitySecurity fix or improvement

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions