Repository navigation
fix(platform): accept absolute paths for any host and stop blaming the ceiling for a missing grant - #552
Merged
morluto merged 1 commit intoOct 5, 2026
Conversation
…e ceiling for a missing grant Addresses #548 and #545. #548: processScenarioSchema required a leading "/" for executable, working_directory and filesystem_roots, so no process scenario could be expressed on Windows at all. The report suggested node:path's isAbsolute, but that answers for the host running the check: on Linux `C:\tools` is not absolute, so a scenario captured on Windows would fail validation when it is replayed, compared, or asserted in a test on another host. A boundary schema must not vary with its evaluator, so the check accepts the POSIX form, a Windows drive path and a UNC share everywhere. The rejection message now names the constraint instead of leaving the caller to infer it from "invalid request". The HTTP `path` field inside `checkpoints` is an URL path and is deliberately left alone. I checked whether this merely moved the failure downstream: containment is enforced by isPathWithinRoot, which already uses host-aware path.relative, so validation really was the only blocker. #545: when a scope is inside the administrator ceiling but no grant was ever issued, the denial still pointed at widening the ceiling -- advice that cannot help, since the ceiling already permits the operation. The `missing` payload is computed against candidate *grants*, so it describes what a grant must cover, not a ceiling gap. `PermissionRemediation` gains a `grant` variant saying exactly that, and PermissionAuthority selects it when the denial is not a ceiling violation. An explicitly requested remediation is still honoured, and a genuine ceiling violation still says "configure".
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
morluto
deleted the
fix/windows-scenario-paths-and-permission-remediation
branch
October 5, 2026 10:50
darsrc
pushed a commit
to darsrc/rea
that referenced
this pull request
Oct 10, 2026
…e ceiling for a missing grant (morluto#552) Addresses morluto#548 and morluto#545. morluto#548: processScenarioSchema required a leading "/" for executable, working_directory and filesystem_roots, so no process scenario could be expressed on Windows at all. The report suggested node:path's isAbsolute, but that answers for the host running the check: on Linux `C:\tools` is not absolute, so a scenario captured on Windows would fail validation when it is replayed, compared, or asserted in a test on another host. A boundary schema must not vary with its evaluator, so the check accepts the POSIX form, a Windows drive path and a UNC share everywhere. The rejection message now names the constraint instead of leaving the caller to infer it from "invalid request". The HTTP `path` field inside `checkpoints` is an URL path and is deliberately left alone. I checked whether this merely moved the failure downstream: containment is enforced by isPathWithinRoot, which already uses host-aware path.relative, so validation really was the only blocker. morluto#545: when a scope is inside the administrator ceiling but no grant was ever issued, the denial still pointed at widening the ceiling -- advice that cannot help, since the ceiling already permits the operation. The `missing` payload is computed against candidate *grants*, so it describes what a grant must cover, not a ceiling gap. `PermissionRemediation` gains a `grant` variant saying exactly that, and PermissionAuthority selects it when the denial is not a ceiling violation. An explicitly requested remediation is still honoured, and a genuine ceiling violation still says "configure".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #548 and #545.
#548 — process scenarios were unexpressable on Windows
processScenarioSchemarequired a leading/onexecutable,working_directoryandfilesystem_roots, so validation rejected every Windows scenario before anything else could run. Process capture is one of the few inherently cross-platform capabilities REA has, so this madecapture_process_scenarioandcompare_process_capturesunusable there.The suggested fix was subtly wrong, so this does something else. The report proposes
node:path'sisAbsolute, which answers for the machine doing the checking: on Linux,C:\toolsis not absolute. That works on Windows but silently breaks everywhere a Windows scenario is validated by another host — replay, comparison, or a test asserting on a fixture. A boundary schema must not vary with its evaluator, so the predicate accepts the POSIX form, a Windows drive path and a UNC share on every host, and is exported and unit-tested directly.The rejection message now names the constraint, so a rejected path is actionable rather than surfacing as a generic "invalid request".
Two things I checked rather than assumed:
isPathWithinRoot, which already uses host-awarepath.relative, andProcessCaptureAuthoritycanonicalises both sides before comparing. Execution was never POSIX-only — validation really was the sole blocker.pathfield insidecheckpointsneeded the same treatment. It is an HTTP path, not a filesystem path, sostartsWith("/")is correct there and is deliberately unchanged.#545 — a denial that blamed the wrong thing
When a scope is inside the administrator ceiling but no grant was ever issued, the error still told the caller to "Add the exact missing scope beneath the administrator ceiling". That advice cannot work: the ceiling already permits the operation. The
missingpayload is computed against candidate grants, not the ceiling, so it describes what a grant must cover — hence the report's observation that entries inmissingappear verbatim inceiling.PermissionRemediationgains agrantvariant that says the ceiling already covers the scope and names the two real routes (a project grant, or the documented auto-grant setting).PermissionAuthorityselects it whenever the denial is not a ceiling violation.Preserved deliberately: a genuine ceiling violation still says
configure; an explicitly requestedelicit/restartis still honoured;missingis unchanged, because it is accurate — it just was not being read as "what a grant must cover".On the report's related sharp edge
The
executablesdirectory-vs-exact containment semantics are noted and not changed here. That is a real documentation gap, but it is a contract question about what a scope means, not a bug, and folding it into a fix for two unrelated defects would make the change harder to review. Worth its own issue.Tests
processScenario.test.ts: POSIX, Windows-drive (both separators) and UNC paths all validate on a Linux host, Windowsfilesystem_rootsaccepted, five relative/empty forms still rejected, and the actionable message asserted.PermissionAuthorityRemediation.test.ts: covered scope and an empty request both resolve togrant; a genuine ceiling violation still resolves toconfigure; an explicitelicitis untouched.Full suite green (1987 passed) with the regenerated catalog; typecheck, lint and prettier clean.