Skip to content

docs: add explanation of non-personal database users in Cloud SQL#840

Open
Starefossen wants to merge 2 commits into
mainfrom
doc/non-personal-database-users
Open

docs: add explanation of non-personal database users in Cloud SQL#840
Starefossen wants to merge 2 commits into
mainfrom
doc/non-personal-database-users

Conversation

@Starefossen
Copy link
Copy Markdown
Member

What

Adds a new explanation page documenting all non-personal database users in Cloud SQL on Nais.

Why

Teams answering MKR-ØS (Minimum kontrollrammeverk for Økonomisystem) requirements need documentation they can link to about non-personal database user accounts. This was requested in #minimum-kontrollrammeverk-økonomisystem.

What's covered

  • Google system users (cloudsqladmin, cloudsqlagent, etc.) — all Google-managed, no Nav access
  • cloudsqlsuperuser — clarified as a role, not a user
  • The postgres user — not used by Nais in the golden path
  • Application user — provisioning flow, credential management (naiserator, sqeletor)
  • Personal access — IAM-based, time-limited, who can grant it
  • Audit logging — Cloud Audit Logs (Admin Activity vs Data Access) and pgAudit (opt-in)
  • Audit log retention — searchable 2yr + archived 11yr in locked buckets

Placement

docs/persistence/cloudsql/explanations/non-personal-database-users.md

Listed alongside existing explanations like cloud-sql-credentials and grants-and-privileges.

Starefossen and others added 2 commits April 14, 2026 19:51
Documents all non-personal database users (system users, postgres,
application user, personal IAM access) for teams answering MKR-ØS
control framework requirements about non-personal user accounts.

Covers:
- Google system users (cloudsqladmin, cloudsqlagent, etc.)
- The postgres user and golden path usage
- Application user provisioning and credential management
- Personal access via IAM
- Audit logging (Cloud Audit Logs + pgAudit)
- Audit log retention and storage

Co-authored-by: Copilot <[email protected]>
- Fix Cloud Audit Logs: database/user CRUD and logins are Data Access
  events, not Admin Activity. Add warning about enabling Data Access logs.
- Fix personal access: clarify it's the IAM role binding that's
  time-limited, not the DB user object. Add specific role names and TTLs.
- Fix credential flow: add the Secret → SQLUser/Config Connector → Cloud
  SQL step that was missing.
- Fix secret keys: use PREFIX notation and mention SSL keys for private IP.
- Fix cloudsqlsuperuser: qualify as built-in auth users only.
- Fix pgAudit: change 'default config' to 'recommended config' since the
  CLI doesn't enforce write,ddl,role — it's from the how-to guide.
- Fix overview table: soften 'only app pod' to acknowledge secret access.

Co-authored-by: Copilot <[email protected]>
Copy link
Copy Markdown
Member

@Kyrremann Kyrremann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ser fint ut dette, noen små kommentarer. Vi har vel også stengt ned tilgang til secrets siden denne ble skrevet? Så nå kan man ikke så enkelt låne app-brukeren.


## Overview

| User type | Why it exists | Who controls the password | Can anyone at Nav log in? | What is logged |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Can anyone at Nav log in" får det til å høres ut at kravet er at man jobber i Nav, så kanskje endre til team? Eller forklare hva vi mener med "anyone".

- `<PREFIX>_URL` — a complete connection string
- `<PREFIX>_JDBC_URL` — a complete JDBC connection string

The prefix is derived from the instance and database name (e.g., `NAIS_DATABASE_MYAPP_MYDB`). For instances on private IP, sqeletor also adds SSL-related keys (`_SSLROOTCERT`, `_SSLCERT`, `_SSLKEY`, `_SSLMODE`).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vet folk hva "sqeletor" er for noe?

- Listing/reading metadata for databases, users, and backups (`DATA_READ`)

!!! warning
Database and user CRUD operations and logins are **Data Access** events, not Admin Activity. If you need audit evidence of user creation or database logins, you must [enable Data Access audit logs](https://cloud.google.com/logging/docs/audit/configure-data-access).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Har vi ikke dokumentert dette i vårt egen dokumentasjon? Gaal eller noe?


The [recommended configuration](../how-to/enable-auditing.md) is to log `write`, `ddl`, and `role` — that is, write operations, schema changes, and role changes. Read operations (`read`) are not logged unless you configure it explicitly. The application user is excluded (`pgaudit.log = 'none'`) to avoid noise from normal application traffic.

Source code: [`nais/cli` — audit.go](https://github.com/nais/cli/blob/main/internal/postgres/audit.go)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Er dette relevant?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants