[P1] Add persistent project-scoped authorization rules to the authority boundary #434
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/prolog-rlm#434
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent: #74
Depends on: #75, #53
Goal
Add persistent project-scoped authorization rules that let a trusted host/operator remember a bounded approval across restarts while continuing to use the existing #53 authority boundary.
This is the core semantic equivalent of a downstream UI action such as:
It is not a fifth authority tier, not persistent
allow_session, and not an alias fordangerous.Problem / motivation
#53 correctly implements runtime authority modes and exact pending-operation approval:
approve_diff;allow_once;allow_session;dangerous.allow_sessionis intentionally tied to a concrete runtime/session and cleared on teardown. That is the right behavior and must remain unchanged.What is missing is a separate trusted policy layer that can remember an earlier operator decision such as:
That remembered decision must be narrower than broad unattended authority and must remain subordinate to all current validation, capability, confinement, host-policy, effect-accounting, and cancellation boundaries.
Architectural boundary
Reuse
rlm_authority; do not buildauthority_v2.The intended flow is conceptually:
The exact insertion point must preserve #53's invariant that authority mediates an already-valid normalized operation. Persisted policy cannot be consulted early as a way to skip validation.
The persistent rule store comes from #75. This issue owns matching/resolution and integration with authority decisions, not generic storage.
Persistent authorization model
Support two deliberately distinct authorization classes.
1. Exact operation grant
An exact grant matches one canonical normalized operation identity including all security-relevant executable fields.
Examples of changes that must invalidate an exact grant when relevant to that operation:
Rendered strings are not the security identity when structured normalized fields are available.
2. Explicit bounded policy profile/pattern
A trusted host/provider may deliberately declare a closed, schema-validated bounded matcher/profile such as “the project's configured test operation family.”
This is not arbitrary regex/string matching over shell text and not a callable supplied by model/project data.
Bounded policies must have inspectable identity/version and closed matcher semantics so changes do not silently widen their match set.
Examples of safe directions to evaluate:
Do not expose arbitrary
call/1or repository-provided predicates as the match engine.Relationship to #53 operation fingerprints
#53's
rlm_operation_fingerprint/3intentionally fingerprints the normalized operation with its runtime authority context. That is correct for exact in-process pending approval, but an ephemeral runtime/session context cannot simply be persisted as the project grant identity and expected to mean the same thing after restart.This issue must explicitly design the composition. Acceptable directions include:
Do not weaken #53's exact fingerprint behavior merely to make persistence convenient.
The same normalized operation data should drive both systems so they cannot disagree about security-relevant payload changes.
Project scope
Use #75's canonical
ProjectIdentity; do not use rawcwdas the authorization key.The authorization contract must define deterministic behavior for:
The first slice need not solve universal distributed repo identity. It must fail closed when project identity cannot be resolved unambiguously for a persistent security decision.
Trusted grant creation
Only trusted host/operator code can create or revoke a persistent grant.
A model/agent may request persistent authorization and may provide the normalized proposed operation as data, but the final persistent mutation requires an explicit host/operator-mediated action.
There must be no API path where:
Likewise, discovering a project policy/config file must not itself create a persistent grant.
Core exposes state/decision APIs only. Downstream clients decide whether the action is labeled “Always allow,” “Allow for project,” etc.
Host ceiling and precedence
Persisted project authorization is eligible only when current trusted host/runtime policy permits it.
Required invariant:
The current four #53 modes are not automatically a complete representation of this new “persistent-grant eligibility” ceiling. The implementation must deliberately define how a host enables/forbids use of persisted grants without turning the runtime into
allow_sessionordangerous.For example, a default
approve_diffruntime may still be allowed by trusted host configuration to honor an explicitly stored project grant for one exact operation. Conversely a stricter host/run policy must be able to ignore/reject that grant and require approval/deny execution.Do not silently infer “stored grant exists, therefore it wins.”
Capability and hard-policy separation
A persistent authorization only answers the human-mediation question for an otherwise valid operation.
It never grants or bypasses:
tool(Name)or any other capability;An operation that fails any earlier hard boundary remains denied even if a matching persistent grant exists.
dangerousremains an explicit separate mode and cannot be synthesized from one or many project grants.Revocation and supersession
Persistent grants require stable inspectable rule IDs and first-class revocation.
Revocation must:
If a bounded policy profile changes version/shape, existing grants must either bind to the old exact profile identity or fail closed pending explicit migration/re-authorization. Do not reinterpret an old grant under a broader new matcher silently.
Retries, concurrency, effect identity, cancellation
Persistent permission answers whether mediation can be skipped, not whether an effect should execute again.
Compose with #57 where applicable so retries/replay do not use a persistent grant to duplicate an already-claimed side effect.
Preserve #63 cancellation linearization and #64 active-vs-terminal state rules. A stored grant cannot resurrect an operation whose owner/run has already been cancelled.
Concurrent grant creation/revocation/decision must have deterministic semantics. In particular, revocation racing with a not-yet-executing operation must have a documented linearization point and fail safe.
Public API direction
Exact predicates must follow repository conventions. Provide trusted host-facing semantics equivalent to:
The authority integration should consume a sanitized decision equivalent to:
Do not expose trusted matcher callables or persistence backend internals in model-facing operation data.
Immediate grant lookup/mutation over local state does not need fake async APIs. If the selected #75 backend is genuinely latency-bearing, use #54's canonical execute -> async Future -> sync-await direction rather than duplicating authorization logic.
Security invariants
allow_sessionremains non-persistent.dangerous.Interaction with existing modules/issues
#53 /
rlm_authorityThis issue extends policy resolution into the existing authority decision boundary. It must not duplicate pending approval, approve/deny/edit, allow-once consumption, session authority, authority events, or child narrowing.
#75
Owns durable scopes, project identity, records, persistence, provenance, and revocation substrate. This issue defines authorization-specific record schemas/matching and authority integration.
#16
An artifact may describe a proposed command or prior decision as knowledge, but artifact publication never creates a grant.
#52 / #72
An MCP server/profile can be configured and still require mediation. A stored project grant cannot bypass the closed MCP profile/package/config/cwd hard policy.
#57
Reuse canonical effect identity/once-only accounting when that issue establishes it. Persistent human authorization and effect deduplication are separate axes.
#68-#71
Compiled workflows may carry effective project policy as explicit operator state, but model-produced workflow/context data cannot mutate the grant store.
Acceptance criteria
dangerousand does not persist/restoreallow_session.Non-goals
allow_session.Dependencies / references
docs/authority-runtime.mdprolog/rlm_authority.plresearch/RLM-RESEARCH-003-typed-symbolic-execution.orgresearch/RLM-RESEARCH-009-durable-artifact-context.orgRLM-RESEARCH-010remains on draft PR #58 rather than canonicalmain; do not depend on unmerged details.Duplicate of #76 (pre-existing Forgejo mirror with GitHub number parity). Closing this accidental duplicate created by today's open-state sync; #76 stays canonical on Forgejo.