feat: revalidate device permissions against OS state before use - #471
Open
TarikGul wants to merge 8 commits into
Open
feat: revalidate device permissions against OS state before use#471TarikGul wants to merge 8 commits into
TarikGul wants to merge 8 commits into
Conversation
Regenerates the host-callback surface: permissionStatus is an optional capability group, so a host that omits it is unchanged.
Amends RFC-0002's permission lifecycle, the protocol doc comment on HostDevicePermissionRequest, and the platform/host READMEs.
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.
The decision rule
The two gates are combined, not substituted:
The host admin surface (
CoreAdmin::get_permission_authorization_status) keeps reporting stored state on its own. It exists to show what the user decided about a product, and folding OS state into it would make that reading wrong.Hosts
truapi-host-cliserves the capability, driven byTRUAPI_OS_DENIED_PERMISSIONS(comma-separated capability names, matched case-insensitively). Capabilities it does not name reportNotApplicablerather thanGranted, since a terminal has no OS gate to grant anything.The WASM hosts install the adapter when the JS side supplies
devicePermissionStatus.Not in scope
Native hosts cannot answer yet:
HostCallbackshas no status method, so iOS and Android adoption is a follow-up on each. Until then they resolve from stored state, exactly as now.granted: falsestill covers both a product-scoped refusal and an OS-level one, so a product cannot tell "you declined this" from "the OS revoked this, open system settings". The two have different remedies. Distinguishing them needs a richer device-permission response than the current boolean, so it waits for a breaking-change window.Verification
Nine unit tests cover the decision matrix in
host_logic::permissions. Three integration tests drive a realpermissions_request_device_permissionframe through the generated dispatcher, which is the only place the plumbing from installer to runtime to service is exercised.Every one of those tests was confirmed to fail under a deliberate mutation: dropping the OS-denial override, never re-prompting after a reset, mapping a query failure to a refusal, clearing the stored grant on refusal, re-prompting on any
NotDetermined, treating an absent adapter as a refusal, an installer that stores nothing, and a runtime that builds the service without the adapter.Live, against the
truapi-hostCLI with persisted state across processes:TRUAPI_OS_DENIED_PERMISSIONSgranted: truegranted: truegranted: truegranted: truecameragranted: falsegranted: truegranted: truegranted: truegranted: truegranted: truegranted: falsegranted: falseC is the fix: a persisted grant stops answering while the OS refuses it, and only for the capability named. E shows the refusal did not erase the grant. F and G separate stored state from prompting: with no auto-accept and stdin closed, warm state still answers
trueand cold state cannot.rel: #334