Credentials
A client's stores are opened the first time someone picks the client. Its lookups run then, and their values are
kept for cache.ttl:
- Lookups are the jobs' own lookups:
aws_secretsmanager,command,function, and the others.commandandfunctionneedallow_lookup_exec: true.databaselookups are refused: the console opens no other database. - Secrets name a lookup's field (
{lookup: {from: db, field: password}}). A secret without a lookup comes from the console's environment,STREAMWRIGHT_SECRET_<NAME>, as in jobs. - Rotation. When a store cannot be read, the console looks the client's secrets up again and tries once more, at most every 30 seconds. If that fails too, the store shows as unreachable until the next request.
- Failed lookups. A store that could not be opened (a lookup failed, a secret has no value) is tried again after
30 seconds, not after
cache.ttl, so a throttled secrets API does not hide a client for long. - Never shown. Secrets stay in the console process: they appear in no response, and log lines mask them.
Give the console a read-only database user. It reads the sw_* tables, and writes sw_job_acks only when
people acknowledge from the page, for example on PostgreSQL:
CREATE ROLE console_ro LOGIN PASSWORD '...';
GRANT USAGE ON SCHEMA sw TO console_ro;
GRANT SELECT ON ALL TABLES IN SCHEMA sw TO console_ro;
ALTER DEFAULT PRIVILEGES IN SCHEMA sw GRANT SELECT ON TABLES TO console_ro; -- tables a later migration adds
GRANT INSERT, UPDATE, DELETE ON sw.sw_job_acks TO console_ro; -- only if people acknowledge from the page