[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BR3D2ZJCJMY1SWJD3HNHKZ":3,"skill-same:01M7BR3D2ZJCJMY1SWJD3HNHKZ":52},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M7BR3D2ZJCJMY1SWJD3HNHKZ","verify-db-posture-at-the-target",null,"Use after a change to row-level security, grants, policies or function privileges reaches a live Postgres or Supabase project, and before reporting it closed. Fires on \"verify it\", \"did the push work\", \"is the advisor clear now\", \"check production\", and after a hand-run fix on a database no migration ledger records. Do NOT fire for schema shape alone (a column, an index, a type), for a change that has not been applied anywhere yet, or when the only question is whether a test passed.","damson\u002Fhard-won-skills","damson","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F804217?v=4","01M7BR01SMVEGA4HRD46VV1SXF","Damien D.","01M7BR01TR37MB9R73C1C0ENGG",1,"MIT","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdata-safety\u002Fskills\u002Fverify-db-posture-at-the-target\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: verify-db-posture-at-the-target\ndescription: >\n  Use after a change to row-level security, grants, policies or function\n  privileges reaches a live Postgres or Supabase project, and before reporting\n  it closed. Fires on \"verify it\", \"did the push work\", \"is the advisor clear\n  now\", \"check production\", and after a hand-run fix on a database no migration\n  ledger records. Do NOT fire for schema shape alone (a column, an index, a\n  type), for a change that has not been applied anywhere yet, or when the only\n  question is whether a test passed.\n---\n\n# Verify database posture at the target\n\nA permission change has at least three surfaces and they disagree. The catalog\nsays a switch is on. The privilege functions say a role holds a grant. The API\nsays what a person with a browser key actually receives. Reading one and\nreporting the others is how a production endpoint served an empty list to every\nanonymous caller for days while `pg_class` looked perfectly healthy: row-level\nsecurity was on with no policy behind it, which is catalog-clean, deny-all, and\nindistinguishable from a table that is simply empty.\n\nRead every layer separately, and when two disagree, the API is the one users\nlive in.\n\n## Procedure\n\n1. **Catalog.** Query the objects the change names, never the migration you\n   just wrote: `pg_class.relrowsecurity`, `pg_policy`, `pg_proc.proacl` and\n   `proconfig`, `information_schema.role_table_grants`. A migration is a\n   statement of intent; this is the outcome. Count only the policies that can\n   admit the command you care about (`polcmd in ('r', '*')` for a read) and only\n   the permissive ones: a table carrying one `UPDATE` policy reports a\n   reassuring non-zero while reads are still deny-all. An empty result set is a\n   third answer, not a clean one, and it means the relation is not there.\n\n2. **Role.** Ask `has_table_privilege` and `has_function_privilege` for each\n   role that matters, including the service account that actually performs the\n   work, not only `anon` and `authenticated`. A privilege reaching a role\n   through `PUBLIC` is invisible when you filter `proacl` by role name, so the\n   obvious revoke can measure as a no-op while reading as correct.\n\n3. **API.** GET the REST surface with the publishable key, the one that ships in\n   the browser bundle. This is the layer the catalog cannot answer. Keep the\n   response body: a status code alone cannot tell rows from an empty list, and\n   that is the distinction. What should be readable returns rows. What should be\n   closed refuses outright when the role holds no grant, but answers `200` with\n   an empty list when it holds the grant and no policy admits it, so read an\n   empty result against a trusted-role baseline confirming the table has rows to\n   withhold. An MCP fetch proves nothing here, because it bypasses deployment\n   protection; use `curl`. The response is the evidence, so refuse a transport\n   that could rewrite it: require `https` for the HTTP probe, and pin\n   `sslmode=verify-full` for a direct connection, because libpq defaults to\n   `prefer` and falls back to plaintext silently. Where the database has no HTTP\n   layer, connect as the untrusted role itself and run the statement: the point\n   is to be the caller, not to describe them.\n\n4. **Advisor, where the platform has one.** Re-run it and diff against the list\n   from before the change. Classify every survivor out loud as deliberate,\n   inapplicable, or open. A finding that is *new* may name an object no\n   migration created: check `pg_event_trigger` and function ownership, because\n   platform-managed objects and someone's pasted snippet look identical until\n   you read the owner.\n\n5. **Report per layer**, and say which layer each claim came from. \"The advisor\n   is clear\" and \"the endpoint serves rows\" are different sentences.\n\n## When to STOP\n\n- **Never write to production to test.** A `DO` block that raises to roll itself\n  back is the only mutation worth running, and only when no read can answer the\n  question. Capture the exact recreate DDL with `pg_get_functiondef` before\n  dropping anything.\n- **Hand back** if the question needs a write and production is the only\n  reachable database.\n- **Do not infer the fix from a green deploy.** A migration job reporting\n  success says statements ran, not that a role lost a privilege.\n","# Verify database posture at the target\n\nA permission change has at least three surfaces and they disagree. The catalog\nsays a switch is on. The privilege functions say a role holds a grant. The API\nsays what a person with a browser key actually receives. Reading one and\nreporting the others is how a production endpoint served an empty list to every\nanonymous caller for days while `pg_class` looked perfectly healthy: row-level\nsecurity was on with no policy behind it, which is catalog-clean, deny-all, and\nindistinguishable from a table that is simply empty.\n\nRead every layer separately, and when two disagree, the API is the one users\nlive in.\n\n## Procedure\n\n1. **Catalog.** Query the objects the change names, never the migration you\n   just wrote: `pg_class.relrowsecurity`, `pg_policy`, `pg_proc.proacl` and\n   `proconfig`, `information_schema.role_table_grants`. A migration is a\n   statement of intent; this is the outcome. Count only the policies that can\n   admit the command you care about (`polcmd in ('r', '*')` for a read) and only\n   the permissive ones: a table carrying one `UPDATE` policy reports a\n   reassuring non-zero while reads are still deny-all. An empty result set is a\n   third answer, not a clean one, and it means the relation is not there.\n\n2. **Role.** Ask `has_table_privilege` and `has_function_privilege` for each\n   role that matters, including the service account that actually performs the\n   work, not only `anon` and `authenticated`. A privilege reaching a role\n   through `PUBLIC` is invisible when you filter `proacl` by role name, so the\n   obvious revoke can measure as a no-op while reading as correct.\n\n3. **API.** GET the REST surface with the publishable key, the one that ships in\n   the browser bundle. This is the layer the catalog cannot answer. Keep the\n   response body: a status code alone cannot tell rows from an empty list, and\n   that is the distinction. What should be readable returns rows. What should be\n   closed refuses outright when the role holds no grant, but answers `200` with\n   an empty list when it holds the grant and no policy admits it, so read an\n   empty result against a trusted-role baseline confirming the table has rows to\n   withhold. An MCP fetch proves nothing here, because it bypasses deployment\n   protection; use `curl`. The response is the evidence, so refuse a transport\n   that could rewrite it: require `https` for the HTTP probe, and pin\n   `sslmode=verify-full` for a direct connection, because libpq defaults to\n   `prefer` and falls back to plaintext silently. Where the database has no HTTP\n   layer, connect as the untrusted role itself and run the statement: the point\n   is to be the caller, not to describe them.\n\n4. **Advisor, where the platform has one.** Re-run it and diff against the list\n   from before the change. Classify every survivor out loud as deliberate,\n   inapplicable, or open. A finding that is *new* may name an object no\n   migration created: check `pg_event_trigger` and function ownership, because\n   platform-managed objects and someone's pasted snippet look identical until\n   you read the owner.\n\n5. **Report per layer**, and say which layer each claim came from. \"The advisor\n   is clear\" and \"the endpoint serves rows\" are different sentences.\n\n## When to STOP\n\n- **Never write to production to test.** A `DO` block that raises to roll itself\n  back is the only mutation worth running, and only when no read can answer the\n  question. Capture the exact recreate DDL with `pg_get_functiondef` before\n  dropping anything.\n- **Hand back** if the question needs a write and production is the only\n  reachable database.\n- **Do not infer the fix from a green deploy.** A migration job reporting\n  success says statements ran, not that a role lost a privilege.\n",{"name":5,"description":7},"main","9435f9fa04b69d2217f8cab3c817dd5c3c1d1021","plugins\u002Fdata-safety\u002Fskills\u002Fverify-db-posture-at-the-target",0,"https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills","https:\u002F\u002Fgithub.com\u002Fdamson","http:\u002F\u002Fgoo.gl\u002F3UwFRt","2026-11-14 14:28:11",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add damson\u002Fhard-won-skills --skill verify-db-posture-at-the-target",{"tool":38,"command":39},"bunx","bunx skills add damson\u002Fhard-won-skills --skill verify-db-posture-at-the-target",{"tool":41,"command":42},"pnpm","pnpm dlx skills add damson\u002Fhard-won-skills --skill verify-db-posture-at-the-target","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdata-safety\u002Fskills\u002Fverify-db-posture-at-the-target\u002FSKILL.md",true,[46],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"README.md","REFERENCE","参考文档",7962,"https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdata-safety\u002Fskills\u002Fverify-db-posture-at-the-target\u002FREADME.md",[53,60,66,71,76,81],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M7BRCESR9BRFAH87J2ZQY5T2","skill-two","Fixture skill","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fwrong_welcome_total\u002Fplugins\u002Falpha\u002Fskills\u002Fskill-two\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M7BRCDPHEPZES71BYBRTZ1G3","skill-one","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fwrong_welcome_total\u002Fplugins\u002Falpha\u002Fskills\u002Fskill-one\u002FSKILL.md",[],[],{"skillNo":67,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M7BRCCHHB3Q07BR0QN339D3F","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fwrong_table_count\u002Fplugins\u002Falpha\u002Fskills\u002Fskill-two\u002FSKILL.md",[],[],{"skillNo":72,"name":62,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M7BRC9J97QKZHGKVXMER5ZEE","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fwrong_table_count\u002Fplugins\u002Falpha\u002Fskills\u002Fskill-one\u002FSKILL.md",[],[],{"skillNo":77,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M7BRC8C39NM8VVAQ3TKP0CRS","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fvalid_marketplace\u002Fplugins\u002Falpha\u002Fskills\u002Fskill-two\u002FSKILL.md",[],[],{"skillNo":82,"name":62,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M7BRC75THG394KDGYV35ET19","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fvalid_marketplace\u002Fplugins\u002Falpha\u002Fskills\u002Fskill-one\u002FSKILL.md",[],[]]