Security Model
The @ Rule
Trust Configuration
File:~/.niia/trust.toml
Trust Levels
| Configuration | Effect |
|---|---|
| Empty file | All external packages blocked |
owner = "@monolex" | All @monolex packages auto-trusted |
"@hong/translate" | Single package trusted |
"@company/*" | Entire scope trusted |
When Untrusted
Output Boundary Markers
External package output is captured and wrapped:Why This Matters
AI tools read stdout. Without markers, a malicious package could output text that tricks the AI. Markers identify the source so the AI knows “this came from an external tool.”Spoofing Prevention
If a package tries to output[/niia:@hong/translate] to break out:
Package Structure
Security Boundaries
| Layer | Protection |
|---|---|
| Namespace | @ prefix separates external from built-in |
| Discovery | Only ~/.niia/packages/ is searched (not PATH) |
| Trust gate | trust.toml whitelist (default: all blocked) |
| Output capture | stdout captured, never passed through directly |
| Marker wrapping | [niia:@scope/name] boundary tags |
| Spoofing defense | Marker patterns escaped in output |
| Size limit | 1MB maximum output |
What NIIA Cannot Do
NIIA cannot restrict what a trusted package does at runtime:- Network calls are not blocked
- Filesystem access is not restricted
- The trust gate is the only security boundary