Skip to content

Security ​

Reporting a vulnerability ​

Please report vulnerabilities privately through GitHub private vulnerability reporting, not as public issues. Include steps to reproduce and the affected version or commit. You will get an acknowledgement within a few working days, and a fix and advisory are coordinated with you.

Supported versions: the latest release and the main branch.

Security model and review ​

This document describes how pgkiln authenticates users, authorizes access and protects data. It also records the findings of the security review of the first version (MVP). Every finding below has a regression test in test/security.test.ts.

Layers of defence ​

LayerMechanism
Database roleThe runtime connects as pgkiln_runtime (NOINHERIT). It can read metadata and manage sessions, but cannot read meta.developer, password hashes or meta.instance_setting. It can reach an application's data only through SET LOCAL ROLE <app db_role>.
Application role ("parsing schema")Every request runs in a transaction as the app's db_role. Postgres grants decide what the app can touch at all.
Row level securitymeta.app_user() and meta.has_role() expose the signed-in application user to SQL, so RLS policies (and triggers, audit logs) know who is acting, not just which database role.
AuthenticationLocal accounts: bcrypt (pgcrypto) behind the meta.authenticate() SECURITY DEFINER function, constant work for unknown users, throttling per user and per IP. Single sign-on: OpenID Connect with PKCE, browser-bound one-time state, nonce, JWKS signature, issuer/audience/expiry checks and linking by subject (an existing account of the same name only when the provider allows it, and with the e-mail claim only when verified); SAML 2.0 with signed assertions only, issuer, audience, recipient, validity and one-time InResponseTo, the same browser binding (a same-site re-post, since the IdP's cross-site POST carries no Lax cookie). LDAP: search, then bind as the user (empty passwords refused, RFC 4515 filter escaping), write-only service password. "Keep me signed in": a rotating one-time token (SHA-256 stored, owner-only), fixed expiry, access re-checked on each use, ended by sign-out, new password, deactivation or removed access. Session rotation on every sign-in.
Authorization schemesOn pages, regions, items, buttons, processes, dynamic actions and navigation entries. They are role based or SQL based and fail closed when unknown.
REST API (PostgREST)Tokens are HS256 JWTs (shared API_JWT_SECRET) or identity-provider tokens. PostgREST switches to the app's API role (never one that bypasses RLS). meta.api_check() runs before every request and rejects tokens of inactive accounts or accounts without access; roles are read live. Only the api schema is exposed; the anonymous role has no privileges.
PasswordsPassword policy (length, letters and digits, no username), expiry and change on first use enforced before a session exists; changing a password needs the current one and ends other sessions.
ApprovalsTask tables are closed to application roles; meta.tasks and the meta.*_task functions check, for every call, who may see, claim, decide, delegate or cancel (one rights function for both). Initiators can't decide their own requests unless the definition allows it. The completion SQL runs as the application's role in the same transaction, so RLS applies and an error undoes the decision.
WorkflowsSteps run as the application's role (grants and RLS apply), variables are binds (escaped literals), the instance tables are closed to application roles; only initiators and administrators see a workflow, terminate it, and only administrators retry.
REST modulesBearer tokens only (HS256 with API_JWT_SECRET, the app claim must match; no cookies, so no CSRF), the account (active, access) or OAuth client (not revoked) checked on every request, handler roles via meta.has_role(), SQL as the application's role (RLS) with every value a bind; :APP_USER, :APP_ID and the other built-in binds come from the server, never from the request. Handlers (SQL, PL/pgSQL and media) refuse with 403 to run as a superuser, a role with BYPASSRLS or a member of pgkiln's owner, so a missing db_role on the owner connection can't turn an endpoint into owner access; the Advisor reports this as an error. PL/pgSQL handlers get request values as transaction-local settings (meta.rest_param), never as SQL text, inside a dollar-quote tag the body may not contain.
Progressive Web AppsOff by default, per app. Kept pages (opt-in) are removed at every sign-in and sign-out; forms kept offline are sent only for the user who filled them in, with a fresh CSRF token, and processed at most once (submission ids); the record a form was opened for is signed with the form. Permissions-Policy allows camera and geolocation for the application itself only (camera=(self), microphone=(), geolocation=(self)).
Outgoing web requests (REST data sources)Off until PGKILN_REST_ALLOWED_HOSTS lists hosts. Only http/https without user:password; the resolved address is checked at connect time and is the one connected to (no DNS rebinding); private, loopback, link-local (cloud metadata), CGNAT, multicast and documentation ranges are refused, also as IPv4-mapped, NAT64 and 6to4 addresses, unless the host is in PGKILN_REST_PRIVATE_HOSTS; at most 3 redirects, each re-checked, credential headers dropped when a redirect leaves the origin; time and size limits (also after decompression). Parameter values are URL-encoded after a fixed host (./.. refused), header values are one line, and Authorization, Cookie, Host and transport headers can't be set on a source. Response values reach SQL as one escaped literal through jsonb_to_recordset with checked column names, as the app's role.
Web credential secretsEncrypted with AES-256-GCM using PGKILN_SECRET_KEY, which lives outside the database (a dump alone reveals nothing); write-only in the builder, never exported, logged or shown in errors; the runtime role's column grant leaves out secret_enc. Changing the key means entering the secrets again.
Page logicComputations, branch conditions and badge SQL run as the app's role in savepoints with binds as literals; a PL/pgSQL function body becomes a pg_temp function behind a random dollar-quote tag (a body containing it is refused). URL branches are checked in the database (no scheme, //, \, .. or control characters) and item values in them are URL-encoded, so a branch can't leave the app. A menu entry's request counts as a button only when the menu button is visible and the entry's authorization passes; a real button of that name keeps its own checks. Components of excluded build options are not rendered, run or accepted (an excluded page is a 404).
Calendar drag and dropThe move route checks the CSRF token first, then a signed-in user, page and region authorization and conditions and the region's who may drag scheme; the event must be in the region's query for this user (app role, RLS). The browser sends only an event key (≤ 200 characters) and a date-checked slot; new start and end reach the developer's move SQL as literals. Refusals and moves are logged.
Facets and smart filtersSearch terms, facet values and range bounds are query parameters, never SQL text; bounds are checked against the column type, only a facet's own ranges are accepted unless it allows a custom range, column names are checked against the report and quoted, NUL bytes are dropped, and the number and size of filters is limited. Facets of regions the user can't see don't filter, and such regions get no display-selector tab.
Lazy regions and the region cacheThe lazy region endpoint needs the app's session, re-checks page access and the region's condition and authorization, serves only lazy regions of that page (403 otherwise), never writes session state and answers no-store. Cached regions are keyed by a SHA-256 of the app, page, region definition, language, roles, visible regions, the query string and the values of every bind and substitution the region uses; the scope adds the session or user, and "all" is shared only between users with the same roles and sign-in state. CSRF tokens are filled in per request, regions with per-user checksum links aren't shared, and regions with errors aren't cached. Page numbers, sizes, row limits and cache durations are clamped on the server.
Popup LOV searchPOST …/lov/:item/search needs the CSRF token and the app's session, re-checks page access and that the item is a popup LOV on that page the user may see and edit; the term is a bind parameter (wildcards escaped, at most 200 characters), page size 1–100, run as the app's role; a posted value must be one the list returns.
Header authenticationTrusted only when the socket's own peer address is in PGKILN_AUTH_HEADER_PROXIES (X-Forwarded-For and TRUST_PROXY play no part); untrusted peers get 403 and a login_failed entry. Values are 1–100 printable ASCII characters without spaces, colons or commas, a repeated header is refused, a changed header ends the session and a missing one signs out. Deactivated accounts and users without access are refused; automatic accounts get access to that app only. Password, SSO and "keep me signed in" are off for header apps.
Database-account authenticationThe password is checked only by PostgreSQL itself: one short-lived connection as that role to pgkiln's own database (5 s timeout, so pg_hba.conf, VALID UNTIL, NOLOGIN and connection limits apply); pgkiln never reads pg_authid and never stores or logs the password. Only roles listed for the app or members of its membership role; nothing listed means nobody; superusers and pgkiln's own connection roles are always refused. Sign-in throttling and the activity log as for other types.
Keyset pagingThe position in r<id>_k is signed (HMAC) per region and bound as query parameters; unsigned, foreign, oversized or ill-typed positions fall back to offset paging.
Interactive grid (0.23.0)Master row selection links carry an HMAC bound to app, page, user, region and value; unsigned or foreign selections are ignored, and the item can't be set by a submit or an unsigned URL. GET …/region/:id serves only lazy regions or details of a visible master after page access and region checks. Layout, reset and apply routes check the CSRF token, page access and that the region is a visible grid with its Actions menu on; layouts are cleaned on the server (identifiers, widths 40–1000, at most 5 frozen columns, 6,000 characters) and only reorder columns the query returns. A detail grid's master column is never editable and comes from the session; inserts without a selection are refused.
Page logic (0.23.0)Download queries run as the app's role (logged as download); files are sent with nosniff, a sandbox CSP and no-store, names and types cleaned, at most 1,000 files and 100 MB. Function branches run as the app's role with binds as literals; a path outside the app is refused and logged forbidden. Branches to another app go only to an existing page whose build option is on, with items signed for that app, page and user; its own authentication applies. meta.enqueue_process_job queues only chains of the current app, under the current user and session roles; passwords are left out of a job's binds and request-bound process types are refused in the background; meta.process_jobs (security barrier) shows users only their own jobs. Workflow terminate and retry are checked in the database. dialog_closed accepts only same-origin messages with a numeric page.
Globalization (0.23.0)Time zones from the browser, the sign-in form, My account and the builder are accepted only as an exact pg_timezone_names name (64 characters at most) and reach SQL as a bound set_config(…, true) (transaction-local, so pooled connections are unaffected); check constraints back this up, also for the currency (^[A-Z]{3}$). POST /a/:alias/tz needs the CSRF token and changes only that session. Mask literals and currency symbols are escaped; invalid or over-long masks fall back to the plain value; number input is capped (200 characters, 4-digit exponents, no NaN/Infinity), and number items refuse text that isn't a number.
SQL and Data Workshop (0.23.0)SQL Scripts, Quick SQL and the query builder need a builder session and the CSRF token and run on the owner connection like SQL Commands, on a separate connection closed afterwards. The query builder only uses catalog names, a fixed operator list and literals. The XML reader refuses <!DOCTYPE> and entity declarations (no XXE or entity expansion), limits nesting and element counts, and fetches nothing. Data load definitions: table names checked by a pattern and a constraint, resolved with regclass and quoted; masks become literals and values parameters; processes see only their own app's definitions and load as the app's role.
Custom authentication (0.23.0)The check runs as the app's role (pgkiln's tables out of reach) in a temporary function with a random dollar-quote tag; the password is only a bind parameter and never logged; failures are logged by SQLSTATE only, and an error, false or null all give the same "invalid" answer and count towards throttling. Post-authentication code can refuse a sign-in. No remember-me, SSO, LDAP or password change for these apps; with nothing configured nobody can sign in.
Lists (0.23.0)Entry URLs are limited to a path in the app or http(s) (a check constraint, and again after substitution and for query rows); external links get rel="noopener noreferrer"; links with item values carry the checksum; entries are hidden by authorization, condition, build option and access to the target page; query lists run as the app's role.
Builder locks and supporting objects (0.23.0)Page and application locks are enforced on the server for every builder POST (423 for JSON); only the owner or an administrator unlocks, an administrator breaking a lock is logged (lock_broken), and only administrators manage developers (nobody demotes themselves). Supporting objects never run on import; running them needs a developer session and the CSRF token, runs as the app's role in one transaction (600 s per statement) and is logged (supporting_objects). Comments are escaped and length-limited; locks and comments are not exported.
Automations (0.24.0)The action table is closed to application roles; meta.automation_begin/automation_end are security definer functions limited to the current app (meta.app_id()). meta.run_automation() runs synchronously in the caller's transaction as the caller's role, only for the current app, with the automation's roles and the user automation:<name> while it runs (treat those roles like a security definer function's); row values become escaped literals; per-row errors are kept in the run log.
Workflow invoke API (0.24.0)Only the app's own REST data sources and web credentials; the host is fixed by the developer (no substitutions in it, values URL-encoded after it) and goes through the same allow-list and SSRF checks as the invoke-API process; step fields are checked again before each call; no transaction stays open during the call (a lease guards the result); a response can't overwrite DETAIL_PK, WORKFLOW_ID or INITIATOR; secrets never reach variables, events or errors.
Unload Data (0.24.0)Developer session and CSRF like SQL Commands; its own owner connection in a read-only transaction with UNLOAD_STATEMENT_TIMEOUT, closed afterwards; exactly one SELECT/WITH/VALUES/TABLE statement (a guard against mistakes, not a boundary: developers can already run any SQL); rows capped by DOWNLOAD_MAX_ROWS; logged as sql_unload.
Create page wizards (0.24.0)Option column names must be columns of the table and reach SQL only as quoted identifiers; table names are schema-qualified; types, functions and icons come from fixed lists; meta, pg_* and information_schema are refused. The functions run as the caller and are revoked from PUBLIC; builder routes need a developer session, CSRF and respect the app lock. Generated calendar drag and drop is off by default and runs as the app's role (RLS); set move_authz to limit who may move events.
Create application from a file (0.24.0)Developer session and CSRF on both posts (also the upload); the temporary file belongs to the uploading builder session and is deleted after use; table and column names are lower-case identifiers, quoted, always in the new app's schema; types from a fixed list; values are escaped when shown. The new role gets privileges on its own schema and table only. meta, information_schema and pg_* are refused as a parsing schema (also for blank apps).
Charts (0.25.0)Gantt, pyramid and polar queries run as the app's role (RLS); labels and values are escaped in the SVG and its data table; the chart kind comes from a fixed list; Gantt dependency ids are only used as lookup keys; drill-down links carry the checksum.
Map layers (0.25.0)Each layer's query runs as the app's role (RLS); links only go to pages the user may open; names and texts travel as escaped JSON or HTML and popups are built with DOM methods. r<id>_near and r<id>_bb are parsed into range-checked numbers before they reach SQL and only narrow the rows a user can already see. With PostGIS, the app role needs USAGE on the PostGIS schema.
REST write-back and synchronisation (0.25.0)Operation paths are checked (no host, .., : or //), values are URL-encoded and the host stays the source's; allow-list, SSRF and credential URL checks on every call. OAuth2 passwords and refresh tokens are encrypted, write-only, out of the runtime role's reach, never exported or logged. Grids only send writable columns. Synchronisation writes as the app's role (grants, RLS); meta.request_rest_sync() acts on the current app only. There is no transaction across web-service calls: a grid save that fails halfway leaves earlier rows sent.
Debug messages (0.25.0)Application roles and the runtime role have no rights on the debug tables (security definer functions for the runtime only). The viewer needs a developer session and CSRF and shows a request only under its own app; any developer can read any app's debug messages. Password items and URL query values are never recorded; item values only at level 9, cut at 200 characters; database error messages may quote values. The Installation page is for administrators only.
meta.web_request() and meta.parse_data() (0.25.0)Requests from SQL go through the allow-list, SSRF, redirect, size and credential URL checks of the other outgoing calls; headers are filtered when queued and again before sending; app authentication headers are dropped on cross-origin redirects; secrets never reach the log or SQL. The log is closed to application and runtime roles; the security definer functions act on meta.app_id() only and the server only takes requests queued in the caller's own transaction. A response belongs to the app, not to a user: any of the app's code with the id can read it. parse_data runs as the caller, at most 1,000,000 rows; XML is refused.
Theme Roller (0.25.0)Only checked #rrggbb colours and fixed constants become CSS, checked again on every render (a hand-edited bad style is skipped); style names are escaped; lookups use own keys only. Switching a style needs CSRF and a safe return URL and only accepts the app's own styles; the runtime role can only touch meta.account_style. The Theme Roller needs a developer session and CSRF and respects app locks. Template options are shape-checked in the database and only classes from the fixed lists are rendered; no inline styles. (0.31) A style's condition runs as the application's role with bind variables (an error counts as false); a colour from an item (&ITEM.) is written only when its value is #rrggbb.
Working copies (0.26.0)Developer session and CSRF on every change; copy names are checked and all output is escaped (differences too). A merge is refused while another developer has locked the target application or a page it changes, and when either side changed after the comparison was shown (a fingerprint of the comparison). Merges go through the same in-place import as pgkiln import --replace, in one transaction. A copy runs against the main application's schema, role and data, with the same users (by design) and without automations or synchronisations; meta.working_copy is closed to the runtime role. Any developer can merge any copy (no per-application developer rights, as elsewhere).
Application types and subscriptions (0.26.0)Developer session and CSRF on every change; only components that a theme or library application offers can be subscribed to (the kind comes from a fixed list, so no table name reaches SQL from the form); the subscriber's application lock is respected and publishing skips subscribers locked by another developer; the redirect back is only to the subscriber's own Shared Components page. Starting from a boilerplate copies its definition only (no access, secrets or data) and keeps the new application's role and authentication. meta.subscription is closed to the runtime role.
Data Reporter (0.27.0)Reports run as the application's role (grants and RLS apply, so a shared report shows each user their own rows). Every definition, from the URL or stored, is checked again before it runs or is saved: only offered columns the role can read, whitelisted operators and functions, sum and average on numbers only, bounded counts and lengths; identifiers are only the developer's and quoted, values are escaped literals. Sources in meta, pg_* or information_schema are refused in the builder and ignored at runtime. Saving and deleting need the CSRF token, a signed-in user, page access and a visible region; security definer functions only change the user's own reports; the runtime role has no direct rights on meta.data_report.
Sample data (0.27.0)Developer session and CSRF; runs on the owner connection like SQL Commands (triggers run, RLS does not apply), in one transaction with SAMPLE_DATA_STATEMENT_TIMEOUT and at most SAMPLE_DATA_MAX_ROWS rows and 50 tables per run; meta, information_schema and pg_* refused (also by a check constraint on saved definitions). Table and column names are looked up in the catalog and quoted, values are bound (the SQL download escapes them); output is escaped; each insert is logged (sample_data); generated e-mail addresses use reserved example domains only. Saved definitions are closed to the runtime role.
Create application from several sheets, pasted data or existing tables (0.27.0)Developer session and CSRF; pasted data is a temporary file owned by the builder session; names are validated and quoted, keys are chosen column indexes, foreign keys are recomputed on the server and only proposed ones applied; meta, information_schema and pg_* are refused as parsing and source schema, and posted table names are only matched against a fresh catalog lookup; one transaction. An application made from existing tables gets the blank application's grants on every table of that schema.
AI services (0.28.0)Administrators only configure services (anonymous → sign-in, other developers 403, CSRF); API keys are encrypted with PGKILN_SECRET_KEY, write-only, never exported, logged or shown; all AI tables are revoked from public and the runtime role. Model, base URL and limits are checked; models are never changed silently. Item values go into prompts as escaped <data> text marked as data, never instructions; session ids and password items are never sent. Answers only become item values and are escaped when shown. Usage is logged without prompt or answer text (except at debug level 9). Data in prompts leaves the instance for the chosen provider. AI calls don't use PGKILN_REST_ALLOWED_HOSTS: only administrators set the base URL.
AI assistant, NL2IR (0.28.0)CSRF and region visibility are checked before any AI call; assistants are for signed-in users unless marked public. Conversations belong to one session and region, are deleted with the session and are closed to the runtime and application roles. Context queries and tools run as the app's role (grants, RLS): arguments are bound literals checked against the declared parameters (unknown arguments refused), each tool is one subquery with a row limit and a 15 s timeout and is rolled back unless the developer marks it as writing; tools can be limited by an authorization scheme; REST tool arguments are never &ITEM.-substituted. Natural-language report filters only produce filters a user could set by hand, on visible columns. Answers are escaped (paragraphs, lists, bold, code only). A writing tool lets the model change data on the user's behalf within the role's rights: design those with care.
App Builder AI and blueprints (0.28.0)Developer session and CSRF; only administrators choose the builder's AI service. Generated SQL is shown, never run automatically; page proposals are checked (page types, tables the app role can read, free page numbers) and created only after the developer confirms. The model sees names, types and keys, never rows. A blueprint is validated (identifiers, references, rows) and turned into quoted SQL; Create only accepts the exact text the review showed, signed with the developer's session, in one transaction. meta.builder_ai, meta.ai_table_note and meta.blueprint are closed to the runtime role.
Workspaces (0.29.0)Every builder request under /apps/:id or /pages/:pid (GET and POST), a working copy's main application, a boilerplate and the code editor's application are checked against the developer's workspaces in developer() and answer 404 outside them; lists are filtered by the current workspace. Switching needs CSRF and membership; managing workspaces needs an administrator and CSRF; names are escaped; subscriptions only reach theme and library applications of the same workspace. Workspace tables are closed to the runtime role. A shared workspace is not a tenant boundary: its SQL Workshop runs as the owner and its application code on the shared runtime connection; isolate a workspace for that (below).
Isolated workspaces (sprint 60)The boundary is the PostgreSQL login (session_user, which SQL can't change): an isolated workspace's applications run on its own run login and its developers' SQL on its own developer login (src/workspace-db.ts; passwords derived from PGKILN_SECRET_KEY, never stored), so RESET ROLE or set_config('role', …) only reach that login. The run login has pgkiln_app_code (the runtime role's rights in meta, kept in step after every migration by meta.sync_app_code_grants(), checked by a test) and the workspace's roles; the developer login only the workspace's roles. Row-level security on every meta table the runtime reads keys on the login (meta.visible_apps()), both ways: isolated workspaces don't see others, the shared runtime doesn't see isolated ones; the owner isn't affected. meta.app_id() and the eight functions that take an application id (meta.checked_app) refuse an application the login may not see. A workspace's database roles are an administrator's list (meta.workspace_role): an application there may only run as one of them, a role belongs to one workspace, and superusers, roles with CREATEROLE/BYPASSRLS/REPLICATION and pgkiln's own roles are refused; memberships follow by triggers (meta.workspace_sync_roles()). A new application gets a new role and a new or own schema. Every builder tool that runs a developer's SQL uses the workspace's developer login (workshopDb, devDbForApp); the import check plans the imported SQL on it, outside the import's owner transaction. Saved scripts, runs, blueprints and generators are per workspace. Not covered: administrators and developers who also belong to a shared workspace (owner rights there), the pg_catalog (definitions are readable by every login), PostgREST (one authenticator), identity providers, LDAP, mail and AI services (installation-wide).
Builder screens like APEX's (sprint 61)The sign-in page's workspace is checked after the password (only the developer's workspaces; a wrong one answers like a wrong password, failures are throttled and logged as before); Remember workspace and username is an HttpOnly cookie for /builder holding no secret, read defensively and escaped; the redirect after sign-in is a /builder path only. Workspace message and banner: administrators and the workspace's administrators, CSRF, plain text escaped, the banner colour from a fixed list. Utilization: the same. SQL Workshop home: your own recent commands only (by id and username), the schema checked against the schemas the session's connection may use (and set as a parameter of set_config). Application groups: every query bound to the current workspace; groups and applications of other workspaces are ignored. App Gallery: keys are names from examples/gallery/gallery.json, never paths; sample apps (shipped SQL as the owner, demo accounts with known passwords) are for administrators only; starter apps go through the blueprint review and its signed create step. Cross application reports: fixed SQL per topic, the workspace id as a parameter.
Workspace preferences, extension links, Manage backups (sprint 62)Preferences and links: administrators and the workspace's administrators, CSRF, logged. The SQL Workshop preference is checked in developer() for every /builder/sql GET and POST before a route runs, so no SQL Workshop route can skip it; it is not a sandbox (a developer of several workspaces uses it in another; isolation is the boundary). RESTful services off: the module lookup answers 404 before authentication or any handler SQL. Extension links: only http:///https:// URLs without spaces, quotes or angle brackets (checked in Node and by a CHECK constraint), escaped, opened with rel="noopener noreferrer". Manage backups: only the current workspace's applications, through the existing meta.backup_app. SQL Workshop utilities: fixed catalogue SQL chosen by a key from a fixed list (own-property lookup), run read only with a statement timeout on the SQL Workshop's connection (an isolated workspace's developer login sees only its roles' schemas); the Database Monitor shows other sessions' query texts, so it is for administrators only and cancels nothing.
Approval vacation rules and expiration (sprint 64)A vacation rule is always the signed-in user's own (meta.app_user() in a security-definer function; no user field is read from the form); its table is closed to the runtime roles; the delegate's rights are computed in meta.task_rights on every call and only for tasks the user owns by name or is assigned (never role ownership), so they end with the rule. Dates are checked as dates; CSRF and an in-app next. The expiry tick runs as the owner from the scheduler only (no grant).
Blueprint from an application (sprint 66)Builder only, CSRF; the application must be in the developer's current workspace (administrators: any). The catalog is read as the owner but only for tables the application's database role may SELECT, never meta. Sample rows are opt-in (the page warns about personal data), read in a read-only transaction with a statement timeout through devDbForApp (an isolated workspace's developer login), at most 20 per table. The result only fills the editor: creating still goes through the signed review.
Drawers, built-in template components, Theme Roller additions (0.29.0)Dialog positions and sizes, base styles, dark-mode colours, item and report-column template options only reach the page from fixed lists (checked when saved and again when rendered: a hand-edited value is ignored); the browser gets dialog shapes as JSON values from those lists. Built-in template components pass the same template checks as plug-ins; Copy into this application takes a static id from the fixed list, needs CSRF and the application in the developer's workspace, and never overwrites the application's own component.
Report row selection across pages (0.29.0)POST …/report/<id>/select needs the CSRF token, page access and a visible report region whose selection names the item (and the item visible); it only changes that item's session state; values are bounded (5000, 400 characters, no :) and treated as user input, like a submit; output is escaped.
Instance settings (0.29.0)Administrators only, with CSRF; only whole numbers within each setting's range are stored (a bad stored value falls back to the environment variable or default); the configuration overview never shows secrets (connection strings, keys: only whether they are set); changes are logged.
Session sharing (0.30.0)Only for the user directory; the group cookie is HttpOnly, SameSite=Lax, Secure behind HTTPS, path /, a random token whose SHA-256 alone is stored (closed to the runtime role); a token only opens applications of its own group, after each application's own access check (roles per application, groups re-mapped); idle and maximum times, deactivated accounts and expired passwords end or refuse it; signing out of one application ends the shared sign-in and the sessions it started.
Static application files, Execute JavaScript (0.31.0)Only developers (session, CSRF, workspace guard, app locks) change files; the runtime role can only read them. Names are checked in the database and the server (letters, digits, _, -, ., a fixed list of extensions, never HTML or paths) and served only for the application named in the URL, with their own type and nosniff; an SVG or PDF gets default-src 'none' (SVG sandboxed). Files are public, like APEX's: no secrets in them. Pages load them with <script src>/<link> from the same origin, so the CSP stays script-src 'self'. Execute JavaScript sends the page only a checked function name, never code; code typed into the action is ignored.
Plug-ins (0.31.0)Only developers (session, CSRF, workspace guard, app locks) import, remove and install plug-ins; meta.import_plugin is not executable by the runtime role, which can only read meta.plugin. Plug-in files are checked before anything is stored: type, names, static file names and types, base64 contents, attributes, a region's template against the template allow-list, a process function as a schema.function identifier (checked again by the database). Install SQL never runs on import: a developer reads and runs it as the application's role, in one transaction. Pages get only a plug-in's name and attribute values (escaped JSON in data-plugin-attrs, or in the page's JSON), and only for a plug-in of the matching type; its JavaScript comes from same-origin static files. A plug-in's code runs with the application's rights: install only what you trust.
Zips and parsing in SQL (0.31.0)meta.unpacked_file/meta.unpacked_entry are closed to applications; the functions that read them are security definer and only return entries of content the caller already holds (looked up by its SHA-256). The server unpacks only zip/xlsx it receives, at most 2,000 files and 200 MB (declared sizes checked before inflating, actual sizes after), kept 24 hours. Zip entry names are relative paths (no .., no leading /). XML with a DTD or entity declarations is refused; a row selector is an element name or path, never XPath.
Object storage (0.31.0)Bucket requests go through the web client: allow-list, private-address checks at connect time, no secrets on cross-origin redirects; the credential (type aws_sigv4, secret encrypted) must be valid for the bucket URL and is used only for object storage. Keys are generated by the server (<prefix><uuid>/<cleaned name>); prefixes can't contain ... Downloads keep the checksum, page access and RLS checks (the row is read as the app's role before the object is fetched) and the sandboxing headers; users never see the bucket or credential.
Lost update detection (sprint 50)meta.row_version() runs with the caller's rights (the app's role: grants and RLS apply); the key is a typed parameter and column names are quoted identifiers. A posted row version that is not an MD5 hex string is ignored; changing it only weakens the user's own protection.
URL region (sprint 50)The origin must be written out in the source (https, http only for localhost, or a path on this server; no user:password, no substitution before the path); &ITEM. values are URL-encoded and the result is checked to have the same origin. The CSP gets frame-src for exactly the origins of the page's visible URL regions; the frame is sandboxed (allow-top-navigation is never offered) with referrerpolicy=strict-origin-when-cross-origin.
Search region (sprint 50)The search text is a query parameter (ILIKE … ESCAPE, wildcards escaped, at most 8 words of 200 characters); configuration column names are checked and quoted, table sources resolved with regclass; queries run as the app's role in savepoints. Only the application's own configurations count; results link with checksums; list sources show only entries the user may see. The region endpoint serves search regions only after page access and the region's checks.
Developer toolbar (sprint 50)Shown only when the cookie pgkiln_devbar (path /a, HttpOnly, SameSite=Lax; a random token whose SHA-256 is on the builder session, separate from the builder's token) belongs to a live builder session of a developer who may open the application (administrator or workspace member); otherwise its routes are 404. Its POSTs need the app session's CSRF token. The viewer never shows password items. Debug per session is set only by the toolbar (__DEBUG_LEVEL can't be posted or put in a URL), and meta.debug_save stores a session's log only for a known level of a session of that application.
E-mail (sprint 50)The mail tables and the internal functions are closed to application and runtime roles. meta.send_mail and friends act for meta.app_id() only when the caller's role (current_setting('role'), unchanged by SECURITY DEFINER) is that application's database role, so application code can't send in another application's name or after RESET ROLE. Addresses are plain addresses (no CR/LF, no display names), the subject one line, at most 50 recipients, bodies 1 MB, attachments 20 × 10 MB per mail and only for a mail queued in the same transaction; From must be one of the service's allowed senders; a daily limit per application. Template placeholders are filled in one pass and HTML-escaped unless !RAW. Service secrets are AES-256-GCM encrypted with PGKILN_SECRET_KEY, write-only, never exported, logged or put in error messages; only administrators manage services. nodemailer runs with file and URL access off.
Checked imports (sprint 51)The Advisor runs in the import's transaction inside a savepoint that is rolled back (its SET LOCAL ROLE and settings with it): SQL is only planned (EXPLAIN without ANALYZE), PL/pgSQL blocks compiled into a pg_temp function, nothing is executed. A refused import rolls back entirely, its backup included.
Backups (sprint 51)meta.app_backup and meta.backup_app are closed to the runtime and application roles; the builder serves a backup only under its own application's URL (developer session, CSRF for restore and delete, the application's lock and Run only respected for a restore). A backup is an export: it holds no secrets.
Availability and Run only (sprint 51)Checked on every page request, file download, REST module call and, through meta.api_check, every PostgREST request; "developers only" needs the developer toolbar's token of a live builder session (never an API token); restricted compares user names case-insensitively. Run only is enforced on the server for every builder POST of the application (423 for JSON), except its availability, backups, locks, comments and feedback answers.
Feedback (sprint 51)Needs the application's setting, the page's access rules and the session's CSRF token; at most 10 per session and hour, 4000 characters, escaped everywhere; users see only their own feedback; the runtime role may only insert and read meta.feedback; answers need a developer session and are matched to the application in the URL.
Page behaviour (sprint 52)Ajax callbacks need the CSRF token and page access, run only processes with point ajax of this page or application (SQL only) with their authorization, condition and build option, as the app's role; posted values set only items the user may change, x01–x10 are binds :X01–:X10 and can't replace the built-in binds; at most 1000 rows come back. The download action runs only the download process its own (visible) dynamic action names. The error handling function runs as the app's role in its own transaction with a 2 s limit; its failure keeps the original message. Stay signed in needs that application's signed-in session and its CSRF token.
Session state protectionItem values in URLs, and the row keys of interactive grids, carry an HMAC checksum bound to app, page and user. Hidden, display, read-only and unauthorized items cannot be set by a form post.
Request integrityA CSRF token on every POST (pages, AJAX, login, logout). Buttons are re-validated on submit.
OutputAuto-escaping HTML templates, strict CSP (no inline scripts, no inline styles: the page's one <style> carries a per-response nonce), X-Frame-Options, nosniff, no-store. Images may also come from the map tile server (MAP_TILE_URL, an http(s) origin only); map data travels as JSON in a <script type="application/json"> element with < escaped. A map area in a report URL (r<id>_bb) is parsed into four range-checked numbers before it reaches SQL; anything else is ignored. The browser fetches tiles from that server directly, so it sees users' IP addresses, map areas and the site's origin (sent as Referer, which OpenStreetMap requires; never the page's path or query): self-host tiles where that matters.
FilesUploads are size- and type-checked and stored per session (meta.temp_files shows only the session's own files). A posted text value can't point a file item at another file, and a "remove file" value only removes files of the form's own record. Downloads need a checksum bound to user, page, item and record, check page access and read as the app's role (RLS applies). They are sent as attachments with nosniff and a sandboxing CSP; only PNG, JPEG, GIF, WebP and PDF are shown inline.
Data loading and PDFsThe data_load process loads as the app's role (grants, RLS, triggers apply) and shows only data errors and RAISE messages per row. Report PDFs run the report's own query with the same page, region and row checks as the screen.
SQL Worksheet transactions (sprint 107)A worksheet's open transaction is held in server memory under the caller's builder session id plus the tab key and checked against the workspace: every lookup starts from the caller's own session, so another developer or another sign-in never reaches it. Its connection is a plain client built from the workspace's developer login (or the Run as application's), never returned to a pool, and closed at the end, so SET ROLE reaches only roles that login has and nothing leaks into the builder's pools; Run as can't change while it is open. Rolled back on idle timeout, sign-out, session expiry, workspace switch, tab close and server stop, with idle_in_transaction_session_timeout as a backstop; at most WORKSHEET_TXN_MAX_PER_DEVELOPER per developer and WORKSHEET_TXN_MAX per server, each one database connection outside the pools. CSRF and a developer sign-in on every endpoint.
Release check (sprint 109)Off by default (PGKILN_RELEASE_CHECK, or Instance settings for administrators). When on, the server sends one GET to GitHub's releases API at most once a day per process, with a 5-second timeout and a 1 MB limit, and sends nothing about the installation; only a semver version and an https link are kept from the answer, and they are escaped on the Workspace home. Pages never wait for it.
Data Reporter datasets and reporting applications (sprint 110)Datasets are managed by the workspace's developers with CSRF on every POST; their schema must be one the workspace's SQL Workshop connection may use (never pgkiln's own or the system's), and tables, columns, joins and filters are checked against the catalog. The runtime builds a dataset's SELECT with quoted identifiers, literal values and whitelisted operators, and runs reports as the application's role. A reporting application's role gets SELECT only on the datasets' tables and views, so RLS applies; viewers never reach the report editor (report parameters in the URL are ignored), and only admin_authz users unpublish or delete others' reports. Dataset files are checked like a saved dataset before import.
AI Agents and tools (sprint 111)SQL tools are read-only (functions that change data and data-modifying WITH fail) and run as the application's role, so row level security applies; the model can't set :APP_USER. A Navigate tool links only to pages the user may open, with item values of that page and a checksum pgkiln builds. An agent's authorization scheme refuses other users before any AI call. Tool arguments and model output reach the page escaped. AI service keys stay on the server: not in builder pages, the tool call log, an export or the runtime role's reach. The builder's agent and tool forms need a developer and the CSRF token.
AI interactive reports (sprint 112)"Ask in your own words" (the phrase parser and the AI answer) only sets the report's own settings over its shown columns, never a hidden one; operators, functions, colours, chart types and computed-column expressions come from whitelists and are checked; values are query parameters or escaped literals. Chips are edited and removed through a CSRF-checked form whose fields are checked again; a report without ai_filter, a region of another page and signed-out users are refused.
Team Development (sprint 113)Issues, labels, milestones, templates and saved views belong to the developer's current workspace only, and can be neither read nor changed from another; assignees and @mentions are the workspace's developers, links go only to its applications. Every POST needs the session's CSRF token; titles, bodies, comments and names are escaped, Markdown is made safe, label colours come from a palette. Application users and signed-out visitors can't reach it.
Workflow 26.2 (sprint 114)Migrating running instances needs a developer of the application and the CSRF token; unmapped steps and other applications' workflows are refused. A task ends only with an outcome of its definition. Task event SQL runs as the application's role (after the commit, or in the request for fail events). Draft versions can't be activated in the builder, with SQL or into the active steps. The diagram export is for developers only, served as a sandboxed attachment with escaped labels.
Component details (sprint 115)The popup LOV search needs the CSRF token, caps the page size and page number and binds the search term. A wait popup's message is page data shown as text. A menu_entry dynamic action with an authorization the user lacks is neither sent to the page nor run (403); menu entries the user may not use are left out, labels are escaped, and the database refuses crafted action names.
App Builder list details (sprint 116)meta.app_change (Updated by) is written only for a builder POST that passed the developer checks (sign-in, CSRF token, workspace, locks) and succeeded; posts that change nothing record nothing. Developer names and lock owners are escaped in the report, the cards and the lock label; another workspace's applications are not listed. The table is closed to the runtime role and not exported.
Pillar navigation appearances (sprint 117)The appearance and the header strip colours are changed only by a developer with the CSRF token; only keys of a fixed list and #rrggbb colours are saved, and a hand-edited theme can't put markup or CSS into the page (a <body> class and the nonce'd <style>). A strip colour from an item is used only when the value is #rrggbb.
Mail queue, workspace mail and network access (sprint 118)Administration → Mail queue: administrators see every workspace, a workspace's administrators only their current workspace's applications, other developers get 403; Retry and Purge (one mail or all failed) check the mail's workspace again on the server and need the CSRF token; bodies and attachments are never shown. A workspace's own mail service is managed by its administrators only; its secret is encrypted like a web credential's, write-only, never shown or exported (not in the workspace export); it has no API base URL or token URL, and its SMTP host must pass the installation's allow-list and the workspace's network access list and resolve to a public address (unless PGKILN_REST_PRIVATE_HOSTS lists it), resolved once and connected to by that address (no DNS rebinding). A workspace's network access list narrows PGKILN_REST_ALLOWED_HOSTS on the server for every outgoing web call of its applications (meta.web_request, REST data sources incl. write-back and the response cache, invoke API, token endpoints, object storage, the builder's Test, REST source catalogs), on every redirect hop; it can't widen the installation's list or the private-address checks. Refusals go to the debug log and meta.network_refusal (7 days). Also fixed: REST source catalogs → read from a URL fetched the URL before checking the developer's session (any visitor could make the server call an allowed host); it is now read only after the developer and CSRF checks.
Data security per table (sprint 119)SQL Workshop → a table → Security writes GRANT / REVOKE and a masking view, so it needs a signed-in developer and the CSRF token, and works only on tables of the workspace's schemas (never pgkiln's own or the system's: 404). Table, column, view and role names reach SQL quoted; view names and application roles that could break out of their quotes are refused. The masking role is nologin, a member of the reader roles, so row level security still applies inside the view, and the generated SQL refuses to run when that role would bypass RLS. MCP run_query with an application runs as that application's database role (read-only) and refuses unknown applications.
App Gallery (sprint 120)Installing a sample app runs shipped SQL as the owner, so only administrators may, with the CSRF token, into their current workspace; a request names only a key of gallery.json of its own kind (sample, starter, utility), never a path, and the file names in the catalogue must match fixed patterns. The script and the workspace placement run in one transaction: a failing script leaves nothing behind. Utility apps are blueprints: any developer installs one into their own workspace, only after the review. An installed sample is edited only from its own workspace. The search term is escaped.
Builder language (sprint 121)Only the codes of the builder's languages are accepted: anything else on a sign-in link is ignored (also a repeated parameter), the status bar's menu refuses it (400) and checks the CSRF token. A sign-in link sets only an HttpOnly, SameSite=Lax cookie that the sign-in page reads; a developer's stored choice changes only through their own signed-in session. Translated texts are escaped like the English ones; placeholders are filled with escaped values unless the code passes markup on purpose (tx.rich).
Ask and smart filters set facets (sprint 122)A phrase can only set facets of the faceted search and smart filters regions on the page that the user sees, on their configured columns; values and range bounds become the facets' own URL parameters (bounds checked as numbers or dates) and reach SQL as query parameters, never as text. Values in a phrase are looked up in the report's rows with a query parameter, as the application's role. A facet chip's Remove is checked against the chips the form showed (a tampered key is refused). Sample apps keep their demo accounts with known passwords: install them on development or demo instances only.
Builder texts in the browser (sprint 123)The builder's JavaScript gets its texts as JSON in an attribute (<div id="builder-texts" data-texts>), escaped like any attribute value, so builder pages still have no inline script. The texts are the fixed message files, never data; scripts put them into the page with textContent and attributes, not as HTML.
Two-factor sign-in for developers (0.60.0)TOTP secrets (RFC 6238, 160 bits) are encrypted with PGKILN_SECRET_KEY and stored only after a code from the app confirms them; recovery codes (10 × 50 bits) are stored as SHA-256 and used up atomically; a code is accepted once (the last step is updated atomically) and only one 30-second step either side. The password step leaves only a pending sign-in in the session (5 minutes, no session for the developer yet); wrong codes count with wrong passwords for the per-user and per-IP lockout. Removing an app needs the password; another developer's factors can only be reset by an administrator, with a reason, which ends that developer's builder sessions. The require policy can only be turned on, and stays enforceable, with at least two administrators (or every one) holding an app; there is no setting, URL or variable that skips the second step: recovery is pgkiln admin reset-2fa / set-2fa-policy off on the server with the owner connection. Every enrolment, removal, reset, policy change and used recovery code is in the activity log; resets and policy changes are mailed to the administrators. The factor tables are closed to the runtime role.
Passkeys and trusted browsers (0.61.0)Passkeys (WebAuthn) are checked in src/webauthn.ts without a library: a 32-byte one-time challenge per purpose (registration or sign-in) kept in the session for five minutes and used up on the first answer, the clientDataJSON type, challenge and origin (PUBLIC_URL's, else the browser's own), the SHA-256 of the relying party id in the authenticator data, user presence, an ES256, EdDSA or RS256 signature over the authenticator data and the client data hash, and a signature counter that must go up (updated atomically, so a replayed or cloned key is refused). The CBOR reader takes only definite lengths, at most 16 levels and 1,000 entries. Credentials are public keys (no secret to leak, independent of the instance key); attestation is none. PGKILN_RP_ID is only honoured when it is the host or a parent domain of it. The sign-in options (the developer's credential ids) are only given after the password step, with the CSRF token. Trusted browsers (off by default) are a random 256-bit cookie token (HttpOnly, SameSite=Lax, Secure with COOKIE_SECURE, path /builder) of which only the SHA-256 is stored; the cookie is only looked at after a correct password, for that developer, and ends with its days, a new password, removing a factor, a reset, Forget trusted browsers or turning trust off (which removes every trusted browser at once).
Passkey sign-in without a password, workspace rule (0.62.0)Sign in with a passkey asks the browser for any passkey of this site (empty allow list) with userVerification: required, and the server refuses an answer whose authenticator data lacks the user-verified flag, so the passkey alone stands for possession plus a fingerprint, face or PIN. The credential id is looked up for this relying party only; a user handle, when the browser sends one, must be the developer's (a SHA-256-derived handle, not the user name). The same one-time challenge, origin, RP ID hash, signature and counter checks as at the second step apply; failures are logged as login_failed with the developer's name when the key is known and count for the per-user and per-IP lockout. Administrators turn it off in Instance settings. A workspace's rule (administrators and its own administrators only, CSRF-checked) can only add a requirement; pgkiln admin set-2fa-policy off clears every workspace's rule. While a second factor is required of a developer, a sign-in with the default password leads only to the password change.
Single sign-on for developers (0.63.0)A provider or directory signs developers in only with builder turned on. The flow is the applications' (state, PKCE, nonce, browser-binding cookie, ID token or SAML assertion checks) with a pending row without an application; developers are found by the provider's stable subject in meta.developer_identity, never by a name alone. An existing developer is linked by name only when the administrator allows it, once, never a break-glass administrator, and an e-mail user name only when verified; otherwise the developer links the identity on Security, which needs their session and CSRF token to start and the same browser to finish, and one identity can't be linked to two developers. Automatic accounts need the developers group when one is set and start as developers; the administrators group decides the role at every sign-in but never demotes a break-glass administrator. A workspace's single sign-on rule (administrators and its own administrators, CSRF-checked) refuses the pgkiln password and a passkey alone, after the password check so it reveals nothing; it can only be turned on while a break-glass administrator exists and by someone who could still sign in; the last break-glass administrator and a developer's last identity can't be removed while it applies. Failures are logged as login_failed with the reason.
Two-factor sign-in for application users (0.64.0)Per application (meta.app.mfa: off, optional, required, required for roles). The account's TOTP secrets are encrypted with PGKILN_SECRET_KEY and stored only after a code confirms them; recovery codes are SHA-256 and used up atomically; each 30-second step once, one step either side. A password or LDAP sign-in that needs the step creates no session: the pending sign-in (5 minutes, 10 while adding an app) lives in the signed-out session, bound to it and to the page's CSRF token, and a forged token ends it. Wrong codes count as failed sign-ins (the per-user and per-IP lockout). A Keep me signed in or session-sharing token stands in for the step only when its method ends in +2fa; an identity provider's sign-in is left to the provider. Without the instance key the step can't be required and enrolment refuses rather than skips. Removing an app needs a current or recovery code and is refused for the last app while the application requires it; a developer's reset (Users, with a reason) removes the apps and codes and ends the account's sessions, remembered and shared sign-ins. Every enrolment, removal, reset and used recovery code is in the activity log. The factor tables are closed to the runtime roles.
Lockout checks and key rotation (0.67.0)Only administrators see the checks and confirm a key backup (CSRF); the page shows a 16-character fingerprint of PGKILN_SECRET_KEY from a separate derivation, never the key; values from the database (RP IDs, names) are escaped. pgkiln admin rotate-key reads both keys from the environment (never arguments, so not in the shell history or the process list), decrypts every secret before it writes, and changes everything or nothing in one transaction; it is logged and mailed to the administrators. The runtime role reads none of the encrypted columns (tested for every *_enc column)

Findings of the MVP review and their fixes ​

Severity is rated for an internet-facing deployment.

#Finding (MVP)SeverityFix
1No authorization layer: every signed-in user could open every page and press every button.CriticalAuthorization schemes on all component types. Links, menu entries and buttons to pages the user cannot open are hidden.
2Forged button requests: the submit handler only checked that a button with that name existed. Its condition was never re-checked, so a hidden DELETE could be "pressed".HighVisibility (authorization + conditions) is computed before posted values are applied. Requests for buttons that were not rendered get a 403 and are logged.
3IDOR through URL items: ?P3_EMPNO=<any id> opened any record.HighPages default to protection = 'checksum'. URL item values need an HMAC checksum (urlChecksum / meta.page_url()) bound to app, page and user.
4Runtime connected as a superuser; apps without db_role ran as superuser.HighSeparate least-privilege pgkiln_runtime login. The builder creates a dedicated role per app. Builder and migrations use the owner connection.
5No brute-force protection.HighThrottling in activity_log: 5 failures per user (since their last successful login) or 50 per IP within 15 minutes. The same applies to builder logins.
6Username enumeration by timing: bcrypt only ran for existing users (~10× slower responses).Mediummeta.authenticate() runs bcrypt against a random salt when the user is unknown. Error messages are identical.
7Session tokens stored in plain text, with only an 8-hour idle timeout.MediumThe cookie holds a 256-bit random token and the database stores only its SHA-256. Idle timeout is 60 minutes and the absolute limit is 8 hours (APEX defaults). Expired rows are purged. Password changes and deactivation end sessions.
8Logout via GET (CSRF-able).LowPOST with CSRF token only.
9No security headers, and inline onchange handlers.MediumCSP script-src 'self', frame-ancestors 'self', form-action 'self', base-uri 'none', nosniff, SAMEORIGIN, Cache-Control: no-store, HSTS when COOKIE_SECURE=true. All behaviour lives in /static/app.js via event delegation.
10Database error details shown to end users (table names, SQL fragments).MediumOnly intentional messages (RAISE EXCEPTION, SQLSTATE P0001) and friendly constraint messages are shown. Everything else becomes "reference #id" in the activity log. The per-app debug flag shows details during development.
11Password hashes readable by the runtime connection.MediumColumn-level grants. Verification happens only inside meta.authenticate().
12Default admin/admin builder account with no way to change it in the UI.MediumA Developers page (change password, manage accounts). A banner appears while a default or trivial password is in use. Minimum password length is 8 for new accounts.
13CSV export formula injection (new feature).LowText cells starting with = + - @ get a leading '.
14Read-only conditions failed open (found during this review): an erroring condition made an item editable.MediumRead-only conditions fail closed. Region and button conditions already did.

Findings of the review of 2026-10-08 and their fixes ​

A second full review, mainly of what end users and API callers can reach. Regression tests are in test/security.test.ts ("security review 2026-10-08"), test/sso.test.ts, test/grid.test.ts, test/custom-auth.test.ts and test/binds.test.ts.

#FindingSeverityFix
1Hidden report columns readable through the URL: computed columns, filters, highlights, the search, sorting, control breaks, aggregates and the group by, pivot and chart views took any column of the query, including those in hidden.Medium–HighOnly the shown columns can be used; the search looks only at them.
2REST modules: :APP_USER set by the caller (?app_user=KING); query, body and path values filled every bind.MediumAPP_USER, APP_ID, APP_ALIAS (and APP_SESSION, APP_PAGE_ID, REQUEST, APP_LANGUAGE) come from the server; such parameters are dropped, and refused as path parameters. AI assistant tool arguments can't replace them either.
3Single sign-on linked an existing account by the username claim on first use, and a missing email_verified counted as verified: where users choose that claim at the provider, they could take over an account.Medium–HighPer-provider Link existing accounts (link_existing, off for new providers; migration 075 keeps it on for existing ones), only verified e-mail addresses link; SAML usernames are checked like OIDC ones.
4List values not checked: select lists, radio groups, checkbox groups, shuttles and grid select columns accepted any posted value.MediumPosted values must be returned by the item's list of values (config.any_value: true opts out); comboboxes stay free text.
5URL checksum ambiguity: names and values were joined as k=v&k=v, so a value containing &OTHER= signed two items.MediumEach name and value carries its byte length, with a version prefix (TypeScript and meta.url_checksum, migration 075). Links signed before the upgrade need a new checksum.
6My account password change not throttled: the current password could be guessed from an open session.LowThe sign-in throttle applies; database, custom and header apps don't offer the form at all.
7Any developer could change identity providers, LDAP directories and the password policy, and grant access to applications outside their workspace.MediumAdministrators only; access grants are checked against the developer's workspaces.
8meta.page_url() trusts settable settings, and application SQL can RESET ROLE to pgkiln_runtime.InfoDocumented below: the app role is not a sandbox for developer SQL.
9Validations for DELETE never ran (a DELETE skipped validation altogether).LowA DELETE runs the validations made for it (when_button = 'DELETE') and skips the item checks.
10TRUST_PROXY=true trusted every X-Forwarded-For entry, so behind an appending proxy a client could choose its IP and dodge the per-IP throttle.Lowtrue trusts one proxy; a number that many; addresses or subnets name them.
11Document templates via ?doc= on public pages: anyone could download every template without an authorization scheme.LowUsers who aren't signed in only get templates the page offers with a visible document button.
12Bind scanner and PostgreSQL could disagree on non-ASCII dollar-quote tags, $ inside identifiers, \r ending a comment and WHERE'…'.LowThe scanner follows PostgreSQL's lexer for these cases.

Findings of the security probe of 2026-11-15 and their fixes ​

An authenticated probe of a running 0.100.0 (sprint 201). Regression tests: test/security.test.ts ("sprint 201").

#FindingSeverityFix
SEC-1The SQL Workshop's developer login reported able to read meta.developer (password hashes) and other workspaces' rows. Not reproduced on a fresh installation nor on the probed one (the login had no rights in meta), but nothing prevented a later grant.High (if granted)A role with rights in meta is powerful (no app runs as it, no developer login joins it); workspace logins' rights in meta are revoked at every sync and before their pool opens; row level security for meta's owner on the secret tables; no PUBLIC rights on meta base tables; an allow-list test; lockout check dev_logins. Migration 175.
SEC-1bA shared workspace's developer login could set pgkiln.app_id to another workspace's application and read its rows through the meta.* views or call app functions as it.Mediummeta.app_id() / meta.app_visible refuse another workspace's application for a developer login.
SEC-2Owner connection is a superuser on the probed installation; is as_app=owner refused server-side for non-admins?InfoAlready refused (403, ownerChosen() re-checks); now tested. The non-superuser owner guide is completed (PostgreSQL 16+ ADMIN OPTION).
SEC-3Developer passwords: 8 characters minimum.Low12 (or the users' minimum when higher) when set or changed. (sprint 204) An opt-in breached-password check (Users → Account settings, off by default): only a 5-character SHA-1 prefix goes to api.pwnedpasswords.com (k-anonymity, padded responses) through the outbound allow-list and address checks; it fails open when the service can't be reached, so installations without internet access leave it off.
NX-F4Is a builder token tied to its developer's SSO or two-factor sign-in, and is every call logged? (owner's question)Low(sprint 204) Every request checks how the token's sign-in was made against the developer's rules of that moment: once single sign-on or a second factor is required that the sign-in did not have, or its identity is unlinked, the token is refused (403). Every token call, refusals too, is logged with the token's number and name (Security → Builder tokens → Calls).

Things that remain the developer's responsibility ​

  • Developer SQL is trusted, as in APEX. It runs as the app role, so the role's grants define its reach. End-user input reaches SQL only as escaped literals, whitelisted operators, integers, or identifiers checked against the result's column list.
  • Static region HTML is trusted. &ITEM. substitutions in it are escaped, and inline scripts, event handler attributes, style attributes and <style> blocks are blocked by the CSP (style-src 'self' 'nonce-…'): even HTML that slips through can't restyle the page to fake a form or hide a warning. Style developer HTML with the classes in /static/app.css.
  • Template components and plug-ins are not trusted like developer HTML, because a plug-in file may come from someone else. A template is checked against an allow-list when it is saved, imported (builder or SQL trigger) and rendered: no scripts, styles, event handlers, data-*, forms, frames, unquoted attribute values or raw placeholders. Every placeholder is HTML-escaped, and a value that would make a javascript: (or similar) link is dropped. Plug-ins carry no code of their own.
  • SQL Commands and SQL Scripts are logged. Since 0.23.0 the statement text goes into the activity log (sql_command, sql_script; up to 2,000 characters), so a password typed into a statement is stored there. Developers have full database rights in the SQL Workshop, as in APEX. A SELECT in a script is read completely even though only 10 rows are kept.
  • Supporting objects and custom authentication code are developer SQL: review imported scripts before running them, and give the app's role only what an install script needs.
  • The builder's code editor suggests tables and columns as the application's own database role sees them (the runtime role for apps without one), so a developer of one application can't list another application's schema through it; it never returns password hashes.
  • Server-side checks belong in the database for anything that matters: RLS policies, or checks inside PL/pgSQL functions (see hr.decide_leave). UI authorization hides things; the database enforces them.
  • protection = 'unrestricted' pages accept any URL item values. Use it only for items that are harmless to set, such as search filters.
  • REST data sources: a cached response is shared by every user of the application, so don't cache sources whose answer depends on the user. With * on PGKILN_REST_ALLOWED_HOSTS developers can call any public host. OAuth tokens and the response cache are kept per server process.
  • Calendar move SQL is developer SQL: pgkiln checks that the user sees the event, but who may move what (e.g. only the organiser) belongs in the SQL or RLS.
  • Streamed downloads keep a read-only transaction open while a slow client reads; STATEMENT_TIMEOUT applies to each fetch.
  • The app role is not a sandbox for developer SQL. pgkiln switches to the application's role with SET LOCAL ROLE, and SQL can always RESET ROLE back to the session's login role, pgkiln_runtime. So application SQL (processes, regions, REST handlers, custom authentication, supporting objects) can do what the runtime role can: read every application's metadata and sessions, set pgkiln.app_id / pgkiln.app_user and call meta.page_url() for any application and user (valid checksums), or change sessions. Treat every developer as trusted with all applications of the instance's shared workspaces, as the workspace notes say; end users never write SQL. An isolated workspace (sprint 60) closes this between workspaces: its SQL resets to a login of its own.
  • Administrators and developers: SQL Commands, SQL Scripts and the other SQL Workshop tools run on the owner connection for administrators and the developers of shared workspaces, so a developer can change anything, including meta.developer.is_admin. The administrator-only pages (instance settings, AI services, identity providers, LDAP directories, the password policy, developers) prevent mistakes; they are not a boundary against a developer who means harm.
  • App id from SQL (shared workspaces): meta.app_id() reads the pgkiln.app_id setting, which an application's own SQL can change. In shared workspaces, requests queued from SQL (meta.web_request, meta.ai_generate) could therefore be made under another shared application's id, using its web credentials or AI services and quota. Page processes are not affected (they use the server's app id). Since sprint 60, meta.app_id() refuses an application outside the login's workspace: isolate a workspace whose applications must not be trusted by the others.
  • Lockout trade-off: per-user throttling lets an attacker lock a known account for 15 minutes. The per-IP limit and the activity monitor help you spot this.

Deployment checklist ​

  1. Change the builder password (the Developers page), or delete admin after creating your own account.
  2. alter role pgkiln_runtime password '...' and set RUNTIME_DATABASE_URL.
  3. Run behind HTTPS with COOKIE_SECURE=true, and set TRUST_PROXY=true behind one reverse proxy (a number for several, or their addresses; client IPs are needed for throttling).
  4. Keep debug off for production apps (see the Settings → Security checklist in the builder).
  5. Give each app its own db_role with the minimum grants; add RLS where rows are per user or per team. REST modules and AutoREST refuse to run without one on a privileged connection (403); run the Advisor after upgrading.
  6. Restrict network access to /builder (reverse proxy or firewall) if developers are a small group.
  7. With a REST API: set a long random API_JWT_SECRET (the same in PostgREST), change the pgkiln_authenticator password, configure db-pre-request = meta.api_check, expose only the api schema, and run PostgREST behind HTTPS.
  8. With REST data sources: list only the hosts you need in PGKILN_REST_ALLOWED_HOSTS (avoid *), set a long random PGKILN_SECRET_KEY (32+ characters) kept outside the database and its backups, and use PGKILN_REST_PRIVATE_HOSTS only for internal services you mean to reach. Narrow it further per workspace under Administration → Network access (sprint 118).
  9. With header authentication: list only your proxy's addresses in PGKILN_AUTH_HEADER_PROXIES, make sure users can't reach pgkiln directly, and have the proxy remove any incoming copy of the header.
  10. With database-account authentication: list exact roles or use a dedicated membership role, and limit what those roles may connect to in pg_hba.conf (they can reach the database with their password outside pgkiln too).
  11. Turn on two-factor sign-in for the builder (Instance settings → Two-factor sign-in, at least for administrators) once two administrators have a passkey or an authenticator app; set PUBLIC_URL to the address developers use (passkeys belong to its host name), require it per workspace where the instance policy is too broad, keep Trust a browser short or at 0 on shared machines, keep PGKILN_SECRET_KEY backed up, and keep the recovery commands (pgkiln admin reset-2fa) for people with server access only.
  12. With single sign-on for developers: leave Link an existing developer with the same user name off unless you trust the provider's user names, set a developers group for automatic accounts, make at least one administrator break-glass (with a second factor and a password kept safe) before a workspace requires single sign-on, and keep pgkiln admin builder-sign-in password for people with server access only.
  13. Require two-factor sign-in of an application's users at least for administrators (Application settings → Sign-in methods → Two-factor sign-in → Required for some roles: admin); the Advisor warns when it is missing. Keep PGKILN_SECRET_KEY backed up: without it the authenticator apps stop working and users need their recovery codes or a reset.

Released under the Apache-2.0 license. Not affiliated with Oracle; Oracle and APEX are trademarks of Oracle.