[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CSK449EG7S94TZ14XN3KFH":3,"skill-same:01M7CSK449EG7S94TZ14XN3KFH":50},{"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":27,"commitSha":28,"skillDirectory":29,"forksCount":30,"repositoryHtmlUrl":31,"repositoryHomepageUrl":32,"ownerHtmlUrl":33,"ownerBlogUrl":6,"ownerDescription":34,"updatedAt":35,"install":36,"resources":49},"01M7CSK449EG7S94TZ14XN3KFH","data-isolation-and-lifecycle",null,"Use when the diff stores, caches, indexes, exports, imports, migrates, soft-deletes or revokes access-controlled or multi-tenant data - policy vs query disagreement, bypass clients, tenant-less cache and object keys, signed links, derived copies (search, cache, logs, analytics), export\u002Frestore scope, migration defaults, and stale access after delete or revoke","makifbaysal\u002Ftasktrooper","makifbaysal","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F25031940?v=4","01M7CRG3ZCSYZSSEVDMW3DEYC8","Mehmet Akif Baysal","01M7CRG401FJ8YAXH5ER730XYV",122,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fsecurity-agent\u002Fskills\u002Fdata-isolation-and-lifecycle\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: data-isolation-and-lifecycle\ncategory: security\ndescription: Use when the diff stores, caches, indexes, exports, imports, migrates, soft-deletes or revokes access-controlled or multi-tenant data - policy vs query disagreement, bypass clients, tenant-less cache and object keys, signed links, derived copies (search, cache, logs, analytics), export\u002Frestore scope, migration defaults, and stale access after delete or revoke\ntech_stack: Web & API\nsource: cloudflare\u002Fsecurity-audit-skill (MIT) data-isolation and lifecycle attack classes, adapted to diff review; own wording; OWASP Top 10:2025 A01 and CWE cited by name only\n---\n# Data Isolation and Lifecycle\n\n## Overview\n\nEndpoint checks protect one door. Data has many copies — a cache entry, a search document, a thumbnail, an export file, a log line, a backup, a queued job — and each copy has its own reader and its own retention. Isolation fails where a copy forgets who owns the data, or where a deleted or revoked record keeps working.\n\n**Core principle:** pick one protected record the diff touches and follow it through every write, read, copy and state change. At each edge, name the code that enforces its owner. A tenant column is not that code.\n\n## 1. A Tenant Field Is Not Isolation (CWE-639, CWE-863)\n\nThe owner column exists; the question is which query, policy or key enforces it on this path.\n\n- **Bypass clients:** Supabase's service-role key or a Postgres role with `BYPASSRLS` used in a request handler; a \"system\" repository that skips the tenant filter, called from a user-facing path.\n- **Unscoped escapes:** GORM `Unscoped()` (it also drops the soft-delete filter), Rails `unscoped`, a Django manager that is not the filtered default, Hibernate filters that do not apply to native queries, Prisma middleware that a raw query skips.\n- **Policy and query disagree:** row-level security on the table but the new view, function (`SECURITY DEFINER`), materialized view or aggregate reads around it; a join that brings in rows of another tenant through an unscoped relation.\n\n```sql\n-- ❌ SECURITY DEFINER runs as the function's owner; a table owner bypasses RLS\n--    (unless FORCE ROW LEVEL SECURITY is set), so the caller's policy never applies\nCREATE FUNCTION project_stats(p uuid) RETURNS TABLE(...) LANGUAGE sql SECURITY DEFINER\nAS $$ SELECT ... FROM tasks WHERE project_id = p $$;\n-- ✅ SECURITY INVOKER (the default), or filter on the caller's tenant inside the function\n```\n\n## 2. Keys and Namespaces Without the Tenant\n\nTwo principals collide on one logical key even though their records have separate owners:\n\n- cache keys built from a user-chosen name (`report:` + name) or from an id that is only unique per tenant;\n- object-storage keys from the uploaded filename (`uploads\u002Favatar.png`) — one tenant overwrites or reads another's;\n- search document ids, deduplication keys, idempotency keys and lock names without the tenant;\n- globally unique constraints that let one tenant squat or probe another tenant's slug, email or domain.\n\n```go\n\u002F\u002F ❌ every org shares one key space\nkey := fmt.Sprintf(\"dashboard:%s\", req.Name)\n\u002F\u002F ✅\nkey := fmt.Sprintf(\"org:%s:dashboard:%s\", auth.OrgID(ctx), req.Name)\n```\n\n## 3. Signed URLs and Shared Links\n\n- A presigned URL that allows more than the issuer could do: `PUT` where `GET` was meant, a key prefix instead of one object, a content type the client chooses, a week of validity for a one-time download.\n- A share token that unlocks a folder when it was issued for one file, or keeps working after the item was unshared or its ACL changed.\n- A link id that is the object id, so any authenticated user with the id gets the object (access-control-and-idor).\n\n## 4. Derived Copies That Forget the ACL\n\n- **Search and vector indexes:** the filter is applied at ingestion but not at query time, or permission changes never reach the index (llm-and-agent-security §6 for embeddings and context caches).\n- **Caches:** a private response cached under a key without the user; an ACL change that does not invalidate the cached decision or object.\n- **Previews and thumbnails:** generated into a public bucket or behind a guessable path while the original is private.\n- **Logs, traces, analytics, crash reports:** private content or credentials sent to a store with a broader audience or tenant mixing (secrets-and-crypto-review for the credential case).\n- **Notifications and emails:** a digest built from the list of everything, not the list the recipient may see.\n\n## 5. Export, Backup, Import, Restore\n\n- **Export scope:** each item is authorized after selection, not only the request; deleted, draft and private fields are excluded; the download of the finished file is authorized again (the export id is not a bearer token).\n- **Import and restore:** archive contents are untrusted input. Owner ids, roles, statuses and foreign keys from the file are rewritten to the importer's scope; an import that can overwrite existing records checks write access to each one.\n- **Restore and undo:** restoring a snapshot can bring back a removed membership, a revoked key or a permission that current policy no longer allows — re-authorize restored state.\n\n## 6. Migrations and Backfills\n\n```sql\n-- ❌ the new column makes every existing document public\nALTER TABLE documents ADD COLUMN is_public boolean NOT NULL DEFAULT true;\n-- ✅ existing rows keep their current exposure; new rows opt in\nALTER TABLE documents ADD COLUMN is_public boolean NOT NULL DEFAULT false;\n```\n\nAlso: a backfill that assigns orphaned rows to a default organization; a nullable new `tenant_id` read with `OR tenant_id IS NULL` (every tenant sees the legacy rows); dual-read code where the old and the new path apply different defaults during rollout; an id format change that lets old and new ids collide.\n\n## 7. Deletion and Revocation\n\n- **Soft-delete bypass:** the default scope hides deleted rows, but a direct lookup, a relation, a search, a background job or an `Unscoped()` path returns or acts on them.\n- **Re-registration:** a deleted username, email or domain can be claimed by someone else while old references (shares, invites, webhooks, SSO mappings) still point at it.\n- **Stale authority:** removing a member, downgrading a role or revoking a key does not end existing sessions, cached permission decisions, WebSocket subscriptions, scheduled jobs or issued signed URLs.\n- **Queued work after delete:** a retry or a queued export recreates or re-sends data that was deleted after it was enqueued.\n\n## Severity Guide\n\nReading or changing another tenant's data through any copy → HIGH; CRITICAL when unauthenticated or across every tenant. Revoked access that keeps working → HIGH when it grants writes or secrets, MEDIUM for reads of non-sensitive data. A migration that exposes existing private records → HIGH. Retention longer than a privacy preference, with no unauthorized reader → not a finding.\n\n## Common Mistakes\n\n- Reporting a missing `tenant_id` column on a table every path reaches through a scoped repository — read the repository.\n- Treating a privacy preference or retention wish as an access boundary.\n- Reporting cache keys without the tenant when the cached value is public or the id is globally unique and the ACL is checked after the read.\n- Asserting what an external cache, CDN, replica or backup does — when the policy is not in the repository and it decides the finding, it is a needs-validation note (source-visibility-needs-validation).\n\n## Red Flags\n\n- `Unscoped()`, `unscoped`, `BYPASSRLS`, a service-role key or a \"system\" repository reached from a request handler.\n- `SECURITY DEFINER` on a function that reads tenant data.\n- A cache, object or lock key built without the tenant from a client-chosen value.\n- An import that inserts the file's `owner_id`, `org_id`, `role` or `status` as given.\n- A delete or revoke handler that updates one table and touches no session, cache, index or job.\n- A new boolean visibility column defaulting to `true`.\n\n## References (names and links only)\n\n[OWASP Top 10:2025 A01 Broken Access Control](https:\u002F\u002Fowasp.org\u002FTop10\u002F2025\u002F) · [ASVS 5.0 V8 Authorization, V14 Data Protection](https:\u002F\u002Fgithub.com\u002FOWASP\u002FASVS\u002Ftree\u002Fmaster\u002F5.0\u002Fen) · CWE-212, 359, 613, 639, 863 · [PostgreSQL row security policies](https:\u002F\u002Fwww.postgresql.org\u002Fdocs\u002Fcurrent\u002Fddl-rowsecurity.html) · [Cloudflare security-audit-skill](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsecurity-audit-skill)\n","# Data Isolation and Lifecycle\n\n## Overview\n\nEndpoint checks protect one door. Data has many copies — a cache entry, a search document, a thumbnail, an export file, a log line, a backup, a queued job — and each copy has its own reader and its own retention. Isolation fails where a copy forgets who owns the data, or where a deleted or revoked record keeps working.\n\n**Core principle:** pick one protected record the diff touches and follow it through every write, read, copy and state change. At each edge, name the code that enforces its owner. A tenant column is not that code.\n\n## 1. A Tenant Field Is Not Isolation (CWE-639, CWE-863)\n\nThe owner column exists; the question is which query, policy or key enforces it on this path.\n\n- **Bypass clients:** Supabase's service-role key or a Postgres role with `BYPASSRLS` used in a request handler; a \"system\" repository that skips the tenant filter, called from a user-facing path.\n- **Unscoped escapes:** GORM `Unscoped()` (it also drops the soft-delete filter), Rails `unscoped`, a Django manager that is not the filtered default, Hibernate filters that do not apply to native queries, Prisma middleware that a raw query skips.\n- **Policy and query disagree:** row-level security on the table but the new view, function (`SECURITY DEFINER`), materialized view or aggregate reads around it; a join that brings in rows of another tenant through an unscoped relation.\n\n```sql\n-- ❌ SECURITY DEFINER runs as the function's owner; a table owner bypasses RLS\n--    (unless FORCE ROW LEVEL SECURITY is set), so the caller's policy never applies\nCREATE FUNCTION project_stats(p uuid) RETURNS TABLE(...) LANGUAGE sql SECURITY DEFINER\nAS $$ SELECT ... FROM tasks WHERE project_id = p $$;\n-- ✅ SECURITY INVOKER (the default), or filter on the caller's tenant inside the function\n```\n\n## 2. Keys and Namespaces Without the Tenant\n\nTwo principals collide on one logical key even though their records have separate owners:\n\n- cache keys built from a user-chosen name (`report:` + name) or from an id that is only unique per tenant;\n- object-storage keys from the uploaded filename (`uploads\u002Favatar.png`) — one tenant overwrites or reads another's;\n- search document ids, deduplication keys, idempotency keys and lock names without the tenant;\n- globally unique constraints that let one tenant squat or probe another tenant's slug, email or domain.\n\n```go\n\u002F\u002F ❌ every org shares one key space\nkey := fmt.Sprintf(\"dashboard:%s\", req.Name)\n\u002F\u002F ✅\nkey := fmt.Sprintf(\"org:%s:dashboard:%s\", auth.OrgID(ctx), req.Name)\n```\n\n## 3. Signed URLs and Shared Links\n\n- A presigned URL that allows more than the issuer could do: `PUT` where `GET` was meant, a key prefix instead of one object, a content type the client chooses, a week of validity for a one-time download.\n- A share token that unlocks a folder when it was issued for one file, or keeps working after the item was unshared or its ACL changed.\n- A link id that is the object id, so any authenticated user with the id gets the object (access-control-and-idor).\n\n## 4. Derived Copies That Forget the ACL\n\n- **Search and vector indexes:** the filter is applied at ingestion but not at query time, or permission changes never reach the index (llm-and-agent-security §6 for embeddings and context caches).\n- **Caches:** a private response cached under a key without the user; an ACL change that does not invalidate the cached decision or object.\n- **Previews and thumbnails:** generated into a public bucket or behind a guessable path while the original is private.\n- **Logs, traces, analytics, crash reports:** private content or credentials sent to a store with a broader audience or tenant mixing (secrets-and-crypto-review for the credential case).\n- **Notifications and emails:** a digest built from the list of everything, not the list the recipient may see.\n\n## 5. Export, Backup, Import, Restore\n\n- **Export scope:** each item is authorized after selection, not only the request; deleted, draft and private fields are excluded; the download of the finished file is authorized again (the export id is not a bearer token).\n- **Import and restore:** archive contents are untrusted input. Owner ids, roles, statuses and foreign keys from the file are rewritten to the importer's scope; an import that can overwrite existing records checks write access to each one.\n- **Restore and undo:** restoring a snapshot can bring back a removed membership, a revoked key or a permission that current policy no longer allows — re-authorize restored state.\n\n## 6. Migrations and Backfills\n\n```sql\n-- ❌ the new column makes every existing document public\nALTER TABLE documents ADD COLUMN is_public boolean NOT NULL DEFAULT true;\n-- ✅ existing rows keep their current exposure; new rows opt in\nALTER TABLE documents ADD COLUMN is_public boolean NOT NULL DEFAULT false;\n```\n\nAlso: a backfill that assigns orphaned rows to a default organization; a nullable new `tenant_id` read with `OR tenant_id IS NULL` (every tenant sees the legacy rows); dual-read code where the old and the new path apply different defaults during rollout; an id format change that lets old and new ids collide.\n\n## 7. Deletion and Revocation\n\n- **Soft-delete bypass:** the default scope hides deleted rows, but a direct lookup, a relation, a search, a background job or an `Unscoped()` path returns or acts on them.\n- **Re-registration:** a deleted username, email or domain can be claimed by someone else while old references (shares, invites, webhooks, SSO mappings) still point at it.\n- **Stale authority:** removing a member, downgrading a role or revoking a key does not end existing sessions, cached permission decisions, WebSocket subscriptions, scheduled jobs or issued signed URLs.\n- **Queued work after delete:** a retry or a queued export recreates or re-sends data that was deleted after it was enqueued.\n\n## Severity Guide\n\nReading or changing another tenant's data through any copy → HIGH; CRITICAL when unauthenticated or across every tenant. Revoked access that keeps working → HIGH when it grants writes or secrets, MEDIUM for reads of non-sensitive data. A migration that exposes existing private records → HIGH. Retention longer than a privacy preference, with no unauthorized reader → not a finding.\n\n## Common Mistakes\n\n- Reporting a missing `tenant_id` column on a table every path reaches through a scoped repository — read the repository.\n- Treating a privacy preference or retention wish as an access boundary.\n- Reporting cache keys without the tenant when the cached value is public or the id is globally unique and the ACL is checked after the read.\n- Asserting what an external cache, CDN, replica or backup does — when the policy is not in the repository and it decides the finding, it is a needs-validation note (source-visibility-needs-validation).\n\n## Red Flags\n\n- `Unscoped()`, `unscoped`, `BYPASSRLS`, a service-role key or a \"system\" repository reached from a request handler.\n- `SECURITY DEFINER` on a function that reads tenant data.\n- A cache, object or lock key built without the tenant from a client-chosen value.\n- An import that inserts the file's `owner_id`, `org_id`, `role` or `status` as given.\n- A delete or revoke handler that updates one table and touches no session, cache, index or job.\n- A new boolean visibility column defaulting to `true`.\n\n## References (names and links only)\n\n[OWASP Top 10:2025 A01 Broken Access Control](https:\u002F\u002Fowasp.org\u002FTop10\u002F2025\u002F) · [ASVS 5.0 V8 Authorization, V14 Data Protection](https:\u002F\u002Fgithub.com\u002FOWASP\u002FASVS\u002Ftree\u002Fmaster\u002F5.0\u002Fen) · CWE-212, 359, 613, 639, 863 · [PostgreSQL row security policies](https:\u002F\u002Fwww.postgresql.org\u002Fdocs\u002Fcurrent\u002Fddl-rowsecurity.html) · [Cloudflare security-audit-skill](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsecurity-audit-skill)\n",{"name":5,"source":24,"category":25,"tech_stack":26,"description":7},"cloudflare\u002Fsecurity-audit-skill (MIT) data-isolation and lifecycle attack classes, adapted to diff review; own wording; OWASP Top 10:2025 A01 and CWE cited by name only","security","Web & API","main","910394a0b6db9fc8c9a8f36328ec421d3ebd8b38","catalog\u002Fagents\u002Fsecurity-agent\u002Fskills\u002Fdata-isolation-and-lifecycle",18,"https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper","https:\u002F\u002Ftasktrooper.ai","https:\u002F\u002Fgithub.com\u002Fmakifbaysal","Senior Software Developer","2026-11-15 04:50:29",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add makifbaysal\u002Ftasktrooper --skill data-isolation-and-lifecycle",{"tool":42,"command":43},"bunx","bunx skills add makifbaysal\u002Ftasktrooper --skill data-isolation-and-lifecycle",{"tool":45,"command":46},"pnpm","pnpm dlx skills add makifbaysal\u002Ftasktrooper --skill data-isolation-and-lifecycle","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fsecurity-agent\u002Fskills\u002Fdata-isolation-and-lifecycle\u002FSKILL.md",true,[],[51,57,64,71,78,85],{"skillNo":52,"name":53,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":19},"01M7CSVEPQW6J6TD6CS2T5FPNZ","visual-craft","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fvisual-craft\u002FSKILL.md",[],[],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M7CSVAQG91ETHQ0HBNZDG5FR","ux-copy","Use when you write any words a user reads in a mockup or a hand-off - content language and voice, buttons, labels, errors, empty states, confirmations, numbers and dates, and the longest-string check","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fux-copy\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"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},"01M7CSV6H0J38659NDXHJQ8396","screen-mockup-html","Use when you draw screens as the design task's HTML mockup - ONE canvas document holding every screen and every variant side by side, the sanitizer-safe recipe, phone and wide frames, the states grid, static control states, and the loopback self-check with screenshots at 375, 768 and 1440 attached to the task","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fscreen-mockup-html\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M7CSV3JFRF3BM3XK52M7YEYR","performance-awareness","How the performance score moves for your role. Use when the score context shows a declining trend, or before handing off work you have not self-checked against every criterion.","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fperformance-awareness\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M7CSTZDH00YRF5SCT7BRT9QD","design-variants","Use when a screen design needs variants - how many, variants as side-by-side rows on the one canvas, what makes two variants genuinely different, recommending one, how the human's choice is read, and narrowing to the chosen one in revision","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fdesign-variants\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7CSTV6P3SM3PAE28DB0RF77","design-system-authoring","Use when you derive, change or extend a design system - where tokens live per stack, the DTCG token tree, role-based names for both themes, base vs layer vs drift, the DESIGN.md section order, the inventory format, the contrast check and the lint every proposal returns","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fdesign-system-authoring\u002FSKILL.md",[],[]]