The scan grade

How the agent blast-radius grade is calculated

deedglass scan grades your own agent setup by how much an agent could change if it went wrong. It starts at 100, takes points off for what it finds, and always lists the deductions with the grade.

Formula v1 · updated · from the scan’s own code, internal/scan/score.go

The formula

formula_version: 1docs/SCAN.md
points = 100
       − 35                             if the database role is a superuser or has BYPASSRLS
       − 20 × min(2, high findings)
       −  8 × min(3, medium findings)
       −  4 × min(5, write paths with no check)
points = max(points, 0)
grade  = A ≥ 90 · B 80–89 · C 65–79 · D 50–64 · F < 50
Deductions
DeductionPointsLimitAt most
The database role is a superuser or has BYPASSRLS−35once−35
Each high finding−20at most 2−40
Each medium finding−8at most 3−24
Each write path with no check−4at most 5−20
Grades
GradePoints
A90 to 100
B80 to 89
C65 to 79
D50 to 64
Fbelow 50

The deductions can add up to more than 100, so the points stop at 0. Low and info findings are listed but never take points off.

What each deduction counts

The database role

When you name a database with --postgres-dsn-env, the scan reads the role’s attributes in a read-only transaction. A superuser or a role with BYPASSRLS can change anything row-level security would have stopped, so it costs 35 points, once. The two findings that say so count toward that 35 and never again as high findings.

Findings

The findings the scan can report under formula v1, with what each takes off:

Scan findings and their points
FindingSeverityPoints
Archived Postgres MCP serverarchived_postgres_mcphigh−20
The database role is a superuserrole_superuserhighin the 35
The database role bypasses row-level securityrole_bypassrlshighin the 35
An agent can run a destructive database command without a promptshell_destructive_unpromptedhigh−20
An agent can read a database URL in .env without a promptenv_database_url_readablemedium−8
No ask or deny rule covers a destructive database commandshell_destructive_no_rulemedium−8
A database MCP server has no read-only settingdatabase_server_not_read_onlyhigh−20
A credential sits in plain text in a client configplaintext_secret_in_confighigh−20
Shell commands run without a prompt and with no PreToolUse hookshell_no_guard_hookhigh−20
A database URL sits in a client configdatabase_url_in_client_argsmedium−8
The database role can replicaterole_replicationmedium−8
The database role can create rolesrole_createrolemedium−8
The role can run SECURITY DEFINER functionssecurity_definer_executablemedium−8
The database role can create databasesrole_createdblow0
Writable tables without a primary keyno_primary_key_on_writable_tablelow0
wal_level isn't logicalwal_level_not_logicalinfo0

The archived Postgres server’s severity depends on the role: high when the scan read a role that can write, low when the role can only read, and medium when no database was read.

The shell findings come from Claude Code’s settings files (deedglass 0.2.0 and newer). No ask or deny rule covering a destructive database command is medium when your user settings set defaultMode to auto, and low, with no points taken, otherwise.

Write paths with no check

A tool that can write, delete or move money, or a table the role can DELETE or TRUNCATE, that isn’t routed through deedglass mcp wrap with an active policy. A table counts as routed only when every server that reaches its database is routed. When the scan can’t tell, the path counts, and its line says not shown to be routed. A table’s line names its enabled triggers: a trigger is how one reported row becomes many.

Worked examples

The first two are real results from the product’s test data, deduction by deduction as the scan wrote them. The third is the arithmetic for a common setup.

The demo’s Acme setup: C, 72 points

The setup the demo ships: a Postgres role that can insert, update, delete and truncate five tables, one of them with a trigger, none of them shown to be routed through a policy. The role can also run SECURITY DEFINER functions, a medium finding.

Deductions for The demo’s Acme setup: C
DeductionSubjectPoints
Medium findingssecurity_definer_executableThe role can run SECURITY DEFINER functions−8
Write paths with no checkpublic.customersINSERT, UPDATE, DELETE, TRUNCATE · not shown to be routed−4
Write paths with no checkpublic.order_itemsINSERT, UPDATE, DELETE, TRUNCATE · not shown to be routed−4
Write paths with no checkpublic.ordersINSERT, UPDATE, DELETE, TRUNCATE · trigger orders_ship_open_batch · not shown to be routed−4
Write paths with no checkpublic.productsINSERT, UPDATE, DELETE, TRUNCATE · not shown to be routed−4
Write paths with no checkpublic.refundsINSERT, UPDATE, DELETE, TRUNCATE · not shown to be routed−4

