Every engineering team has a security policy, whether or not anyone wrote it down. It is the set of things that are easiest to do. If the quickest way to read a production log is a role that can also delete the cluster, that role is the policy. If the quickest way to ship a schema change is to let the application run migrations at boot, the application’s database user is the policy.
None of these defaults are stupid, and the people who set them were not careless. Each one made a hard thing easy at a moment when the team had bigger problems. The trouble is that a default chosen for convenience in year one is still there in year four, and by then it has been extended to every laptop, every pipeline and, lately, every coding agent.
This series opened with ten habits worth auditing. This part takes the four that set most of the blast radius and goes deeper on each: why it drifted, the better default, and a first step. Part 2 turns the defaults into checks a pipeline can run. Part 3 breaks those checks on purpose to prove they work.
Why defaults matter more than they did a year ago
On 18 October, OpenCode told users that a breach had exposed the AI provider keys stored in 1.4% of OpenCode Console workspaces. Some developers woke up to bills over $1,000 run up against their own OpenAI, Anthropic and Google accounts. Nobody did anything unusual; the keys sat where the product put them.
In August last year, the Nx “s1ngularity” attack started with an npm publish token extracted through a vulnerable GitHub Action. The malware it shipped then looked for coding agents on the victim’s machine and ran them with their safety rails off, claude --dangerously-skip-permissions and gemini --yolo, to hunt for secrets. Over 2,000 verified credentials leaked. And on 25 October, Forever Security found a planted AGENTS.md file in a customer’s Downloads folder that talked a coding agent into installing a malicious npm package. Against Codex, their reconstruction worked nine times in ten.
The thread through all three is the same. An agent inherits whatever the environment hands it, and it generates and runs changes at a pace that informal conventions were never built for. The engineer at least sat through the onboarding session where someone explained the unwritten rules; the agent’s blast radius is set entirely by its permissions. OWASP now keeps a separate Top 10 for Agentic Applications, and much of it reduces to one point: the agent can do whatever its identity can do.
So the defaults that used to lean on a person remembering now have to be defaults the system enforces. Four of them decide most of the blast radius.
1. Who can touch production
The convenient version is one broad developer role for everyone. It usually dates from a 2am incident when someone needed access and nobody has revisited it since. Now every laptop, every phished session and every agent running under an engineer’s credentials carries full write access to production.
The better default is read-only for routine investigation (logs, metrics, read replicas) and a separate, time-boxed path for changes that leaves a record. This week: list who holds a write-capable production role, and ask each person whether they used it for a change in the last 30 days. Most will say no, and you have your first revocation list.
2. What the application’s database role can do
Most frameworks will happily run migrations at startup, with the same database user that serves requests. That user often owns the schema, because it created it. Anything that compromises the application, an injection bug, a poisoned dependency, an agent holding the connection string, inherits the ability to alter or drop tables.
OWASP’s Database Security Cheat Sheet is blunt about it: “The account should not be the owner of the database as this can lead to privilege escalation vulnerabilities,” and most applications “would only need SELECT, UPDATE and DELETE permissions.”
The better default is two identities. Migrations run in a deployment step under a privileged role. The running application connects as a role that has data access on the tables it uses and nothing else. On PostgreSQL, check ownership and role membership, not just GRANT statements; a role that owns a table or inherits from one that does has more than its grants suggest. Part 3 has the queries.
3. What CI is allowed to do
The convenient version is a long-lived cloud key in repository secrets and a deploy role with administrator attached, because the first deploy failed on a permission error and nobody wanted a second one. The s1ngularity attack began exactly here: one workflow with more trust than it needed yielded a token that could publish new versions of a package the whole ecosystem installs.
The better default is short-lived credentials via OIDC. GitHub’s own docs explain that a workflow can request a short-lived token from the cloud provider that is valid for a single job and then expires. Scope the deploy role to the resources it deploys. Use protected environments so only reviewed code on the default branch reaches production. This week: open your repository secrets and count the cloud keys. Each one is a migration to OIDC.
4. Where tenant isolation lives
“Always add the tenant_id filter” is a convention, and conventions do not survive the new background job, the ad hoc report, the support tool or the endpoint an agent generated at 11pm. Eventually one path forgets.
The better default puts tenant scope at a boundary every access path crosses: a repository layer, or a request-scoped database session that sets the tenant once. Then add row-level security underneath as the backstop. OWASP’s Multi-Tenant Security Cheat Sheet puts it the same way: “Enforce authorization at a boundary traversed by every tenant-owned access path. Add data-layer checks as defense in depth.”
One PostgreSQL detail joins this default to the previous one. Table owners bypass row security unless the table is marked FORCE ROW LEVEL SECURITY, and superusers and roles with BYPASSRLS always bypass it. If your application owns its tables, your RLS policies are decorative. Fix default 2 and default 4 gets cheaper.
Three questions for each default
The other six habits from the prelude are real, and they do less damage than these four, which is why the four come first. For every default you keep, answer three things. What does the system allow today? What is the minimum the job needs? What evidence shows the boundary holds? The evidence is the IAM policy, the database grants, the workflow permissions block, the authorisation test, the restore log. The next two parts are about producing that evidence automatically, and then proving it means something.
If you want help deciding which of these four to fix first in your stack, jfsi can walk through it with you.
Sources: TechCrunch: Hackers hit AI coding tool OpenCode, running up charges on users’ AI accounts (Oct 2026) · Wiz: s1ngularity’s Aftermath: AI, TTPs, and Impact in the Nx Supply Chain Attack · BleepingComputer: AI coding agents hijacked using AGENTS.md file in Downloads folder (Oct 2026) · OWASP Top 10 for Agentic Applications · OWASP Database Security Cheat Sheet · OWASP Multi-Tenant Security Cheat Sheet · GitHub Docs: About security hardening with OpenID Connect · PostgreSQL: Row Security Policies