## Security rules (read before every change)
### Sign-in
- The server decides who is signed in: every api request carries a session or
token the server validates. Never trust a role, user id or price sent by the
browser.
- Session cookies are HttpOnly, Secure and SameSite; never keep a session token
in localStorage or sessionStorage. Defend state-changing requests against
cross-site requests (SameSite plus a CSRF token or a custom header).
- Sign-out ends the session on the server. MFA, password rules and lockout come
from the identity provider.
- No development sign-in, person switcher, seeded passwords or sample data in
production.
### Permissions
- Every new action gets a rule in the permission table first. Components ask
the table with the record; they never compare roles.
- The api calls the same rule before every change, and the database enforces
it with row-level security. The api's database role is bound by the policies
(no superuser, no BYPASSRLS, force row level security on).
- Nobody approves their own record. A rejection needs a written reason.
- External roles never see internal costs, margins or other clients' records,
in widgets, feeds, notifications, search and assistant answers as on pages.
- Add a test that sends each forbidden call directly and expects a refusal.
### Secrets
- Secrets live only in server environment variables: never in code, the repo,
a prompt, a log or the client bundle. Anything prefixed VITE_ is public.
- One key per purpose and environment, least rights. Rotate on suspicion.
- A secret scanner runs in CI on every push.
### Headers
- Production sets Content-Security-Policy (no 'unsafe-eval', scripts by hash,
frame-ancestors 'none'), Strict-Transport-Security, X-Content-Type-Options:
nosniff, Referrer-Policy: strict-origin-when-cross-origin, and a
Permissions-Policy that switches off what the app does not use.
- CORS allows exactly the app's origin, never *.
### Uploads and untrusted text
- The server decides a file's type by its content, allows a short list, caps
size and count, stores privately under a random name and authorises every
download.
- Never dangerouslySetInnerHTML with app data; sanitise stored HTML on the
server.
### AI, MCP and integrations
- Keys and connections have the least rights; reading is the default.
- A write from an assistant or a script waits for a person's yes in the app and
runs as that person, with the same checks. Every call is logged.
- The browser never calls the model; the model's key is a server secret.
### History and dependencies
- Every state change writes an audit entry in the same transaction; the app's
role may insert into the history, never update or delete it.
- Commit the lockfile, install with npm ci, run npm audit in CI, and justify
every new dependency.Where apps built with AI break
Coding agents handle the bugs with well-known rules. In a published test, five coding agents each built the same three apps: none of the fifteen apps had an exploitable SQL injection or cross-site scripting flaw, while improper authorization in the api was among the most common problems, and four of the agents allowed negative orders when the prompt did not rule them out (SecurityWeek, January 2026).
The pattern is easy to recognise in review. Asked for a feature, an agent adds the permission check to the screen, where it can see the result, and leaves the endpoint open. The framework's security guide says it plainly: in review, look for exactly that. Every new action needs its rule in the permission table, the same check in the api, and a policy in the database.
An agent follows the rules it reads before it writes. That is what the checklist above is for: the same rules the guide asks a reviewer to check, written as instructions the agent sees at the start of every task.
What Meadowstack 2.1 does today, and what 3.0 adds
The line in 2.1 is simple: the framework is a front end and a set of rules. It makes the safe thing the easy thing in the interface, and it cannot enforce anything in your backend, database, deployment or secrets.
| Area | Meadowstack 2.1 today | Your app | Meadowstack 3.0 |
|---|---|---|---|
| Sign-in | A stub for development in the starter: seeded people, any password | A real identity provider and a session the server validates | Magic link or password, TOTP and passkeys, session timeout |
| Permissions | One table per module, can(), <Can>, NoAccess; actions hidden | The same rules in the api and with row-level security | One policy file that generates the database policies; a test fails on a table, role or action without a rule |
| Input | Shared validation functions | Check every input again on the server | One schema per form or endpoint, checked on the client and the server |
| Secrets | None in the kit; the agent settings deny reading .env | Server environment variables, a scanner in CI | A check fails when a secret lands in the repository or the bundle |
| Headers | None | CSP and the headers in the guide | CSP, HSTS, frame-ancestors 'none', nosniff, referrer and permissions policies |
| History | AuditTimeline; the recipes write an entry per state change | Append-only, in the same transaction | Sign-ins, permission changes, exports and deletions recorded |
3.0 arrives as an update to every licence. Until it does, everything in the "Your app" column is yours, and the checklist is how you hand it to the agent. The full split is on the security page.
Sign-in and permissions first
Two items come first in the list, because the published test above and the security guide both single them out.
The development sign-in ships. The starter signs people in with a stub so you can build and test roles without an identity provider: a few seeded people, any password, the session in sessionStorage. It is not authentication, and its own page says so. Before go-live, search the project for the stub and the demo helpers and confirm none of them is in the build.
The permission check lives only on the screen. The browser is not trusted; anyone with the developer tools can call the api with any record's id. Each rule is asked three times from one source: by the screen, by the api before every change, and by the database with row-level security. The api must connect as a role the policies bind, or every policy is skipped without an error. The screen side of this, from hidden actions to four-eyes, is on the permissions pattern.
To check it on a running app, use the permissions checklist: each check comes with a request you send by hand and the refusal you should see.
Secrets, headers and uploads
Secrets. With Vite, every variable whose name starts with VITE_ is compiled into the bundle and is public. The browser needs a public api address and at most a public key; a database password, a service key, a model key or a webhook secret never goes near it. A key that has been in a commit, a log or a chat is leaked, whatever the repository's visibility. That includes pasting it into a chat with a coding agent.
Headers. The framework sets none, because it does not run your server. The guide gives a Content Security Policy tried against the demo's production build: scripts allowed by the hash of the one inline theme script, style-src 'unsafe-inline' because three dependencies add style elements at run time, object-src 'self' because PDFs preview in an <object>, and never 'unsafe-eval'. Try a change with the console open, or in report-only mode on a live app.
Uploads. The kit hands over File objects; the browser's checks are for the person, the server's are the ones that count. Decide the type by the content, not the name: the kit's fileKindOf guesses from the extension to pick an icon and must never allow a file. Store privately under a random name and authorise every download.
AI, MCP and the audit trail
An app with an assistant or an MCP server gives a model a way in. The rules that keep it safe are about rights, not about the model:
- Least rights. Every connection and key reads by default; writing is a separate choice, and a key never has more rights than the person who made it.
- A person confirms. A write from an assistant or a script waits for a yes in the app and runs as that person, with the same permission checks. A misled assistant can then do no more than its user, which is the practical defence against prompt injection.
- A log. Every call is recorded: who or what, which tool, the result.
- Keys are generated on the server, shown once, stored hashed and revocable. The browser never calls the model.
The audit trail closes the loop: written in the same transaction as the change, append-only for the app's database role, and never a place for passwords, tokens or more personal data than the event needs.
How to use the list
- Paste the checklist into
AGENTS.md(Claude Code, Cursor and Codex read it before they write; see AGENTS.md) or at the top of the prompt for a feature. - Delete the lines that do not apply, and name your stack where the list is general: your identity provider, your host's header file, your storage.
- After each feature, ask the agent which rules the change touched and where the test for each one is.
- Before go-live, walk the ten checks in the excerpt above yourself. The last one matters most: a person who is not the author clicks through every role.
The list does not make an app compliant with any law and is not a penetration test. An app that holds personal or financial data deserves a review by someone who did not build it.
The go-live list the rules come from
1. The stub sign-in and every demo helper are gone; a real identity provider is in.
2. Every action in the interface has the same check in the api and the database;
a test tries the forbidden calls directly and expects them to fail.
3. The api's database role is bound by row level security.
4. No secret in the repository, in its history, or in the bundle; a scanner runs in
CI.
5. The headers above are set, and the content security policy was tried with the
console open.
6. Uploads are validated, stored privately and served safely.
7. Keys, connections and the MCP server follow the rules above, and the log works.
8. The audit trail is written in the same transaction and cannot be edited.
9. Dependencies are audited and there is a process for updates.
10. `npm run check` and `npm run e2e` pass, and a person who is not the author has
clicked through the roles.Questions
Where should these rules go so an AI coding tool follows them?
In AGENTS.md at the root of the project, which Claude Code, Cursor and Codex read before they write, or at the top of the prompt for a feature. Then ask for a test for each rule a change touches, so the next feature cannot quietly undo it.
What is the most common security bug in vibe-coded apps?
A permission check that exists only on the screen. In a published test of five coding agents, improper authorization in the api was among the most common problems, while none of the apps had an exploitable SQL injection or cross-site scripting flaw.
Does Meadowstack handle sign-in and server-side checks today?
Not in 2.1. It ships the interface side: permissions in one table per module, hidden actions, NoAccess, confirmations, reasons for rejections and the history of every change. The starter's sign-in is for development only, and the backend is yours. Meadowstack 3.0 adds sign-in, server-side input checks, one policy file and strict headers, as an update to every licence.
Can I put an API key in a VITE_ variable if the repository is private?
No. Everything prefixed VITE_ is compiled into the client bundle and anyone who opens the app can read it. Secret keys belong in server environment variables only; the browser gets at most a public key.
Is a ticked checklist enough to go live?
It covers the failures that come up most, not everything. Run the forbidden requests yourself, have someone who is not the author click through every role, and for personal or financial data get a review by someone who did not build the app.
Two ways
Build it yourself, or have it built
Build it yourself
Build your app on the framework
Get the codebase these apps stand on and build yours with Claude Code, Cursor or Codex.
One payment, lifetime updates
Get the frameworkHave it built
Have us build your app
Tell us how your team works. We plan the app with you and build it on the same framework at a fixed price.
After launch, Care keeps it improving, from €99 a month.
from €1,990
Describe your app