Repository navigation
feat(contracts): send the user's permission keys in the UI context and release 1.5.0 - #12
Conversation
…d release 1.5.0 An app UI runs in a sandboxed iframe and cannot learn which of the app's permissions the current user holds, so it shows controls that fail with 403. The UI bridge context message gains the optional member permissionKeys: the keys from the manifest permissions that the user holds, unqualified, unique, in ascending ASCII order and at most 64, with the manifest key pattern. - Raise currentProtocolVersion and PROTOCOL_VERSION to 1.2.0. A host sends permissionKeys only to apps whose negotiated uiBridge is 1.2.0 or newer and always includes it for them; an empty array means none. Older bridge versions never receive it, because their strict validators reject it. bridgeVersion in runtime:bootstrap stays 1.0.0, and the platform still enforces x-rentnerproxy-access on every call. - Share the permission key schema between the manifest, operationAccess and the context, and export permissionKey from the schemas entry point. - Check unique, sorted keys in both SDKs (Zod refinement and ProtocolContracts), with shared fixtures for keys, an empty array, duplicates, unsorted, qualified and too many keys. - Add negotiation fixtures for a 1.2.0 offer and update the tests, the pipeline smoke and the package smoke that pinned 1.1.0. - Bump the contract, crates and npm package to 1.5.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 52 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
@coderabbitai review |
Action not completed
|
App SDK 1.5.0 raises the offered protocol version from 1.1.0 to 1.2.0 for appProtocol, platformApi and uiBridge; UI bridge 1.2.0 adds the user's permissionKeys to the UI context message. Negotiation is unchanged, so the candidate pipeline now accepts apps that require protocol 1.2.0 while older apps keep their lower bound. - Use rentnerproxy-app-catalog, -app-pipeline and -artifacts 1.5.0 and @rentnerproxy/app-contracts ^1.5.0. - The smoke test negotiates 1.1.0 for >=1.1.0 and 1.2.0 for >=1.2.0, and rejects >=1.3.0 as newer than offered next to the major 2 case. Refs RentnerProxy/app-sdk#12 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Change
An app UI runs in a sandboxed iframe and cannot learn which of the app's permissions the current user holds. The platform already knows them (
AppUiSummary.permissionKeysholds only the keys the user has), but the UI bridge has no member to carry them. So the Monitoring app shows an editable form to read-only users until a save fails with403.The UI bridge
contextmessage gains the optional memberpermissionKeys:permissionsthat the current user holds, as the manifest declares them (without the app ID);^[a-z][a-z0-9-]{0,31}$;Negotiation picks the lower bound of each
requiresrange, so a new bridge member needs a protocol version that apps opt into. Following the 1.4.0 precedent,currentProtocolVersionandPROTOCOL_VERSIONrise to 1.2.0 forappProtocol,platformApianduiBridgetogether. The schema description and the README's protocol section now say:permissionKeysonly to apps whose negotiateduiBridgeis 1.2.0 or newer, and always includes it for them. An empty array means none.x-rentnerproxy-accesson every call.bridgeVersioninruntime:bootstrapstays the literal1.0.0.requires.uiBridge: ">=1.2.0 <2.0.0".No issue is linked: the change was requested to fix the read-only Monitoring UI.
Files
Contract (TS):
contracts/v1/ui-bridge.tsadds the member, with a Zod refinement for unique and sorted keys.manifest.tsnow exports a sharedpermissionKeyschema andmaxPermissions, which the manifest,operationAccessand the context all use, so the generated JSON Schema is unchanged apart from the new member.public-schemas.tsexportspermissionKey.primitives.tssets the protocol to 1.2.0 and the contract to 1.5.0.Contract (Rust):
ProtocolContracts::validaterejects acontextwhosepermissionKeysare not strictly ascending, so duplicates are rejected too. The JSON Schema already enforces the pattern and the maximum.PROTOCOL_VERSIONis now 1.2.0.Generated:
contracts.schema.json(both copies) andopenapi.json, regenerated withbun run contracts:generate.Fixtures:
protocol-fixtures.jsonhas 8 new context cases:null.fixtures.jsonhas 4 new negotiation cases: a 1.1.0 app keeps 1.1.0 on a 1.2.0 offer, a 1.2.0 app gets 1.2.0,uiBridge >=1.2.0gets 1.2.0 while the others keep 1.0.0, anduiBridge >=1.2.0against a 1.1.0 offer is rejected. TypeScript and Rust both run these fixtures.Tests:
permissionsitems and maximum.the_candidate_runtime_offers_the_exposed_protocol_versionassertion is updated. The smoke bootstrap now gets>=1.2.0→ 1.2.0,uiBridge >=1.2.0→ 1.2.0, and the "newer protocol" rejection moves to>=1.3.0..github/scripts/ci/package-sdk.ts) expects 1.2.0.Release 1.5.0: the Cargo workspace version, the inter-crate dependency versions,
Cargo.lock(viacargo update --workspace --offline) andpackages/app-contracts/package.jsonmove, the same set as fix(contracts): negotiate protocol versions per app and release 1.4.1 #11. The README protocol table gains the 1.2.0 row.Verification
bun run contracts:check,bun run typecheck,bun run lint(0 errors; 3 pre-existingconsistent-function-scopingwarnings),bun run test(479 pass),bun run release:check(1.5.0 consistent).bun run core:lint(clippy-D warningspasses; cargo reports its pre-existingunused dependency zipmanifest warning on Windows) andbun run core:test(all pass on Windows).cargo test --locked --workspace --all-targets --all-featuresin a disposable offline container passes, including the Unix-only runtimeserver.rs,client.rsandevents.rstests. It used Rust 1.99.1, the workspace MSRV; CI uses 1.100.0.bun run package:build <dir> <sha>: "Verified SDK 1.5.0 packages" for this commit, covering reproducible bundles, the npm consumer smoke and the Rust consumer smoke.Risks
uiBridgebelow 1.2.0 never see the member, and their strict validators keep working. The SDK's own validators accept contexts with and without it.permissionKeys(sorted and unique) exactly when the negotiateduiBridgeis at least 1.2.0. Apps such as Monitoring opt in withrequires.uiBridge: ">=1.2.0 <2.0.0"after adopting 1.5.0.v1.5.0onmain.🤖 Generated with Claude Code