Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
name: Verify
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: '24'
cache: npm
- run: npm ci
- run: npm run verify
- uses: actions/upload-pages-artifact@v5
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5
if: github.event_name != 'pull_request'
with:
path: dist
Expand All @@ -44,4 +44,4 @@ jobs:
steps:
- name: Publish
id: deployment
uses: actions/deploy-pages@v5
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ dist/
.env
.env.*
.DS_Store
security_best_practices_report.md
33 changes: 24 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ one language before the other is supported.
## Content

Write Markdown in `src/content/posts/it/` and `src/content/posts/en/`.
The repository includes one published example in each language and one Italian
draft; replace these with your own articles when ready.
The first article is available as a draft in Italian (`grill-me-prima-del-codice.md`)
and English (`grill-me-before-coding.md`).
For example, an Italian article can start with:

```yaml
Expand Down Expand Up @@ -148,10 +148,25 @@ as `<username>.github.io/blog/` requires configuring `base` and adapting interna

## Verification and dependency status

Prepared with Astro 7.3.5 on 2026-10-03. Local checks and static build pass.
GitHub deployment must still be verified in your own repository.
At preparation time, npm audit reports a high-severity advisory for the transitive
`http-cache-semantics` dependency (also attributed to Astro), with no patched version
available in npm. See https://github.com/advisories/GHSA-ch52-4w7c-c8xp.
This project publishes static files only; it does not deploy an Astro caching server.
Do not use `npm audit fix --force`, whose proposed downgrade is incompatible with this starter.
The project uses Astro 7.3.5 and publishes static files only. The lockfile resolves
`http-cache-semantics` to 4.3.0. Run `npm ci`, `npm audit`, and `npm run verify` to
check the locked dependencies and production build. Avoid `npm audit fix --force`,
which can introduce incompatible dependency changes.

GitHub Actions are pinned to full commit SHAs. When updating an Action, verify the
replacement commit in its official repository and update its version comment.

Production builds include a Content Security Policy generated by Astro. Scripts
are limited to the same origin and build-generated hashes; the initial theme
script is served from `/theme-init.js` and runs before visible page content. Inline
style attributes remain allowed for Shiki syntax highlighting, while script attributes
and arbitrary inline scripts are blocked. YouTube embeds use
`https://www.youtube-nocookie.com`, and article images may use HTTPS sources.
Check theme switching, search, code highlighting, and video embeds in a production
preview after policy changes: CSP is not enforced by Astro's development server.
Astro currently emits a generic Shiki/CSP warning even with the explicit style
attribute allowance; syntax highlighting has been verified in a production browser.

The policy is delivered through a meta tag on GitHub Pages. Directives that require
HTTP headers, such as `frame-ancestors`, must be configured at a compatible hosting
layer if needed. Local validation does not verify a deployment on GitHub Pages.
25 changes: 25 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,31 @@ export default defineConfig({
site: 'https://CodeGeeksAI.github.io',
output: 'static',
trailingSlash: 'always',
security: {
csp: {
directives: [
"default-src 'self'",
"base-uri 'none'",
"object-src 'none'",
"form-action 'self'",
'frame-src https://www.youtube-nocookie.com',
"img-src 'self' https: data:",
],
scriptDirective: {
resources: [
{ resource: "'self'", kind: 'element' },
{ resource: "'none'", kind: 'attribute' },
],
},
styleDirective: {
resources: [
{ resource: "'self'", kind: 'element' },
// Shiki uses style attributes; scripts and style elements remain restricted.
{ resource: "'unsafe-inline'", kind: 'attribute' },
],
},
},
},
i18n: {
locales: ['it', 'en'],
defaultLocale: 'it',
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions public/theme-init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(() => {
let theme;
try { theme = localStorage.getItem('code-geeks-theme'); } catch {}
document.documentElement.dataset.theme = theme === 'dark' || theme === 'light'
? theme : (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
})();
20 changes: 0 additions & 20 deletions src/content/posts/en/first-post.md

This file was deleted.

Loading
Loading