Instruction file imported from provos/ironcurtain (
.github/instructions/types.instructions.md). Copyright stays with the author.
Types Review Rules
Types in this directory define security-critical contracts shared across the codebase.
Mandatory Checks
PolicyDecisionStatusmust remain a three-state union:allow | deny | escalate. Adding or removing states changes the security model.ArgumentRoleis a union type with a compile-time completeness check (_ROLE_COMPLETENESS_CHECK). Adding a new role requires updating: the union type, the registry map, the completeness check record, and any relevant tool annotations.resolveRealPath()inargument-roles.tsis the canonical path resolution function. It must tryrealpathSync()first (symlink resolution), then parent-based resolution, thenpath.resolve()fallback. Simplifying the fallback chain removes symlink protection.SANDBOX_SAFE_PATH_ROLEScontrols which path roles bypass compiled rule evaluation when all paths resolve inside the sandbox. The set includesread-path,write-path,delete-path,write-history, anddelete-history. The history roles are safe here because they only discharge the path component — git operations that also carry agit-remote-urlrole (e.g.,git_push) still require compiled rule evaluation for the URL role. Do not add non-path roles (likegit-remote-urlorgithub-repo) to this set.SessionIduses a branded type pattern. Do not remove the__brandproperty or accept plainstringwhereSessionIdis expected.RoleDefinition.serverNamescontrols which servers see a role in annotation prompts. Universal roles (noserverNames) appear for all servers. Accidental removal ofserverNameswould expose server-specific roles globally.resolveStoredAnnotation()inargument-roles.tsis the sole boundary where conditional role specs are resolved into plainArgumentRole[]. Conditional roles can only narrow from the default (subset invariant enforced by Zod). Do not add alternative resolution paths — all consumers must receive pre-resolvedToolAnnotation.