Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
nova-development
wobqqq/nova-aegis-csp
claude-code
csp
nova-integration
security-headers
middleware
test-double
settings-fields
aegis

Use whenever a change touches how the module meets Nova: the Nova policy and NovaAllowances, how a request is recognised as a Nova request (Util::isNovaRequest), the web middleware group, the settings fields drawn by the Aegis page (Field, FieldType), the viewAegis gate, or a new Nova release that loads scripts, styles, fonts or images differently. Use it with aegis-security for anything about the header.

Install
php artisan boost:add-skill wobqqq/nova-aegis-csp

Save this content to: .claude/skills/nova-development/SKILL.md

# Nova and this module

The module has no Nova tool, page or Vue component of its own: the Aegis core draws its settings from `CspModule::fields()` and guards them with `viewAegis`. `vendor/laravel/nova` here is the test double in `stubs/nova`, not Nova: check a behaviour in a real Nova install before relying on it, and add any Nova API the module starts using to the double first (see `package-testing`).

## What Nova needs from a policy

Read `resources/views/layout.blade.php` and `public/` of a real Nova install when Nova is upgraded (the double has neither):

- an inline theme script and the inline `createNovaApp(config)` boot script: `script-src 'unsafe-inline'`;
- the Vue template compiler used by tools (`new Function` in `vendor.js`): `script-src 'unsafe-eval'`;
- inline styles and Tailwind's `data:` SVG backgrounds: `style-src 'unsafe-inline'`, `img-src data:`;
- its fonts, scripts and API on the same origin: `'self'` for `script-src`, `style-src`, `font-src`, `connect-src`, `form-action`;
- Gravatar avatars: the default `img-src` keeps `https:`.

The required part is `NovaAllowances::REQUIRED`; the rest is the editable default in `CspModule::NOVA`. A source that cancels `'unsafe-inline'` (a hash, `'strict-dynamic'`) or `'none'` counts as missing.

## Recognising a Nova request

- `CspService::header()` uses `Laravel\Nova\Util::isNovaRequest()`: the Nova path and its subpaths, `nova-api/*`, `nova-vendor/*`, or Nova's own domain when `nova.domain` is set. Use it, never a path of our own.
- Nova's routes are in its `nova` middleware group, which contains `web`, so the middleware pushed to `web` covers both.

## Settings fields

- One `Field::table()` per scope and directive with a single `source` column; `Field::select()` for `apply_to`, `Field::toggle()` and `Field::text()` for the rest.
- The core prefixes errors by field name, so a row error keyed `site_script_src.1.source` shows under its table.
- New strings go in `resources/lang/en/csp.php`.

## Checklist

- [ ] The Aegis page still works with the Nova policy on (`HeaderTest` "sends the Nova policy to the Aegis page itself").
- [ ] A Nova upgrade that needs a new source adds it to `NovaAllowances` and the Nova default together.
- [ ] `make ready` passes.

Nova and this module

The module has no Nova tool, page or Vue component of its own: the Aegis core draws its settings from CspModule::fields() and guards them with viewAegis. vendor/laravel/nova here is the test double in stubs/nova, not Nova: check a behaviour in a real Nova install before relying on it, and add any Nova API the module starts using to the double first (see package-testing).

What Nova needs from a policy

Read resources/views/layout.blade.php and public/ of a real Nova install when Nova is upgraded (the double has neither):

  • an inline theme script and the inline createNovaApp(config) boot script: script-src 'unsafe-inline';
  • the Vue template compiler used by tools (new Function in vendor.js): script-src 'unsafe-eval';
  • inline styles and Tailwind's data: SVG backgrounds: style-src 'unsafe-inline', img-src data:;
  • its fonts, scripts and API on the same origin: 'self' for script-src, style-src, font-src, connect-src, form-action;
  • Gravatar avatars: the default img-src keeps https:.

The required part is NovaAllowances::REQUIRED; the rest is the editable default in CspModule::NOVA. A source that cancels 'unsafe-inline' (a hash, 'strict-dynamic') or 'none' counts as missing.

Recognising a Nova request

  • CspService::header() uses Laravel\Nova\Util::isNovaRequest(): the Nova path and its subpaths, nova-api/*, nova-vendor/*, or Nova's own domain when nova.domain is set. Use it, never a path of our own.
  • Nova's routes are in its nova middleware group, which contains web, so the middleware pushed to web covers both.

Settings fields

  • One Field::table() per scope and directive with a single source column; Field::select() for apply_to, Field::toggle() and Field::text() for the rest.
  • The core prefixes errors by field name, so a row error keyed site_script_src.1.source shows under its table.
  • New strings go in resources/lang/en/csp.php.

Checklist

  • The Aegis page still works with the Nova policy on (HeaderTest "sends the Nova policy to the Aegis page itself").
  • A Nova upgrade that needs a new source adds it to NovaAllowances and the Nova default together.
  • make ready passes.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels
wazza/laravel-db-encryption
hokny/laravel-generator
vonsogt/backup
jengo/queues
jeremykenedy/laravel-observability
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums