@rebasepro/server 0.21.1 → 0.22.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/auth/exclude-auth-secrets.d.ts +35 -3
- package/dist/{auth-BS4WBA10.js → auth-CCDpk2rn.js} +12 -9
- package/dist/auth-CCDpk2rn.js.map +1 -0
- package/dist/{cron-routes-B_wlLybo.js → cron-routes-B7CRGfiq.js} +2 -2
- package/dist/{cron-routes-B_wlLybo.js.map → cron-routes-B7CRGfiq.js.map} +1 -1
- package/dist/{cron-store-Dp0X7zRB.js → cron-store-BYGZFNWk.js} +2 -2
- package/dist/{cron-store-Dp0X7zRB.js.map → cron-store-BYGZFNWk.js.map} +1 -1
- package/dist/ddl-bootstrap-CfNvxMuK.js.map +1 -1
- package/dist/{history-recorder-5VKT7nss.js → history-recorder-BQmB0P_j.js} +2 -2
- package/dist/{history-recorder-5VKT7nss.js.map → history-recorder-BQmB0P_j.js.map} +1 -1
- package/dist/{history-store-By2R_G1b.js → history-store-CetkrBBD.js} +2 -2
- package/dist/{history-store-By2R_G1b.js.map → history-store-CetkrBBD.js.map} +1 -1
- package/dist/index.es.js +73 -59
- package/dist/index.es.js.map +1 -1
- package/dist/init/global-callbacks.d.ts +21 -0
- package/dist/{jobs-1IkI4Lle.js → jobs-Bjr8DZAi.js} +2 -2
- package/dist/{jobs-1IkI4Lle.js.map → jobs-Bjr8DZAi.js.map} +1 -1
- package/dist/{openapi-generator-BDpoKZQ9.js → openapi-generator-D8uFz-LW.js} +2 -2
- package/dist/{openapi-generator-BDpoKZQ9.js.map → openapi-generator-D8uFz-LW.js.map} +1 -1
- package/dist/{query-parser-C-rl30ce.js → query-parser-BleZmY18.js} +2 -2
- package/dist/{query-parser-C-rl30ce.js.map → query-parser-BleZmY18.js.map} +1 -1
- package/dist/{src-Caz7nREj.js → src-1vL-I1Po.js} +232 -120
- package/dist/src-1vL-I1Po.js.map +1 -0
- package/package.json +5 -5
- package/dist/auth-BS4WBA10.js.map +0 -1
- package/dist/src-Caz7nREj.js.map +0 -1
|
@@ -1,9 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keep the auth collection's secret columns off the API, whoever declared it.
|
|
3
|
+
*
|
|
4
|
+
* `users` is the one collection a project is *expected* to redeclare: it is
|
|
5
|
+
* scaffolded into `config/collections/users.ts` so the panel can present it, and
|
|
6
|
+
* a slug collision replaces the framework's default outright rather than merging
|
|
7
|
+
* with it. So every protection the default carried has to be restated by hand in
|
|
8
|
+
* the copy — and the one that is invisible when it goes missing is
|
|
9
|
+
* `excludeFromApi`.
|
|
10
|
+
*
|
|
11
|
+
* It is invisible because the neighbouring options *look* like they do the same
|
|
12
|
+
* job. `admin.hideFromCollection` and `admin.disabled.hidden` keep a field out of
|
|
13
|
+
* the CMS, which is what a person editing that file is thinking about, and a
|
|
14
|
+
* declaration carrying both of those reads as careful. Neither one strips the
|
|
15
|
+
* column from a row on the wire; only `excludeFromApi` does. The result is a
|
|
16
|
+
* users collection that hides the password hash from the admin panel and serves
|
|
17
|
+
* it to anyone whose read policy admits the row.
|
|
18
|
+
*
|
|
19
|
+
* Which is not hypothetical: it is what the platform's own control plane did,
|
|
20
|
+
* where the read policy deliberately admits co-members so the Members view can
|
|
21
|
+
* name them, and every colleague's browser was therefore handed everyone's
|
|
22
|
+
* scrypt hash and any pending email-verification token.
|
|
23
|
+
*
|
|
24
|
+
* So the framework restates it. Not by rejecting the collection — a boot failure
|
|
25
|
+
* over a field a developer never thought about is a bad trade, and an existing
|
|
26
|
+
* deployment would stop rather than start protecting itself — but by adding the
|
|
27
|
+
* flag and saying so. Which columns count is decided once, by
|
|
28
|
+
* {@link authSecretsMissingExclusion} in `@rebasepro/common`, and every
|
|
29
|
+
* `CollectionRegistry` applies the same rule to the copies it makes — which is
|
|
30
|
+
* how the panel, building its registry from the project's file as written,
|
|
31
|
+
* agrees with the server.
|
|
32
|
+
*/
|
|
1
33
|
/**
|
|
2
34
|
* Force `excludeFromApi` onto the auth collection's secret columns.
|
|
3
35
|
*
|
|
4
|
-
* Mutates in place
|
|
5
|
-
*
|
|
6
|
-
*
|
|
36
|
+
* Mutates in place, for what reads the collection configs directly rather than a
|
|
37
|
+
* registry's normalized copies. Run it before the collections are handed on, so
|
|
38
|
+
* those readers never see a config without the flag.
|
|
7
39
|
*
|
|
8
40
|
* @returns the columns it had to fix, per collection — for the caller to log and
|
|
9
41
|
* for tests to assert on.
|
|
@@ -3,13 +3,13 @@ import __rebaseProcess from "process";
|
|
|
3
3
|
globalThis.process ??= __rebaseProcess;
|
|
4
4
|
__rebaseCreateRequire(import.meta.url);
|
|
5
5
|
import { i as __toESM, n as __exportAll } from "./rolldown-runtime-dW7B1o5h.js";
|
|
6
|
-
import {
|
|
6
|
+
import { F as revokeInternalTableSql, ot as ANONYMOUS_USER_ID, st as isAnonymousUid } from "./src-1vL-I1Po.js";
|
|
7
7
|
import "./src-Br6ARbs6.js";
|
|
8
8
|
import { n as createDdlBootstrapper, o as isSQLAdmin } from "./ddl-bootstrap-CfNvxMuK.js";
|
|
9
9
|
import { t as firstSqlRow } from "./sql-rows-C6GEc2oE.js";
|
|
10
10
|
import { r as logger } from "./logger-DO2PZc4i.js";
|
|
11
11
|
import { r as errorHandler, t as ApiError } from "./errors-DWsX4yTd.js";
|
|
12
|
-
import { a as resolveListLimitParam } from "./query-parser-
|
|
12
|
+
import { a as resolveListLimitParam } from "./query-parser-BleZmY18.js";
|
|
13
13
|
import { C as require_jsonwebtoken, E as randomInt$1, O as sha256Hex, _ as verifyAccessToken, b as verifyMfaPendingToken, c as getAccessTokenExpiry, d as getRefreshTokenTtlMs, f as hasAsymmetricSigningKey, i as generateDownloadToken, l as getJwks, m as isJwtConfigured, n as configureJwt, o as generateMfaPendingToken, p as hashRefreshToken, r as generateAccessToken, s as generateRefreshToken, t as MAX_COOKIE_AGE_MS, u as getRefreshTokenExpiry, v as verifyDownloadToken, w as constantTimeEqual } from "./jwt-C4OW-DNq.js";
|
|
14
14
|
import { n as hasAdministrativeRole, r as isAdministrativeRole, t as ADMINISTRATIVE_ROLES } from "./admin-roles-vYdp_Pil.js";
|
|
15
15
|
import { c as tryCanonicalStorageKey, i as canonicalStorageId } from "./keys-Qfc4XieN.js";
|
|
@@ -2676,6 +2676,7 @@ function createDataRateLimiter(config = {}) {
|
|
|
2676
2676
|
return `ip:${defaultKeyGenerator(c, trustedProxyHops)}`;
|
|
2677
2677
|
},
|
|
2678
2678
|
resolveLimit: async (c) => {
|
|
2679
|
+
if (c.get("user")?.uid === SERVICE_IDENTITY.uid) return null;
|
|
2679
2680
|
const key = c.get("apiKey");
|
|
2680
2681
|
if (key) return key.rate_limit ?? apiKeyLimit;
|
|
2681
2682
|
return await identify(c) ? userLimit : anonLimit;
|
|
@@ -4446,10 +4447,10 @@ function createAuthRoutes(config) {
|
|
|
4446
4447
|
providerEmailVerified: externalUser.emailVerified,
|
|
4447
4448
|
existingUser: user
|
|
4448
4449
|
});
|
|
4449
|
-
if (!decision.allowed) {
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
}
|
|
4450
|
+
if (!decision.allowed) throw new ApiError(403, "EMAIL_NOT_VERIFIED", `An account with this email already exists with a different sign-in method. ${decision.reason === "provider-email-unverified" ? `${provider.id} has not verified this email address, so it cannot be linked automatically.` : "That account's email address was never verified, so it cannot be linked automatically."} Sign in with your existing method, then POST to /auth/link/${provider.id} to link ${provider.id} to your account.`, {
|
|
4451
|
+
reason: decision.reason,
|
|
4452
|
+
provider: provider.id
|
|
4453
|
+
});
|
|
4453
4454
|
await authRepo.linkUserIdentity(user.id, provider.id, externalUser.providerId, { email: externalUser.email });
|
|
4454
4455
|
await authRepo.updateUser(user.id, {
|
|
4455
4456
|
displayName: user.displayName || externalUser.displayName || void 0,
|
|
@@ -4534,13 +4535,15 @@ function createAuthRoutes(config) {
|
|
|
4534
4535
|
if (identityOwner) return c.json({
|
|
4535
4536
|
success: true,
|
|
4536
4537
|
provider: provider.id,
|
|
4537
|
-
alreadyLinked: true
|
|
4538
|
+
alreadyLinked: true,
|
|
4539
|
+
photoURL: externalUser.photoUrl ?? null
|
|
4538
4540
|
});
|
|
4539
4541
|
await authRepo.linkUserIdentity(userCtx.uid, provider.id, externalUser.providerId, { email: externalUser.email });
|
|
4540
4542
|
return c.json({
|
|
4541
4543
|
success: true,
|
|
4542
4544
|
provider: provider.id,
|
|
4543
|
-
alreadyLinked: false
|
|
4545
|
+
alreadyLinked: false,
|
|
4546
|
+
photoURL: externalUser.photoUrl ?? null
|
|
4544
4547
|
});
|
|
4545
4548
|
});
|
|
4546
4549
|
}
|
|
@@ -7178,4 +7181,4 @@ var auth_exports = /* @__PURE__ */ __exportAll({
|
|
|
7178
7181
|
//#endregion
|
|
7179
7182
|
export { requireAdmin as $, defaultAuthLimiter as A, resolveEmailLinkBase as B, providerVerifiedEmail as C, raw as Ct, DEFAULT_FUNCTIONS_ANONYMOUS_LIMIT as D, isPublicStoragePath as Dt, isBootstrapWindowOpen as E, PUBLIC_STORAGE_PREFIX as Et, extractLinks as F, createAdapterAuthMiddleware as G, hashPassword as H, registerDevEmailSink as I, extractUserFromToken as J, createAuthMiddleware as K, SMTPEmailService as L, activeDevEmailSink as M, clearActiveDevEmailSink as N, createDataRateLimiter as O, createDevEmailSink as P, queryTokenAuth as Q, createEmailService as R, pkceTokenParams as S, html as St, createBuiltinAuthAdapter as T, isOperationAllowed as Tt, validatePasswordStrength as U, resolveAuthHooks as V, verifyPassword as W, optionalAuth as X, fileTokenAuth as Y, publicObjectAuth as Z, verifyOidcIdToken as _, getUserInvitationTemplate as _t, resolveRateLimitStoreKind as a, validateApiKey as at, createGoogleProvider as b, RawHtml as bt, createSlackProvider as c, SERVICE_IDENTITY as ct, createDiscordProvider as d, completeUserCreation as dt, requireAuth as et, createTwitterProvider as f, generateSecurePassword as ft, tryVerifyOidcIdToken as g, getPasswordResetTemplate as gt, createMicrosoftProvider as h, getMagicLinkTemplate as ht, createApiKeyStore as i, isApiKeyToken as it, MemoryRateLimitStore as j, createRateLimiter as k, createBitbucketProvider as l, scopeDataDriver as lt, createAppleProvider as m, getEmailVerificationTemplate as mt, createCustomAuthAdapter as n, createFunctionApiKeyGuard as nt, createSqlRateLimitStore as o, extractBearerToken as ot, createFacebookProvider as p, getEmailOtpTemplate as pt, createRequireAuth as q, createApiKeyRoutes as r, createStorageApiKeyGuard as rt, createSpotifyProvider as s, safeCompare as st, auth_exports as t, createApiKeyPreAuth as tt, createGitLabProvider as u, supportsRlsScoping as ut, createGitHubProvider as v, getWelcomeEmailTemplate as vt, createJwksRoutes as w, httpMethodToOperation as wt, oauthCodeFlowSchema as x, escapeHtml as xt, createLinkedinProvider as y, resolveEmailBranding as yt, assertEmailLinkBases as z };
|
|
7180
7183
|
|
|
7181
|
-
//# sourceMappingURL=auth-
|
|
7184
|
+
//# sourceMappingURL=auth-CCDpk2rn.js.map
|