fix(web): let a malformed _meta.ui stop the carrier lookup
uiMeta returned undefined for both "this bag declares no ui" and "its ui
is unusable", so a content item declaring `ui: null` fell through and was
granted whatever a BROADER carrier asked for — wrong precedence, wrong
direction to fail in. It now distinguishes the two: no `ui` key means
keep looking, a declared-but-malformed one decides for "no hints".
Also pin the full three-way precedence with a case carrying all three
carriers at once (no prior case would have caught the first two operands
being swapped), and state why a permission's object value need not be
empty: `{}` is the spec's extension point, so rejecting a populated one
would drop grants from servers written against a newer spec.
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
parent
e2a88d49dd
commit
53943c2ef8
1 changed files with 117 additions and 29 deletions
|
|
@ -107,6 +107,15 @@ describe("approveSandboxPermissions", () => {
|
|||
warn.mockRestore();
|
||||
});
|
||||
|
||||
it("accepts a non-empty object, since `{}` is the spec's extension point", () => {
|
||||
// The key's presence is the request; a field the host doesn't know can't
|
||||
// narrow it, and rejecting it would drop grants from servers written
|
||||
// against a newer spec. The value is normalized to `{}` on the way out.
|
||||
expect(approveSandboxPermissions({ camera: { enabled: false } })).toEqual({
|
||||
camera: {},
|
||||
});
|
||||
});
|
||||
|
||||
it("drops `false` without warning, and ignores unknown keys", () => {
|
||||
const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
|
||||
expect(
|
||||
|
|
|
|||
Loading…
Reference in a new issue