Jogosultságváltozás és auditnyom
Szerepkörváltás után frissen tartja a hozzáférési döntést, tiltott adatok felfedése nélkül követi a szabály- és jóváhagyástörténetet.
policy-audit-cache-invalidation
Nézd meg, miben segítMikor hasznos?
Akkor használd, ha visszavont hozzáférés gyorsítótárban marad vagy jóváhagyás elavul.
Miben segít neked?
- Érvényteleníti az érintett jogosultsággyorsítótárat munkamenetek és szolgáltatások között.
- Rögzíti az előtte-utána szabályt és jóváhagyási életciklust.
- Tiltáskor nem árulja el a nem hozzáférhető erőforrást.
Például ezt kérheted
Vonj vissza csapatszerepet aktív munkamenetben, igazolva azonnali tiltást és felelőshöz köthető auditnyomot. Visszavonás előtt tölts jogosultságcache-t, utána ismételd a védett kérést. Az elutasítás legyen azonnali, a napló nevezze meg a módosító személyt.
Részletes dokumentáció
Itt a skill eredeti útmutatóját, példáit és ellenőrzési szempontjait olvashatod az eredeti nyelven.
Összecsukás
Policy Audit & Cache Invalidation
When to Use
Use when implementing permission caching, JWT/session claim validation, policy decision logging, or compliance audit trails for authorization and approval systems.
1. Permission Cache Hygiene & Immediate Invalidation
Caching authorization decisions or embedding roles inside long-lived stateless JWTs introduces a dangerous revocation lag where a fired employee, downgraded member, or revoked API key retains access until TTL expiry:
- Never Cache Permission Decisions Indefinitely: Every cached role/permission lookup must have a short, bounded TTL and deterministic event-driven invalidation.
- Include Subject & Resource Version Stamps in Cache Keys:
- Maintain a
permissions_version(orupdated_atepoch) onworkspace_membershipsandusers. - When a user's role changes, a membership is revoked, a delegation is cancelled, or an organization's plan changes, increment
permissions_versionand purgetenant:${tenantId}:authz:${userId}:*.
- Maintain a
- Resource-State Decisions Must Not Be Stale-Cached:
- Decisions that depend on mutable resource state (
quote.status === 'pending_approval',quote.amount,account.owner_id) must evaluate against the current database row (or transaction-locked row for mutations), never a stale cached boolean.
- Decisions that depend on mutable resource state (
2. Structured Authorization & Approval Audit Trail
Sensitive access checks, policy mutations, and approval decisions must be traceable and tamper-evident:
What Must Always Be Logged
- Policy & Role Mutations: Role assignments, permission matrix edits, delegation grants/revocations, and approval threshold configuration changes (with
beforeandafterdiffs). - Approval Lifecycle Events:
approval.requested,approval.approved,approval.rejected,approval.superseded(when edits invalidate a prior approval), andapproval.expired—recordingsubject_type,subject_id,subject_version,payload_sha256,requester_id,decider_id, andreason. - Sensitive Reads & Authorization Denials:
- Access to restricted/PII fields or bulk data exports (
export.executed). - High-severity authorization denials (
authz.deniedon privilege escalation attempts, cross-tenant probes, or self-approval attempts), including which policy rule denied the action (rule: 'sod.no_self_approval').
- Access to restricted/PII fields or bulk data exports (
Safe Error Responses (Zero Data Leakage on Denial)
- Record the detailed denial reason (
missing_role,wrong_department,status_locked,cross_tenant_mismatch) in the server-side audit log. - Return only a safe, minimal error to the caller (
404when the caller has no read visibility on the resource;403with a domain reason code likeself_approval_forbiddenorinsufficient_roleonly when the caller is already authorized to view the resource).
Csomagban lévő fájlok 1
SKILL.md
