Security practices
The workspace is code
Whoever can change the workspace or its template sources can run SQL and serve HTML to every user. Treat workspace files, template src locations and SRC_* variables like source code: review changes and restrict who may write them.
These are written into SQL or HTML unchanged and must only come from the workspace:
- query template SQL and
${…}placeholders; fieldfxon infoj entries and stringfilter.defaultvalues;- HTML in
meta,groupmeta, thememetaandhtmlentries.
Queries
Requests never carry SQL: they name a query template and send params. In a template, %{name} becomes a query parameter which PostgreSQL substitutes safely; ${name} is written into the SQL text.[1] Use %{…} for any value a user can choose, and ${…} only for identifiers the template controls. The request middleware checks param names, not values.[2]
Give each DBS_* connection the least privilege its layers need, eg. a role with only SELECT on tables which users should not change.
Access
PRIVATErequires a login for every request; use it for instances with internal data. Without it, anonymous users reach every locale and layer withoutroles.- Restrict locales, layers and templates with roles; composition removes what a user may not access.
- Keep the default
COOKIE_PROPS(Secure; HttpOnly; SameSite=Strict):SameSite=Strictstops other sites sending requests with the user's cookie. KeepCOOKIE_TTLshort, since issued cookies stay valid until they expire; see revocation.[3] - A
tokenparam puts the token in the URL, where server logs, proxies and browser history keep it. Send tokens only from trusted clients, and prefer short-lived tokens. RATE_LIMITandRATE_LIMIT_WINDOWlimit requests per client. Add the platform's DDoS protection, eg. Vercel or Cloudflare.
Dependencies and code
- Dependency versions are managed through the pnpm catalog in
pnpm-workspace.yaml, which also lists the packages excepted from pnpm's minimum release age. Dependabot proposes updates; review them like code. - Every pull request runs the SonarQube Cloud scan and the Biome checks.
Reporting
Report suspected vulnerabilities privately through a GitHub security advisory on the repository, not in issues, pull requests or this bundle. Concepts describe how to use the system safely, not unfixed weaknesses.