Skip to content

Gate and /_apps launcher call one predicate, so a runtime grant shows in the launcher - #32

Merged
thorwhalen merged 2 commits into
mainfrom
fix/gate-and-launcher-share-predicate
Sep 25, 2026
Merged

thorwhalen merged 2 commits into
mainfrom
fix/gate-and-launcher-share-predicate

Conversation

@thorwhalen

Copy link
Copy Markdown
Member

The gate side of i2mint/enlace#35 (the enlace side landed in i2mint/enlace#56, released as enlace 0.1.41).

What was wrong

This plugin's gate allowed static allowed_users ∪ live runtime grants, compared case-insensitively. enlace core's /_apps launcher read only the static list, case-sensitively. A user granted access at runtime could open the app but never see it in the launcher. Every check read green, and all the user saw was a launcher with the app missing.

The fix

  • PlatformAuthMiddleware's protected:user allowlist check now calls enlace.access.is_user_allowed, the same predicate the launcher calls. Grants are resolved by enlace.access.granted_users, which runs per request and fails closed when the grants store errors, as before.
  • wire() builds one grants_resolver and hands it to both sides: to the gate (dynamic_allowed_users=) and to enlace core via parent.state.dynamic_allowed_users. There is no second implementation left to drift.
  • The dependency is now enlace>=0.1.41.

Tests

tests/test_launcher_gate_agree.py runs the real gate and the real launcher side by side. It asserts "opens ⟺ listed" for static-only, grant-only, both and neither users, with mixed-case allowlists and grants, plus an open app (no allowlist). It also checks that granting, then expiring, reaches both sides without a restart. Without this change, the grant cases fail. An independent adversarial review confirmed that removing either the launcher's use of grants or the plugin's injection fails these tests.

Behaviour notes (from the adversarial review)

  • A session record with no user_id is now refused by the gate, even for an open app. Every session creator sets user_id, so only a malformed record is affected. This is the stricter direction.
  • The grants-failure warning keeps its text but is now emitted by the enlace.access logger, one line per failure, with the traceback at DEBUG.

Deploy note: bump the downstream lock's enlace and enlace_auth pins together.

https://claude.ai/code/session_01JQJh4hGdYjSKiFkyj9zrAh

… in the launcher

The request-time gate unioned static allowed_users with live runtime grants;
enlace core's launcher read only the static list. A granted user could open an
app but never see it (i2mint/enlace#35).

The gate's allowlist check now calls enlace.access.is_user_allowed, the same
predicate the launcher calls, with grants resolved by enlace.access.granted_users
(per request, fail-closed on store errors). The plugin builds the grants
resolver once and hands it to both the gate and enlace core (via the
dynamic_allowed_users state slot).

New tests run the real gate and the real launcher side by side and assert
opens <=> listed for static-only, grant-only, both and neither users, and
that granting and expiry reach both sides without a restart.

Requires enlace>=0.1.41.
@thorwhalen
thorwhalen merged commit db88977 into main Sep 25, 2026
12 checks passed
@thorwhalen
thorwhalen deleted the fix/gate-and-launcher-share-predicate branch September 25, 2026 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant