tenant-isolation
Skill2 starsChanged 4 months agoApache-2.0View on GitHub
Implement, review, or test AI Governance Control Plane authentication, authorization, tenant context propagation, and tenant data isolation. Use for protected reads or writes, repositories, workers, audit records, cache and ontology access, external-provider calls, and any change that could expose one tenant's data to another.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- raphaelbleier/mythos-sectheir own version, first seen Nov 29, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- raphaelbleier/mythos-sec★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- console/AGENTS.mdAGENTS.md
- keycloak-postgres/AGENTS.mdAGENTS.md
- api-changeSkill
- domain-featureSkill
- governance-policySkill
- keycloak-service-identitySkill
- model-runtime-capability-profileSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Treat tenant and actor context as mandatory security input for every protected operation.
- Very specific: line 13
Read root AGENTS.md and src/ai_governance/tenancy/AGENTS.md, then read the scoped instructions for each changed transport, service, …
- Distinctive: line 24
Add a negative test: create or request the same identifier in two tenants, then prove that each tenant can see only its own resource.
- Distinctive: line 26
Do not log raw tokens, secrets, or unnecessary identity attributes.
- Distinctive: line 64
Run the integration test first, followed by the closest protected API, service, or worker test:
- Distinctive: line 72
When a change spans a repository, worker, audit path, ontology projection, or provider call, add a focused negative test in that boundary …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Tenant Isolation
Treat tenant and actor context as mandatory security input for every protected operation.
Workflow
- Read root
AGENTS.mdandsrc/ai_governance/tenancy/AGENTS.md, then read the scoped instructions for each changed transport, service, repository, worker, or provider layer. - Trace the context from authenticated principal through the approved context dependency or factory into the application service and every persistence or provider call.
- Authenticate first, authorize second, then access data. Deny by default when context is missing, invalid, or ambiguous.
- Scope every lookup, list, idempotency key, event, audit record, cache entry, ontology identifier, and external request by organisation and project where applicable.
- Add a negative test: create or request the same identifier in two tenants, then prove that each tenant can see only its own resource.
- Do not log raw tokens, secrets, or unnecessary identity attributes.
Context pattern
Pass the established immutable context; do not rebuild it from client-supplied values inside application code.
@dataclass(frozen=True)
class TenantContext:
organization_id: str
project_id: str | None
actor_id: str
request_id: str
correlation_id: str | None = NoneFor an API route, depend on get_compatible_tenant_context and pass the
resulting context to the service. For a worker, reconstruct only the
tenant context captured when the job was submitted; never accept a new caller
scope for an existing job.
Isolation test pattern
Make collisions intentional. The current integration test submits the same input and idempotency key in two tenant scopes, then verifies that IDs and lists do not cross the boundary. Use the same approach for the resource being changed.
assert repository.find_by_id("job_a", "org_b", "project_b") is None
assert repository.list_jobs(
organization_id="org_a", project_id="project_a"
) == [first]Verify
Run the integration test first, followed by the closest protected API, service, or worker test:
uv run ruff check src/ai_governance/tenancy
uv run pytest tests/integration/test_tenant_isolation.pyWhen a change spans a repository, worker, audit path, ontology projection, or provider call, add a focused negative test in that boundary as well.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

