@codemem/server 0.35.1 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/routes/sync.d.ts.map +1 -1
- package/package.json +7 -7
- package/static/app.js +566 -447
- package/static/index.html +1 -1
package/dist/index.js
CHANGED
|
@@ -1858,13 +1858,12 @@ async function maybeGrantDefaultSpaceOnJoin(opts) {
|
|
|
1858
1858
|
const scopeId = preferences.default_space_scope_id?.trim();
|
|
1859
1859
|
if (!scopeId) return null;
|
|
1860
1860
|
if (scopeId !== defaultSpaceScopeIdForGroup(opts.groupId)) return null;
|
|
1861
|
-
|
|
1861
|
+
if (((await coordinatorListScopesAction({
|
|
1862
1862
|
groupId: opts.groupId,
|
|
1863
1863
|
includeInactive: false,
|
|
1864
1864
|
remoteUrl: opts.config.syncCoordinatorUrl || null,
|
|
1865
1865
|
adminSecret: opts.config.syncCoordinatorAdminSecret || null
|
|
1866
|
-
})).find((scope) => scope.scope_id === scopeId) ?? null;
|
|
1867
|
-
if (!defaultScope || defaultScope.kind !== "team_default") return null;
|
|
1866
|
+
})).find((scope) => scope.scope_id === scopeId) ?? null)?.kind !== "team_default") return null;
|
|
1868
1867
|
return await coordinatorGrantScopeMembershipAction({
|
|
1869
1868
|
groupId: opts.groupId,
|
|
1870
1869
|
scopeId,
|
|
@@ -3107,9 +3106,14 @@ var PEERS_QUERY = `
|
|
|
3107
3106
|
* honor scoped-sync wire features such as explicit `scope_id` parameters
|
|
3108
3107
|
* and `/v1/status` `authorized_scopes` enumeration.
|
|
3109
3108
|
*
|
|
3110
|
-
*
|
|
3111
|
-
*
|
|
3112
|
-
*
|
|
3109
|
+
* Threat model: this header is intentionally only a best-effort capability
|
|
3110
|
+
* advertisement. It is not signed, so an authenticated paired peer — or a
|
|
3111
|
+
* bootstrap worker presenting a valid grant on `/v1/status` — can claim
|
|
3112
|
+
* `scoped` support and cause status to enumerate the scopes that caller is
|
|
3113
|
+
* already authorized to see. That is metadata disclosure inside the paired-peer
|
|
3114
|
+
* or bootstrap-grant trust boundary, not data authorization. Every scoped data
|
|
3115
|
+
* path still requires signed requests and checks membership before returning
|
|
3116
|
+
* scope contents.
|
|
3113
3117
|
*/
|
|
3114
3118
|
function negotiatedSyncCapability(c) {
|
|
3115
3119
|
return negotiateSyncCapability(LOCAL_SYNC_CAPABILITY, normalizeSyncCapability(c.req.header(SYNC_CAPABILITY_HEADER) ?? null));
|
|
@@ -3157,10 +3161,8 @@ function syncProtocolRoutes(getStore, opts = {}) {
|
|
|
3157
3161
|
}
|
|
3158
3162
|
if (isSyncAuthStoreBusy(auth)) return syncAuthStoreBusyResponse(c);
|
|
3159
3163
|
if (!auth.ok) {
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
console.warn(`[sync] bootstrap grant auth failed: reason=${auth.reason} grant_present=${grantPresent} path=${c.req.path}`);
|
|
3163
|
-
}
|
|
3164
|
+
const grantPresent = Boolean((c.req.header("X-Codemem-Bootstrap-Grant") ?? "").trim());
|
|
3165
|
+
if (bootstrapAttempted && grantPresent) console.warn(`[sync] bootstrap grant auth failed: reason=${auth.reason} grant_present=${grantPresent} path=${c.req.path}`);
|
|
3164
3166
|
const wireReason = bootstrapAttempted ? "bootstrap_grant_invalid" : auth.reason;
|
|
3165
3167
|
return (preauthChecked ? null : rateLimitedResponse(c, c.req.path, false)) ?? c.json(unauthorizedPayload(wireReason, true), 401);
|
|
3166
3168
|
}
|
|
@@ -3268,10 +3270,8 @@ function syncProtocolRoutes(getStore, opts = {}) {
|
|
|
3268
3270
|
}
|
|
3269
3271
|
if (isSyncAuthStoreBusy(auth)) return syncAuthStoreBusyResponse(c);
|
|
3270
3272
|
if (!auth.ok) {
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
console.warn(`[sync] bootstrap grant auth failed: reason=${auth.reason} grant_present=${grantPresent} path=${c.req.path}`);
|
|
3274
|
-
}
|
|
3273
|
+
const grantPresent = Boolean((c.req.header("X-Codemem-Bootstrap-Grant") ?? "").trim());
|
|
3274
|
+
if (bootstrapAttempted && grantPresent) console.warn(`[sync] bootstrap grant auth failed: reason=${auth.reason} grant_present=${grantPresent} path=${c.req.path}`);
|
|
3275
3275
|
const wireReason = bootstrapAttempted ? "bootstrap_grant_invalid" : auth.reason;
|
|
3276
3276
|
return (preauthChecked ? null : rateLimitedResponse(c, c.req.path, false)) ?? c.json(unauthorizedPayload(wireReason, true), 401);
|
|
3277
3277
|
}
|