fix: read the core's real permission header format (blank-page bug) #2
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/core-permission-format"
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?
Fixes the reason the module rendered a blank page even though it installed, ran healthy and served its assets correctly.
What was wrong
The core sends the resolved permission map as a JSON object:
The module split that string on commas, shredding it into fragments like
{"dashboard.view":trueand"locations.view":true. Every permission check then failed, so every tab was filtered out and every route bounced to a redirect — an empty render with no console error, which is exactly why it looked like nothing was wrong.The real contract, read off the core's proxy rather than assumed
x-ion-userx-ion-permissionstrue/false/'view'/'control'x-ion-permission-scope'*'for an admin, otherwise'user'x-ion-module-accessnone/view/controlfor this moduleChanges
identity.jsparses the object form, and still accepts a JSON array or CSV so a future change on the core side degrades to a permission error rather than a blank pagefalseand'none'are correctly not granted;'view'/'control'arex-ion-usercarries noisAdminflagmodule.<name>in the map when the header is absentwhoamireports scope, wildcard, and which of the module's 26 declared keys the caller actually holds — so the next mismatch is one request to diagnoseVerification
Also in this release
updates/manifest.jsonbumped to1.0.1with the new image.Separate issue, not fixed here
The manifest's
"icon": "server"renders as literal text in the core's sidebar and module list, giving "serverIon-HomeLab". That is core-side icon handling, so it belongs in an Ion-OS change rather than this one.The module installed, ran healthy and served correctly, but rendered a blank page. Cause: the core sends the resolved permission map as a JSON OBJECT {"dashboard.view":true,"module.ion-homelab":"control",...} and the module split that string on commas, shredding it into fragments like '{"dashboard.view":true'. Every permission check then failed, so every tab was filtered out and every route bounced — an empty render with no console error, which is why it looked like nothing was wrong. Read off the core's proxy rather than assumed, the actual contract is: x-ion-user a bare username string, not JSON x-ion-permissions a JSON object; true / false / 'view' / 'control' x-ion-permission-scope '*' for an admin, else 'user' x-ion-module-access none | view | control for this module Changes - identity.js parses the object form, and still accepts a JSON array or CSV so a future change on the core side degrades to a permission error, not a blank page - false and 'none' are correctly NOT granted; 'view'/'control' are - admin detected from the scope marker, since x-ion-user carries no isAdmin flag - module access falls back to module.<name> in the map when the header is absent - a malformed header now fails closed with 403 instead of parsing to nonsense - whoami reports scope, wildcard and which declared keys the caller actually holds, so the next mismatch is one request to diagnose - client trusts the server's wildcard rather than re-deriving it 11 regression tests pin the real formats. 56/56 tests pass.