Skip to content

Commit 2d84837

Browse files
committed
fix(runtime): ask the three domain floors about the user id alone — they serve a user and have no system-context arm
Passing isSystem added three elevation read sites the system-context page does not carry, for no behaviour: each domain already refused a system context with no user. Claude-Session: https://claude.ai/code/session_01VoSxBQujKLZKPwK2u5ehQ6 Co-authored-by: Claude <noreply@anthropic.com>
1 parent af299c2 commit 2d84837

3 files changed

Lines changed: 15 additions & 14 deletions

File tree

‎packages/runtime/src/domains/keys.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,12 @@ export async function handleKeysRequest(
7575
// below the method check, so an anonymous caller using any verb but POST
7676
// was answered the 405 describing the route's shape instead of the 401
7777
// every domain off the closed list of doors answers. A key is minted FOR a
78-
// user, so past this statement a caller always has a user id: the
79-
// `!ec.userId` arm refuses an internal system context that carries none,
80-
// with the same answer it always had.
78+
// user, so the decision is asked about the user id alone: this domain has
79+
// no system-context arm (an internal system context was refused here before
80+
// as it is now), and the `!ec` / `!ec.userId` arms only narrow the type for
81+
// the compiler.
8182
const ec = context.executionContext;
82-
if (!ec || shouldDenyAnonymous({ userId: ec.userId, isSystem: ec.isSystem }) || !ec.userId) {
83+
if (shouldDenyAnonymous({ userId: ec?.userId }) || !ec || !ec.userId) {
8384
return {
8485
handled: true,
8586
response: deps.error(ANONYMOUS_DENY_MESSAGE, ANONYMOUS_DENY_STATUS, { code: ANONYMOUS_DENY_CODE }),

‎packages/runtime/src/domains/notifications.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,12 @@ export async function handleNotificationRequest(
123123
// an anonymous caller learns nothing about the deployment, and a face added
124124
// below inherits the refusal instead of having to remember its own.
125125
//
126-
// The inbox is per user, so past this one statement a caller always has a
127-
// user id: the `!userId` arm refuses an internal system context that carries
128-
// none (it has no inbox to read), with the same answer it always had.
126+
// The inbox is per user, so the decision is asked about the user id alone:
127+
// this domain has no system-context arm (an internal system context carries
128+
// no inbox to read, and was refused here before as it is now), and the
129+
// `!userId` arm only narrows the type for the compiler.
129130
const userId: string | undefined = context.executionContext?.userId;
130-
if (shouldDenyAnonymous({ userId, isSystem: context.executionContext?.isSystem }) || !userId) {
131+
if (shouldDenyAnonymous({ userId }) || !userId) {
131132
return {
132133
handled: true,
133134
response: deps.error(ANONYMOUS_DENY_MESSAGE, ANONYMOUS_DENY_STATUS, { code: ANONYMOUS_DENY_CODE }),

‎packages/runtime/src/domains/share-links.ts‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,12 @@ export async function handleShareLinksRequest(
127127
// token admits. It used to sit inside the body, below the service probe, as
128128
// the management faces' own `!userId` check, so a deployment without the
129129
// share-link service answered an anonymous caller the 501 capability
130-
// disclosure instead of the 401. A link is managed BY a user, so past this
131-
// statement a non-public face always has a user id: the `!userId` arm
132-
// refuses an internal system context that carries none, with the answer it
133-
// always had.
130+
// disclosure instead of the 401. A link is managed BY a user, so the
131+
// decision is asked about the user id alone: these faces have no
132+
// system-context arm (an internal system context was refused here before
133+
// as it is now).
134134
if (!isPublic) {
135-
const ec = context.executionContext;
136-
if (shouldDenyAnonymous({ userId: ec?.userId, isSystem: ec?.isSystem }) || !ec?.userId) {
135+
if (shouldDenyAnonymous({ userId: context.executionContext?.userId })) {
137136
return {
138137
handled: true,
139138
response: deps.error(ANONYMOUS_DENY_MESSAGE, ANONYMOUS_DENY_STATUS, { code: ANONYMOUS_DENY_CODE }),

0 commit comments

Comments
 (0)