本文へ移動
cccskills
無料GitHub で公開

csp-security-headers

Configure Content Security Policy and security headers for the portfolio

インストール方法を見る

含まれるファイル(1)

  • SKILL.md2.4 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

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

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

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

日本語の概要は準備中です。原文の説明を表示しています。

PP-Namias/Portfolio22026年10月13日 更新

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.

日本語の概要は準備中です。原文の説明を表示しています。

PP-Namias/Portfolio22026年10月13日 更新

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.

日本語の概要は準備中です。原文の説明を表示しています。

PP-Namias/Portfolio22026年10月13日 更新

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.

日本語の概要は準備中です。原文の説明を表示しています。

PP-Namias/Portfolio22026年10月13日 更新

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.

日本語の概要は準備中です。原文の説明を表示しています。

PP-Namias/Portfolio22026年10月13日 更新

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.

日本語の概要は準備中です。原文の説明を表示しています。

PP-Namias/Portfolio22026年10月13日 更新

PP-Namias のスキルをすべて見る

このスキルの問題を報告する