dfinity / dfinity/icp-cli

chore(docs): add Content-Security-Policy headers

Open
#470 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
115
Forks
12
Avg merge
2d 19h
Merged PRs (30d)
36

Description

The docs site currently has no CSP headers. The portal has a comprehensive CSP in its .ic-assets.json — we should add one for the docs site too.

Directives to account for:

  • script-src: 'self', 'unsafe-inline' (Starlight head scripts), Matomo domains
  • connect-src: 'self' (Pagefind), Matomo domains
  • style-src: 'self', 'unsafe-inline' (Starlight inline styles)
  • font-src: 'self' (CircularXX)
  • img-src: 'self', data:
  • default-src: 'self'
  • object-src: 'none'
  • base-uri: 'self'
  • frame-ancestors: 'none'
  • form-action: 'self'
  • upgrade-insecure-requests

Reference: portal's CSP in static/.ic-assets.json

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the portal CSP in static/.ic-assets.json with the docs site's configuration and identify where response headers are defined. Add the listed directives for Starlight, Pagefind, Matomo, fonts, images, and framing, then verify the docs site serves the expected Content-Security-Policy header without blocking its documented features.

Written by the indexing model from the issue text.

Assessment

Domain
documentation, security
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.