Skip to content
cccskills
FreePublished on GitHub

csp-security-headers

Configure Content Security Policy and security headers for the portfolio

The English summary is being prepared. Showing the original description.

Works withCloudflare
See how to install

Files included (1)

  • SKILL.md2.4 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

CSP Security Headers Skill

Configure Content Security Policy (CSP) and security headers for the portfolio.

When to use this skill

  • Adding new external scripts or styles
  • Adding new iframes or embeds
  • Troubleshooting CSP violations
  • Updating security headers

Current CSP

default-src 'self';
script-src 'self' 'unsafe-inline' 'unsafe-eval' https://va.vercel-scripts.com https://challenges.cloudflare.com;
style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;
img-src 'self' data: blob: https://cdn.sanity.io https://images.unsplash.com;
font-src 'self' https://fonts.gstatic.com;
connect-src 'self' https://4bg9jxr4.apicdn.sanity.io https://api.sanity.io https://challenges.cloudflare.com;
frame-src https://challenges.cloudflare.com;
object-src 'none';
base-uri 'self';
form-action 'self';

Adding new external resources

New script domain

  1. Add domain to script-src in next.config.ts security headers
  2. Test that the script loads
  3. Check browser console for CSP violations

New image domain

  1. Add domain to img-src in next.config.ts
  2. Test that images load
  3. Check for mixed content warnings

New iframe domain

  1. Add domain to frame-src in next.config.ts
  2. Test that the iframe loads
  3. Check for CSP violations

Files

FilePurpose
next.config.tsSecurity headers configuration
src/middleware.tsMiddleware that applies headers
public/.well-known/security.txtSecurity.txt with contact info

Common CSP violations

"Refused to load the script"

  • Domain not in script-src
  • Check for typos in domain name

"Refused to load the image"

  • Domain not in img-src
  • Check if image is data: URL (needs data: in CSP)

"Refused to connect to"

  • Domain not in connect-src
  • Check if API endpoint is correct

"Refused to frame"

  • Domain not in frame-src
  • Check iframe src attribute

Testing CSP

  1. Open browser DevTools
  2. Go to Console tab
  3. Look for CSP violation messages
  4. Add missing domains to CSP

Checklist

  • New external resources have matching CSP entries
  • No unsafe-inline for scripts unless necessary
  • No unsafe-eval unless necessary
  • object-src 'none' maintained
  • base-uri 'self' maintained
  • form-action 'self' maintained

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Audit and fix accessibility issues across the portfolio to ensure WCAG 2.1 AA compliance.

The English summary is being prepared. Showing the original description.

PP-Namias/Portfolio2Updated Oct 16, 2026

Creates a new blog post document in the Sanity studio. Use when the user wants to write a blog post, publish an article, or schedule a future post.

The English summary is being prepared. Showing the original description.

PP-Namias/Portfolio2Updated Oct 16, 2026

Creates a new certification document in the Sanity studio. Use when the user wants to add a credential, certificate, or professional accreditation to the Certifications collection.

The English summary is being prepared. Showing the original description.

PP-Namias/Portfolio2Updated Oct 16, 2026

Adds a new skill MD file to the studio's skills collection. Use when the user wants to author a new step-by-step recipe for the studio's in-app Skills tool or the .agents mirror.

The English summary is being prepared. Showing the original description.

PP-Namias/Portfolio2Updated Oct 16, 2026

Creates a new project document in the Sanity studio. Use when the user wants to add a new portfolio project, a case study, or a work sample to the Projects collection.

The English summary is being prepared. Showing the original description.

PP-Namias/Portfolio2Updated Oct 16, 2026

Creates a new experience document in the Sanity studio. Use when the user wants to add a job, role, internship, or work history entry to the Experience collection.

The English summary is being prepared. Showing the original description.

PP-Namias/Portfolio2Updated Oct 16, 2026

See all skills by PP-Namias

Report a problem with this skill