Skip to content

Commit c874b1e

Browse files
Improve CSP example formatting and clarity in apps specification
Change CSP code block from yaml to typescript fence, add context showing where csp variable originates (resource.\_meta?.ui?.csp), rename cspHeader to cspValue for accuracy, and remove Content-Security-Policy: prefix since the variable holds just the policy value, not a complete HTTP header. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent cd24050 commit c874b1e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

specification/draft/apps.mdx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,17 +1044,20 @@ Hosts MUST enforce Content Security Policies based on resource metadata.
10441044

10451045
**CSP Construction from Metadata:**
10461046

1047-
```yaml
1048-
Content-Security-Policy:
1047+
```typescript
1048+
const csp = resource._meta?.ui?.csp;
1049+
1050+
const cspValue = `
10491051
default-src 'none';
10501052
script-src 'self' 'unsafe-inline';
10511053
style-src 'self' 'unsafe-inline';
1052-
connect-src 'self' ${csp.connect_domains?.join(' ') || ''};
1053-
img-src 'self' data: ${csp.resource_domains?.join(' ') || ''};
1054-
font-src 'self' ${csp.resource_domains?.join(' ') || ''};
1054+
connect-src 'self' ${csp?.connect_domains?.join(' ') || ''};
1055+
img-src 'self' data: ${csp?.resource_domains?.join(' ') || ''};
1056+
font-src 'self' ${csp?.resource_domains?.join(' ') || ''};
10551057
frame-src 'none';
10561058
object-src 'none';
10571059
base-uri 'self';
1060+
`;
10581061
```
10591062

10601063
**Security Requirements:**

0 commit comments

Comments
 (0)