100 − 8 − 4 − 4 − 4 − 4 − 4 = 72 · grade C · 5 write paths with no check. The file

A project with an archived Postgres server: D, 56 points

A project whose Cursor config and package.json each use the archived reference Postgres server, with a database URL in the Cursor config’s arguments, and file, SQL and payment tools that can write. One SQL server is wrapped, but no active policy was found. The scan ran without a database, so no role was read.

Deductions for A project with an archived Postgres server: D
DeductionSubjectPoints
Medium findingsarchived_postgres_mcpArchived Postgres MCP server−8
Medium findingsarchived_postgres_mcpArchived Postgres MCP server−8
Medium findingsdatabase_url_in_client_argsA database URL sits in a client config−8
Write paths with no check@modelcontextprotocol/server-postgres.querywrite · package.json−4
Write paths with no checkfiles.edit_filewrite · .cursor/mcp.json−4
Write paths with no checkfiles.move_filedestructive · .cursor/mcp.json−4
Write paths with no checkfiles.write_filewrite · .cursor/mcp.json−4
Write paths with no checkorders.execute_sqlwrite · claude_desktop_config.json · wrapped, but no active policy was found−4
Write paths with no checkpostgres.querywrite · .cursor/mcp.json (over the cap)0
Write paths with no checkstripe.payment_intents.createmoney · package.json (over the cap)0
Write paths with no checkstripe.refunds.createmoney · package.json (over the cap)0

100 − 8 − 8 − 8 − 4 − 4 − 4 − 4 − 4 = 56 · grade D · 8 write paths with no check, 3 of them past the cap · database not checked. The file

An agent connected as the superuser: F, then A

An agent that connects as postgres, the bootstrap superuser, to a database with six tables, nothing routed: −35 for the superuser, −16 for two medium findings (that role can also replicate and create roles), and six write paths of which five count, −20. That is 100 − 35 − 16 − 20 = 29, an F. Give the agent its own role that can only SELECT, with nothing else found, and the same database scores 100, an A. This one is arithmetic from the formula, not a recorded run.

How to raise it

  1. Give the agent its own role, not a superuser and without BYPASSRLS: up to 35 points. Read-only database access shows how.
  2. Fix the high findings, 20 points each, such as replacing the archived Postgres server with a maintained one.
  3. Fix the medium findings, 8 points each: move database URLs out of client arguments into environment variables, drop REPLICATION and CREATEROLE, revoke EXECUTE on SECURITY DEFINER functions the agent doesn’t need.
  4. Close the write paths, 4 points each: take away DELETE and TRUNCATE the agent doesn’t use, and route the tools that write through deedglass mcp wrap with an active policy.

Then run npx deedglass scan again; the grade and its deductions change with the setup. Want help setting the rules up? Ask in GitHub Discussions.

What it doesn’t measure

  • Prompt injection, or what a model might be talked into.
  • How a tool behaves when it runs, or whether its code is safe.
  • Anything outside the configs, packages and database role the scan reads on your machine. It checks Postgres only.

Every result names its formula version. When the formula changes, old results and share links keep their version and stay readable. A means a small blast radius, not a safe agent.

Questions

Does the scan send my configs or my database anywhere?

No. It runs on your machine, reads your files and, if you name one with --postgres-dsn-env, one database’s catalog in a read-only transaction. It sends nothing anywhere.

Does an A mean my agent is safe?

No. A means a small blast radius, not a safe agent. The grade measures what the setup could change, not what your agent will do, and it doesn’t look at prompt injection or at how a tool behaves when it runs.

Why does a deduction show 0 points?

It is past its cap. Items past a cap are listed with 0 points and the words over the cap, so the list always explains the whole grade.

Why does my result say database not checked?

The scan reads a database only when you name one with --postgres-dsn-env. Without it, the grade covers your configs and packages, and the role and table deductions can’t apply.

Can I fail a pull request on the grade?

Yes. --fail-under C exits 1 when the grade is below C, after writing every file, so a CI job can stop the merge. F isn’t a value.

What happens to my grade when the formula changes?

Every result names its formula version. When the formula changes, old results and share links keep their version and stay readable.

Can I scan someone else’s repository?

No. The scan grades only the setup on the machine it runs on. It has no mode that takes someone else’s repository.

Read next