@guren/server 2.36.0 → 2.37.1
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/SessionGuard.d.ts +20 -0
- package/dist/auth/index.js +1 -1
- package/dist/auth/providers/ModelUserProvider.d.ts +3 -0
- package/dist/auth/types.d.ts +7 -0
- package/dist/{auth-DYWBlmpS.js → auth-X27d4l78.js} +87 -5
- package/dist/{dev-banner-DGxB3HGY.js → dev-banner-DV_Xjsw8.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/mail/index.js +1 -1
- package/dist/mail/types.d.ts +9 -0
- package/dist/{mail-BQ2y2U5c.js → mail-D4AP4_Wd.js} +6 -1
- package/dist/runtime/index.js +1 -1
- package/package.json +3 -3
|
@@ -16,6 +16,26 @@ export declare class SessionGuard<User extends Authenticatable = Authenticatable
|
|
|
16
16
|
private rememberSessionKey;
|
|
17
17
|
private loadRememberedUser;
|
|
18
18
|
private sanitizeUser;
|
|
19
|
+
private fingerprintSessionKey;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the session was opened under the credential `user` holds now. A
|
|
22
|
+
* session with no fingerprint fails for an account that has a credential:
|
|
23
|
+
* nothing shows it was opened under the current one.
|
|
24
|
+
*/
|
|
25
|
+
private holdsCurrentCredential;
|
|
26
|
+
private bindCredential;
|
|
27
|
+
/**
|
|
28
|
+
* validate() may rehash the password of the user this session belongs to
|
|
29
|
+
* (a profile form confirming the current password). The session moves to the
|
|
30
|
+
* new hash, or its own next request would read as a password change.
|
|
31
|
+
*/
|
|
32
|
+
private followRehash;
|
|
33
|
+
/**
|
|
34
|
+
* Whose session this is. A remembered session carries no id key, and must be
|
|
35
|
+
* resolved before a rehash: afterwards its fingerprint reads as stale.
|
|
36
|
+
*/
|
|
37
|
+
private sessionUserId;
|
|
38
|
+
private forgetLogin;
|
|
19
39
|
private resolveUser;
|
|
20
40
|
check(): Promise<boolean>;
|
|
21
41
|
guest(): Promise<boolean>;
|
package/dist/auth/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as verifyOAuthState, B as ModelUserProvider, C as createGoogleOAuthProviderConfig, D as fetchOAuthUserProfile, E as exchangeOAuthCode, H as NodeHasher, I as AuthManager, O as parseOAuthRedirectUrl, R as TokenGuard, S as createGitHubOAuthProviderConfig, T as createOAuthState, U as ScryptHasher, W as BaseUserProvider, _ as OAUTH_SESSION_BINDING_KEY, a as isEmailVerified, b as buildOAuthRedirectUrl, c as verifyEmailToken, d as completePasswordReset, f as createPasswordResetToken, g as MemoryOAuthStateStore, h as AuthenticatableModel, i as createEmailVerificationToken, k as sanitizeOAuthRedirect, l as MemoryPasswordResetStore, m as verifyPasswordResetToken, n as buildVerificationUrl, o as parseVerificationUrl, p as parsePasswordResetUrl, r as completeEmailVerification, s as requireVerifiedEmail, t as MemoryEmailVerificationStore, u as buildPasswordResetUrl, v as OAuthManager, w as createOAuthManager, x as createDiscordOAuthProviderConfig, y as buildOAuthAuthorizeUrl, z as SessionGuard } from "../auth-
|
|
1
|
+
import { A as verifyOAuthState, B as ModelUserProvider, C as createGoogleOAuthProviderConfig, D as fetchOAuthUserProfile, E as exchangeOAuthCode, H as NodeHasher, I as AuthManager, O as parseOAuthRedirectUrl, R as TokenGuard, S as createGitHubOAuthProviderConfig, T as createOAuthState, U as ScryptHasher, W as BaseUserProvider, _ as OAUTH_SESSION_BINDING_KEY, a as isEmailVerified, b as buildOAuthRedirectUrl, c as verifyEmailToken, d as completePasswordReset, f as createPasswordResetToken, g as MemoryOAuthStateStore, h as AuthenticatableModel, i as createEmailVerificationToken, k as sanitizeOAuthRedirect, l as MemoryPasswordResetStore, m as verifyPasswordResetToken, n as buildVerificationUrl, o as parseVerificationUrl, p as parsePasswordResetUrl, r as completeEmailVerification, s as requireVerifiedEmail, t as MemoryEmailVerificationStore, u as buildPasswordResetUrl, v as OAuthManager, w as createOAuthManager, x as createDiscordOAuthProviderConfig, y as buildOAuthAuthorizeUrl, z as SessionGuard } from "../auth-X27d4l78.js";
|
|
2
2
|
import { A as secureStringCompare, D as hashToken, E as generateToken, O as parseTokenUrl, T as generateId, _ as tokenCanAny, a as getApiToken, d as revokeAllApiTokens, f as revokeApiToken, g as tokenCanAll, h as tokenCan, i as createBearerTokenMiddleware, k as secureCompare, l as parseApiToken, n as MemoryApiTokenStore, o as getApiTokenOrFail, r as createApiToken, s as getUserApiTokens, t as API_TOKEN_KEY, u as readBearerToken, v as verifyApiToken, w as buildTokenUrl } from "../api-token-Cs1myxf6.js";
|
|
3
3
|
export { API_TOKEN_KEY, ScryptHasher as Argon2Hasher, ScryptHasher, AuthManager, AuthenticatableModel, BaseUserProvider, MemoryApiTokenStore, MemoryEmailVerificationStore, MemoryOAuthStateStore, MemoryPasswordResetStore, ModelUserProvider, NodeHasher, OAUTH_SESSION_BINDING_KEY, OAuthManager, SessionGuard, TokenGuard, buildOAuthAuthorizeUrl, buildOAuthRedirectUrl, buildPasswordResetUrl, buildTokenUrl, buildVerificationUrl, completeEmailVerification, completePasswordReset, createApiToken, createBearerTokenMiddleware, createDiscordOAuthProviderConfig, createEmailVerificationToken, createGitHubOAuthProviderConfig, createGoogleOAuthProviderConfig, createOAuthManager, createOAuthState, createPasswordResetToken, exchangeOAuthCode, fetchOAuthUserProfile, generateId, generateToken, getApiToken, getApiTokenOrFail, getUserApiTokens, hashToken, isEmailVerified, parseApiToken, parseOAuthRedirectUrl, parsePasswordResetUrl, parseTokenUrl, parseVerificationUrl, readBearerToken, requireVerifiedEmail, revokeAllApiTokens, revokeApiToken, sanitizeOAuthRedirect, secureCompare, secureStringCompare, tokenCan, tokenCanAll, tokenCanAny, verifyApiToken, verifyEmailToken, verifyOAuthState, verifyPasswordResetToken };
|
|
@@ -25,6 +25,9 @@ export declare class ModelUserProvider<User extends Authenticatable = Authentica
|
|
|
25
25
|
validateCredentials(user: User, credentials: AuthCredentials): Promise<boolean>;
|
|
26
26
|
getId(user: User): unknown;
|
|
27
27
|
rehashPasswordIfRequired(user: User, credentials: AuthCredentials): Promise<void>;
|
|
28
|
+
private opens;
|
|
29
|
+
/** A digest, so the hash itself never reaches the session store. */
|
|
30
|
+
credentialFingerprint(user: User): string | null | undefined;
|
|
28
31
|
/** forceUpdate keyed on the id column: both credential columns are denied to mass assignment. */
|
|
29
32
|
private writeColumn;
|
|
30
33
|
/**
|
package/dist/auth/types.d.ts
CHANGED
|
@@ -37,6 +37,13 @@ export interface UserProvider<User = Authenticatable> {
|
|
|
37
37
|
* hash needs it, and persist the new value.
|
|
38
38
|
*/
|
|
39
39
|
rehashPasswordIfRequired?(user: User, credentials: AuthCredentials): Promise<void> | void;
|
|
40
|
+
/**
|
|
41
|
+
* A digest of the credential a password change replaces. `SessionGuard`
|
|
42
|
+
* stores it at login and ends a session whose copy differs from it.
|
|
43
|
+
* `null`: the account has no such credential. `undefined`: this record does
|
|
44
|
+
* not carry it (a sanitized one), so the guard reads the stored record.
|
|
45
|
+
*/
|
|
46
|
+
credentialFingerprint?(user: User): Promise<string | null | undefined> | string | null | undefined;
|
|
40
47
|
}
|
|
41
48
|
/** The conventional credential column names `ModelUserProvider.sanitize()` strips. */
|
|
42
49
|
export type DefaultSanitizedKeys = 'password' | 'passwordHash' | 'password_hash' | 'rememberToken' | 'remember_token';
|
|
@@ -808,10 +808,25 @@ var ModelUserProvider = class extends BaseUserProvider {
|
|
|
808
808
|
const hashed = user[this.passwordColumn];
|
|
809
809
|
if (typeof plain !== "string" || typeof hashed !== "string" || !this.hasher.needsRehash?.(hashed)) return;
|
|
810
810
|
const rehashed = await this.hasher.hash(plain);
|
|
811
|
-
|
|
811
|
+
const where = {
|
|
812
|
+
[this.idColumn]: this.getId(user),
|
|
813
|
+
[this.passwordColumn]: hashed
|
|
814
|
+
};
|
|
812
815
|
const writer = passwordHashWriter(this.model);
|
|
813
|
-
if (writer) await writer.storePasswordHash(
|
|
814
|
-
else await this.
|
|
816
|
+
if (writer) await writer.storePasswordHash(where, this.passwordColumn, rehashed);
|
|
817
|
+
else await this.model.forceUpdate(where, { [this.passwordColumn]: rehashed });
|
|
818
|
+
const stored = await this.retrieveById(this.getId(user));
|
|
819
|
+
const current = stored ? stored[this.passwordColumn] : void 0;
|
|
820
|
+
if (current === rehashed || await this.opens(current, plain)) user[this.passwordColumn] = current;
|
|
821
|
+
}
|
|
822
|
+
async opens(hashed, plain) {
|
|
823
|
+
return typeof hashed === "string" && looksLikePasswordHash(hashed) && await this.hasher.verify(hashed, plain);
|
|
824
|
+
}
|
|
825
|
+
/** A digest, so the hash itself never reaches the session store. */
|
|
826
|
+
credentialFingerprint(user) {
|
|
827
|
+
const hashed = user[this.passwordColumn];
|
|
828
|
+
if (hashed === void 0) return void 0;
|
|
829
|
+
return typeof hashed === "string" && hashed !== "" ? hashToken(hashed) : null;
|
|
815
830
|
}
|
|
816
831
|
/** forceUpdate keyed on the id column: both credential columns are denied to mass assignment. */
|
|
817
832
|
async writeColumn(user, column, value) {
|
|
@@ -882,6 +897,10 @@ var SessionGuard = class {
|
|
|
882
897
|
this.currentSession.forget(this.rememberSessionKey());
|
|
883
898
|
return null;
|
|
884
899
|
}
|
|
900
|
+
if (!await this.holdsCurrentCredential(this.currentSession, user)) {
|
|
901
|
+
this.forgetLogin(this.currentSession);
|
|
902
|
+
return null;
|
|
903
|
+
}
|
|
885
904
|
await this.provider.setRememberToken?.(user, rememberToken);
|
|
886
905
|
const sanitized = this.sanitizeUser(user);
|
|
887
906
|
this.cachedUser = sanitized;
|
|
@@ -890,6 +909,60 @@ var SessionGuard = class {
|
|
|
890
909
|
sanitizeUser(user) {
|
|
891
910
|
return sanitizeUser(this.provider, user);
|
|
892
911
|
}
|
|
912
|
+
fingerprintSessionKey() {
|
|
913
|
+
return `${this.sessionKey()}:fingerprint`;
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Whether the session was opened under the credential `user` holds now. A
|
|
917
|
+
* session with no fingerprint fails for an account that has a credential:
|
|
918
|
+
* nothing shows it was opened under the current one.
|
|
919
|
+
*/
|
|
920
|
+
async holdsCurrentCredential(session, user) {
|
|
921
|
+
const current = await this.provider.credentialFingerprint?.(user);
|
|
922
|
+
const stored = session.get(this.fingerprintSessionKey());
|
|
923
|
+
if (current == null) return stored == null;
|
|
924
|
+
return typeof stored === "string" && secureStringCompare(stored, current);
|
|
925
|
+
}
|
|
926
|
+
async bindCredential(session, user, identifier) {
|
|
927
|
+
const provider = this.provider;
|
|
928
|
+
if (!provider.credentialFingerprint) return;
|
|
929
|
+
let fingerprint = await provider.credentialFingerprint(user);
|
|
930
|
+
if (fingerprint === void 0) {
|
|
931
|
+
const stored = await provider.retrieveById(identifier);
|
|
932
|
+
fingerprint = stored ? await provider.credentialFingerprint(stored) : void 0;
|
|
933
|
+
}
|
|
934
|
+
if (typeof fingerprint === "string") session.set(this.fingerprintSessionKey(), fingerprint);
|
|
935
|
+
else session.forget(this.fingerprintSessionKey());
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* validate() may rehash the password of the user this session belongs to
|
|
939
|
+
* (a profile form confirming the current password). The session moves to the
|
|
940
|
+
* new hash, or its own next request would read as a password change.
|
|
941
|
+
*/
|
|
942
|
+
async followRehash(user, before, owner) {
|
|
943
|
+
const session = this.currentSession;
|
|
944
|
+
if (!session || typeof before !== "string") return;
|
|
945
|
+
const after = await this.provider.credentialFingerprint?.(user);
|
|
946
|
+
if (typeof after !== "string" || after === before) return;
|
|
947
|
+
if (owner == null || owner !== this.provider.getId(user)) return;
|
|
948
|
+
const stored = session.get(this.fingerprintSessionKey());
|
|
949
|
+
if (typeof stored === "string" && secureStringCompare(stored, before)) session.set(this.fingerprintSessionKey(), after);
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Whose session this is. A remembered session carries no id key, and must be
|
|
953
|
+
* resolved before a rehash: afterwards its fingerprint reads as stale.
|
|
954
|
+
*/
|
|
955
|
+
async sessionUserId() {
|
|
956
|
+
const identifier = this.currentSession?.get(this.sessionKey());
|
|
957
|
+
if (identifier != null) return identifier;
|
|
958
|
+
const user = await this.resolveUser();
|
|
959
|
+
return user ? this.provider.getId(user) : null;
|
|
960
|
+
}
|
|
961
|
+
forgetLogin(session) {
|
|
962
|
+
session.forget(this.sessionKey());
|
|
963
|
+
session.forget(this.rememberSessionKey());
|
|
964
|
+
session.forget(this.fingerprintSessionKey());
|
|
965
|
+
}
|
|
893
966
|
async resolveUser() {
|
|
894
967
|
if (this.cachedUser !== void 0) return this.cachedUser;
|
|
895
968
|
const session = this.currentSession;
|
|
@@ -909,6 +982,11 @@ var SessionGuard = class {
|
|
|
909
982
|
this.cachedUser = null;
|
|
910
983
|
return null;
|
|
911
984
|
}
|
|
985
|
+
if (!await this.holdsCurrentCredential(session, user)) {
|
|
986
|
+
this.forgetLogin(session);
|
|
987
|
+
this.cachedUser = null;
|
|
988
|
+
return null;
|
|
989
|
+
}
|
|
912
990
|
const sanitized = this.sanitizeUser(user);
|
|
913
991
|
this.cachedUser = sanitized;
|
|
914
992
|
return sanitized;
|
|
@@ -925,6 +1003,7 @@ var SessionGuard = class {
|
|
|
925
1003
|
async id() {
|
|
926
1004
|
const session = this.currentSession;
|
|
927
1005
|
if (!session) return null;
|
|
1006
|
+
if (this.provider.credentialFingerprint && !await this.resolveUser()) return null;
|
|
928
1007
|
return session.get(this.sessionKey()) ?? null;
|
|
929
1008
|
}
|
|
930
1009
|
async remember(user) {
|
|
@@ -940,6 +1019,7 @@ var SessionGuard = class {
|
|
|
940
1019
|
session.regenerate();
|
|
941
1020
|
const identifier = this.provider.getId(castUser);
|
|
942
1021
|
session.set(this.sessionKey(), identifier);
|
|
1022
|
+
await this.bindCredential(session, castUser, identifier);
|
|
943
1023
|
this.cachedUser = this.sanitizeUser(castUser);
|
|
944
1024
|
if (remember) await this.remember(castUser);
|
|
945
1025
|
else session.forget(this.rememberSessionKey());
|
|
@@ -947,8 +1027,7 @@ var SessionGuard = class {
|
|
|
947
1027
|
async logout() {
|
|
948
1028
|
const session = this.currentSession;
|
|
949
1029
|
if (!session) return;
|
|
950
|
-
|
|
951
|
-
session.forget(this.rememberSessionKey());
|
|
1030
|
+
this.forgetLogin(session);
|
|
952
1031
|
this.cachedUser = null;
|
|
953
1032
|
}
|
|
954
1033
|
async attempt(credentials, remember = false) {
|
|
@@ -964,11 +1043,14 @@ var SessionGuard = class {
|
|
|
964
1043
|
return null;
|
|
965
1044
|
}
|
|
966
1045
|
if (!await this.provider.validateCredentials(user, credentials)) return null;
|
|
1046
|
+
const fingerprint = await this.provider.credentialFingerprint?.(user);
|
|
1047
|
+
const owner = typeof fingerprint === "string" ? await this.sessionUserId() : null;
|
|
967
1048
|
try {
|
|
968
1049
|
await this.provider.rehashPasswordIfRequired?.(user, credentials);
|
|
969
1050
|
} catch (error) {
|
|
970
1051
|
console.warn(`[guren] Rehashing the password for user ${this.describeUser(user)} failed; the login continues.`, redactQueryParams(error));
|
|
971
1052
|
}
|
|
1053
|
+
await this.followRehash(user, fingerprint, owner);
|
|
972
1054
|
return user;
|
|
973
1055
|
}
|
|
974
1056
|
/** Never the plaintext or the hash: a warning is a log line, and both belong in neither. */
|
|
@@ -4,7 +4,7 @@ import chalk from "chalk";
|
|
|
4
4
|
import figlet from "figlet";
|
|
5
5
|
import standard from "figlet/importable-fonts/Standard.js";
|
|
6
6
|
//#region package.json
|
|
7
|
-
var version = "2.
|
|
7
|
+
var version = "2.37.1";
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/http/dev-banner.ts
|
|
10
10
|
var dev_banner_exports = /* @__PURE__ */ __exportAll({
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { t as trimSlashes } from "./trim-slashes-BLY9hKAa.js";
|
|
|
9
9
|
import { PATH_PARAM_PATTERN, extractPathParamNames } from "./internal/route-path.js";
|
|
10
10
|
import { a as generateAppKey, c as parseAppKey, i as encodeDerivedKey, l as parsePreviousAppKeys, n as deriveAppKey, o as getAppKeyringFromEnv, r as deriveAppKeyring, s as normalizeAppKey, t as MessageSigner } from "./MessageSigner-DIUT1Yao.js";
|
|
11
11
|
import { n as detectServerlessRuntime, t as SERVERLESS_RUNTIME_LABELS } from "./serverless-D96rJb6x.js";
|
|
12
|
-
import { A as verifyOAuthState, B as ModelUserProvider, C as createGoogleOAuthProviderConfig, D as fetchOAuthUserProfile, E as exchangeOAuthCode, F as normalizeRedirectTarget, G as MemorySessionStore, H as NodeHasher, I as AuthManager, J as getSessionFromContext, K as createSessionMiddleware, L as DEFAULT_PROVIDER, M as jsonResponse, N as hostMatchesAllowlist, O as parseOAuthRedirectUrl, P as isAppRelativePath, R as TokenGuard, S as createGitHubOAuthProviderConfig, T as createOAuthState, U as ScryptHasher, V as DefaultHasher, W as BaseUserProvider, _ as OAUTH_SESSION_BINDING_KEY, a as isEmailVerified, b as buildOAuthRedirectUrl, c as verifyEmailToken, d as completePasswordReset, f as createPasswordResetToken, g as MemoryOAuthStateStore, h as AuthenticatableModel, i as createEmailVerificationToken, j as defineMiddleware, k as sanitizeOAuthRedirect, l as MemoryPasswordResetStore, m as verifyPasswordResetToken, n as buildVerificationUrl, o as parseVerificationUrl, p as parsePasswordResetUrl, q as defaultCookieSecure, r as completeEmailVerification, s as requireVerifiedEmail, t as MemoryEmailVerificationStore, u as buildPasswordResetUrl, v as OAuthManager, w as createOAuthManager, x as createDiscordOAuthProviderConfig, y as buildOAuthAuthorizeUrl, z as SessionGuard } from "./auth-
|
|
12
|
+
import { A as verifyOAuthState, B as ModelUserProvider, C as createGoogleOAuthProviderConfig, D as fetchOAuthUserProfile, E as exchangeOAuthCode, F as normalizeRedirectTarget, G as MemorySessionStore, H as NodeHasher, I as AuthManager, J as getSessionFromContext, K as createSessionMiddleware, L as DEFAULT_PROVIDER, M as jsonResponse, N as hostMatchesAllowlist, O as parseOAuthRedirectUrl, P as isAppRelativePath, R as TokenGuard, S as createGitHubOAuthProviderConfig, T as createOAuthState, U as ScryptHasher, V as DefaultHasher, W as BaseUserProvider, _ as OAUTH_SESSION_BINDING_KEY, a as isEmailVerified, b as buildOAuthRedirectUrl, c as verifyEmailToken, d as completePasswordReset, f as createPasswordResetToken, g as MemoryOAuthStateStore, h as AuthenticatableModel, i as createEmailVerificationToken, j as defineMiddleware, k as sanitizeOAuthRedirect, l as MemoryPasswordResetStore, m as verifyPasswordResetToken, n as buildVerificationUrl, o as parseVerificationUrl, p as parsePasswordResetUrl, q as defaultCookieSecure, r as completeEmailVerification, s as requireVerifiedEmail, t as MemoryEmailVerificationStore, u as buildPasswordResetUrl, v as OAuthManager, w as createOAuthManager, x as createDiscordOAuthProviderConfig, y as buildOAuthAuthorizeUrl, z as SessionGuard } from "./auth-X27d4l78.js";
|
|
13
13
|
import { t as resolveOptional } from "./resolve-optional-ax6gPWTp.js";
|
|
14
14
|
import { t as warnOnce } from "./warn-once-p-IlMjra.js";
|
|
15
15
|
import { a as defaultApplication, c as resolve, d as createContainer, f as getContainer, g as warnDeprecatedSetter, h as warnDeprecatedGetter, i as bindAmbient, l as useAsDefaultApplication, m as warnDeprecated, n as ambientBinding, o as defaultContainer, p as setContainer, r as ambientContainer, s as resetDefaultApplication, t as adoptDefaultApplication, u as Container } from "./default-application-s9SE-Er7.js";
|
|
@@ -38,7 +38,7 @@ import { a as NotificationManager, c as setNotificationManager, d as getNotifica
|
|
|
38
38
|
import { a as RequestFinished, c as UserLoggedOut, d as EventManager, f as createEventManager, i as JobProcessed, l as createQueueEventDispatcher, n as ApplicationStarted, o as RequestReceived, r as JobFailed, s as UserAuthenticated, t as ApplicationShutdown, u as Listener } from "./events-DW197Nur.js";
|
|
39
39
|
import { a as getJob, d as resolveQueueDriver, f as setQueueDriver, l as registerJob, n as clearJobRegistry, o as getQueueDriver, r as clearQueueDriver, s as getRegisteredJobs, t as Job, u as resolveJobName } from "./Job-0Prk8k0z.js";
|
|
40
40
|
import { a as processJob, c as RedisDriver$1, i as Worker, l as SyncDriver, n as createQueueManager, o as SqsDriver, r as FailedJobReporter, s as createSqsAdapter, t as QueueManager, u as MemoryDriver$1 } from "./queue-K4Bi6NRy.js";
|
|
41
|
-
import { a as MailManager, c as MemoryTransport, i as setMailManager, l as ResendTransport, n as getMailManager, o as createMailManager, r as mail, s as LogTransport, t as Mail, u as SmtpTransport } from "./mail-
|
|
41
|
+
import { a as MailManager, c as MemoryTransport, i as setMailManager, l as ResendTransport, n as getMailManager, o as createMailManager, r as mail, s as LogTransport, t as Mail, u as SmtpTransport } from "./mail-D4AP4_Wd.js";
|
|
42
42
|
import { a as LOG_LEVEL_PRIORITY, i as matchDailyFileDate, n as dailyFileDateStamp, r as dailyFilePath, t as DailyFileChannel } from "./DailyFileChannel-CTTPA0EF.js";
|
|
43
43
|
import { a as FileChannel, i as setLogManager, n as createLogManager, o as ConsoleChannel, r as getLogManager, t as LogManager } from "./logging-Br9bZlaG.js";
|
|
44
44
|
import { a as random, c as randomHex, d as sample, f as shuffle, i as pick, l as randomInt, m as uuid, n as generatePassword, o as randomBase64, p as urlSafeToken, r as generateSlug, s as randomBase64Url, t as generateOtp, u as randomString } from "./Random-S0OvCuR8.js";
|
|
@@ -3711,7 +3711,7 @@ let devBanner;
|
|
|
3711
3711
|
*/
|
|
3712
3712
|
async function loadDevBanner() {
|
|
3713
3713
|
if (typeof process === "undefined") return devBanner;
|
|
3714
|
-
if (process.env.NODE_ENV !== "production") devBanner ??= await import("./dev-banner-
|
|
3714
|
+
if (process.env.NODE_ENV !== "production") devBanner ??= await import("./dev-banner-DV_Xjsw8.js").then((n) => n.n);
|
|
3715
3715
|
return devBanner;
|
|
3716
3716
|
}
|
|
3717
3717
|
/**
|
package/dist/mail/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as MailManager, c as MemoryTransport, i as setMailManager, l as ResendTransport, n as getMailManager, o as createMailManager, r as mail, s as LogTransport, t as Mail, u as SmtpTransport } from "../mail-
|
|
1
|
+
import { a as MailManager, c as MemoryTransport, i as setMailManager, l as ResendTransport, n as getMailManager, o as createMailManager, r as mail, s as LogTransport, t as Mail, u as SmtpTransport } from "../mail-D4AP4_Wd.js";
|
|
2
2
|
export { LogTransport, Mail, MailManager, MemoryTransport, ResendTransport, SmtpTransport, createMailManager, getMailManager, mail, setMailManager };
|
package/dist/mail/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ConnectionOptions } from 'node:tls';
|
|
1
2
|
/** Email address with optional display name. */
|
|
2
3
|
export interface MailAddress {
|
|
3
4
|
email: string;
|
|
@@ -67,6 +68,14 @@ export interface SmtpTransportOptions {
|
|
|
67
68
|
port?: number;
|
|
68
69
|
/** Use TLS. @default false */
|
|
69
70
|
secure?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Fail the send when the server does not upgrade with STARTTLS, rather than continue in cleartext.
|
|
73
|
+
* Without it, an on-path attacker can strip STARTTLS from the EHLO reply and read `auth`.
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
76
|
+
requireTLS?: boolean;
|
|
77
|
+
/** Node TLS options for the connection, such as `ca` for a relay on a private CA. */
|
|
78
|
+
tls?: ConnectionOptions;
|
|
70
79
|
/** Authentication credentials. */
|
|
71
80
|
auth?: {
|
|
72
81
|
user: string;
|
|
@@ -6,7 +6,10 @@ import nodemailer from "nodemailer";
|
|
|
6
6
|
//#region src/mail/transports/SmtpTransport.ts
|
|
7
7
|
/** Format an email address for nodemailer. */
|
|
8
8
|
function formatAddress(addr) {
|
|
9
|
-
if (addr.name)
|
|
9
|
+
if (addr.name) {
|
|
10
|
+
const name = String(addr.name);
|
|
11
|
+
return `${/^"(?:[^"\\]|\\[\s\S])*"$/.test(name) ? name : `"${name.replace(/[\\"]/g, "\\$&")}"`} <${addr.email}>`;
|
|
12
|
+
}
|
|
10
13
|
return addr.email;
|
|
11
14
|
}
|
|
12
15
|
/** SMTP mail transport using Nodemailer. */
|
|
@@ -18,6 +21,8 @@ var SmtpTransport = class {
|
|
|
18
21
|
host: options.host,
|
|
19
22
|
port: options.port ?? 587,
|
|
20
23
|
secure: options.secure ?? false,
|
|
24
|
+
requireTLS: options.requireTLS ?? false,
|
|
25
|
+
tls: options.tls,
|
|
21
26
|
auth: options.auth,
|
|
22
27
|
pool: options.pool ?? true,
|
|
23
28
|
maxConnections: options.maxConnections ?? 5
|
package/dist/runtime/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { n as hash } from "../Hash-D2DFd8xX.js";
|
|
|
4
4
|
import { a as getManifestCss, c as isViteProduction, i as clientManifestCandidates, l as loadViteManifest, o as getManifestFile, r as PUBLIC_ASSETS_URL_PREFIX, u as normalizeDevServerUrl } from "../vite-manifest-BdXRybeq.js";
|
|
5
5
|
import { n as startViteDevServer } from "../vite-dev-server-Ag90otai.js";
|
|
6
6
|
import { n as isRealPathWithin, t as isPathWithin } from "../contained-path-DOVauNQC.js";
|
|
7
|
-
import { r as logDevServerBanner, t as GUREN_ASCII_ART } from "../dev-banner-
|
|
7
|
+
import { r as logDevServerBanner, t as GUREN_ASCII_ART } from "../dev-banner-DV_Xjsw8.js";
|
|
8
8
|
import { createRequire } from "node:module";
|
|
9
9
|
import { dirname, extname, join, resolve } from "node:path";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guren/server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.37.1",
|
|
4
4
|
"description": "HTTP layer of the Guren framework, on Hono: routing, controllers, middleware, auth, sessions, queues and the AWS Lambda adapter. Applications import it through @guren/core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"guren",
|
|
@@ -172,11 +172,11 @@
|
|
|
172
172
|
"test": "bun test"
|
|
173
173
|
},
|
|
174
174
|
"dependencies": {
|
|
175
|
-
"@guren/orm": "^2.
|
|
175
|
+
"@guren/orm": "^2.16.1",
|
|
176
176
|
"chalk": "^5.3.0",
|
|
177
177
|
"consola": "^3.4.2",
|
|
178
178
|
"figlet": "^1.7.0",
|
|
179
|
-
"hono": "^4.13.
|
|
179
|
+
"hono": "^4.13.16",
|
|
180
180
|
"ioredis": "^5.11.1",
|
|
181
181
|
"nodemailer": "^10.0.2"
|
|
182
182
|
},
|