---
title: "PageWeave Documentation"
---

# Security

PageWeave's security architecture ensures isolation between platform code and user-generated content.

## Domain Isolation

| Domain | Purpose | Trust Level |
|--------|---------|-------------|
| `pageweave.dev` | Dashboard, auth, API, MCP endpoint | Trusted platform code. Strict CSP. |
| `*.pageweave.site` | Hosted websites | Untrusted user HTML/JS. No platform cookies. |
| `assets.pageweave.dev` | Platform CSS/JS/fonts | Trusted static assets via CDN. |
| `auth.pageweave.dev` | Auth mail sender (SPF, DKIM, DMARC) | Sender-only; no web content. |

Same-origin policy prevents `*.pageweave.site` JS from accessing `pageweave.dev` cookies or DOM.

## Sign-in and Sessions

- Passwordless sign-in: a single-use magic link or its one-time code (10 minutes, bound to the requesting browser), or a passkey with user verification. Email is the root factor; passkeys are the phishing-resistant option.
- Sessions live server-side. The browser holds an opaque token in `__Host-auth_session`; signing out revokes the session on the server.
- Sessions last up to 30 days and end after 14 days without activity.
- Sensitive actions require identity confirmed within the last 10 minutes. A stale session re-confirms on `/auth` and resumes through an explicit Continue.
- Changing the account email requires confirmation from the new address and notifies the old one.

## Cookie Policy

- Platform cookies set on `pageweave.dev` only
- `__Host-auth_session` — `Secure`, `HttpOnly`, `SameSite=Lax`, `Path=/`, no `Domain`
- `pw_signed_in` — non-sensitive marker for the marketing header; no identity data
- No platform cookies on `.pageweave.site` parent domain

## Content Safety

### Abuse Scoring

Every published page is scored for abuse risk:

- Obfuscation techniques (eval, base64, hidden iframes)
- Content length anomalies
- Excessive external links
- Hidden content (display:none, zero-size elements)
- Spam keywords
- Suspicious links (phishing patterns)

### Indexability

Pages are live the moment they are created — there is no draft page state. The website `indexable` flag and the per-page `indexable` flag drive the generated robots meta tag and `X-Robots-Tag`; a hand-written robots or canonical tag is rejected on every write path. Draft **table rows** render only on dev environments.

## Form Spam Protection

Every form is protected by ALTCHA proof-of-work. Three tiers, settable per form version or site-wide (form setting wins):

- **standard** — invisible proof-of-work (default)
- **code** — adds an accessible image/audio code challenge
- **strict** — harder proof-of-work plus the code challenge

An adaptive shield watches failed submissions per form: under sustained attack it raises protection automatically — site-wide when several forms are hit — and returns to the configured tier once pressure subsides. Owners are notified when protection escalates or is restored. Challenge and verification endpoints are rate-limited.

### Spam Scoring and the Spam Folder

Proof-of-work stops volume, not content — so every submission also passes a content check before it is stored. Six signals score it: honeypot, submission speed, duplicate text, links, known scam phrases, and repeated characters. The score routes the submission:

- **Inbox** — delivered as usual: email notification, webhook, counted.
- **Spam folder** — kept in the form's spam tab, invisible in the inbox. No email notification, not counted — but the webhook still fires, with a `spam` block describing the verdict.
- **Discarded** — same silent success screen as every submission (senders learn nothing), but no webhook at all. Purged after 30 days; spam-folder rows after 90.

Discarded rows are kept for 30 days and quarantined rows for 90; nothing is purged without a record. Quarantined submissions are yours to decide: **Release** moves one back to the inbox and delivers the missed notification (the evidence — score and signals — is kept for your records); **Mark as spam** files a delivered one away.

One honest edge: an identical resubmission from the same visitor in a short window counts as a repeat signal. A genuine "thanks again" can land in the spam folder — release it and the notification arrives.

Human verdicts teach the site:

- **Recipient reports** — every notification mail carries a Report as spam link. It is a 90-day capability, needs no login, and quarantines the submission immediately.
- **Learned blocklist** — owner, API, and recipient verdicts build a per-site block of message templates and sender addresses. An active block quarantines the next match; a block alone never discards.
- **Release is the undo** — releasing a submission votes it back as ham, offsetting the spam votes that blocked it. Deleting the spam submission does not unblock it.

## Password Protection

Environments and release permalinks can be gated behind a shared password: humans get a localized gate page and an encrypted host-only cookie (30 days, invalidated immediately on password rotation — the cookie binds a sub-second stamp), automation passes the password as a bearer header. Passwords are stored as bcrypt digests only — never in workflow state or tool-call logs. Gated surfaces always serve `Cache-Control: private, no-store`, including granted requests and hash-marked immutable URLs. The gate POST is rate-limited. See [Password Protection](/environment-protection) for the full mechanics.

## Dashboard Protection

- `X-Frame-Options: DENY` on all `pageweave.dev` routes
- Strict `Content-Security-Policy` on platform responses: `default-src 'self' https:`, `base-uri` and `form-action` pinned to the platform origin, `object-src 'none'`, nonce-based `script-src`, and `frame-ancestors 'self'`
- Auth responses add `X-Frame-Options: DENY`, `Referrer-Policy: no-referrer`, and `Cache-Control: no-store`
- OAuth consent responses extend `form-action` with the validated client callback origin — Chromium and WebKit enforce the directive across every redirect hop after a form POST, so this keeps OAuth working in every browser
- Dev environments are separate hosts with no platform cookies; draft rows render only there
- CORS: API never allows `*.pageweave.site` origins

## Request Handling

- Unknown Host headers → 404
- Page paths: `/`-prefixed segments of letters, digits, `-`, and `_`; template pages add `:placeholder` segments — everything else is rejected at validation
- Metadata escaping in layout templates
- Rate limiting on MCP tools per account

## API Key Security

- API keys carry coarse `read` / `write` scopes; a read-only key cannot mutate
- Each key is bound to a surface — MCP, API, or both. New keys are MCP-only, so an accidental key cannot reach the REST API; OAuth tokens are MCP-only by design and `/api/v1` rejects them
- Revoke and recreate keys from the dashboard
- Audit log: all MCP tool calls recorded

## Vulnerability Disclosure

Report vulnerabilities to **security@pageweave.dev** — scope, response times, and safe harbor are in the [vulnerability disclosure policy](https://pageweave.dev/security). The policy is also served machine-readable at `https://pageweave.dev/.well-known/security.txt` ([RFC 9116](https://www.rfc-editor.org/rfc/rfc9116)).
