@getstrata/core 2.2.59 → 3.0.3
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/CHANGELOG.md +27 -0
- package/dist/core/audit/exportAuditLogs.d.ts +12 -3
- package/dist/core/audit/exportStore.d.ts +6 -2
- package/dist/core/audit/siemFormatter.d.ts +2 -2
- package/dist/core/auth/abilityCatalog.d.ts +1 -9
- package/dist/core/auth/authContext.d.ts +2 -0
- package/dist/core/auth/authOutcome.d.ts +32 -0
- package/dist/core/auth/authReader.d.ts +22 -0
- package/dist/core/auth/basicAuthGuard.d.ts +19 -3
- package/dist/core/auth/emailVerification.d.ts +1 -1
- package/dist/core/auth/guard.d.ts +27 -6
- package/dist/core/auth/intendedUrlCookie.d.ts +13 -7
- package/dist/core/auth/jwt.d.ts +5 -4
- package/dist/core/auth/jwtGuard.d.ts +7 -6
- package/dist/core/auth/membershipContext.d.ts +10 -7
- package/dist/core/auth/membershipContextMiddleware.d.ts +3 -3
- package/dist/core/auth/membershipMiddleware.d.ts +1 -2
- package/dist/core/auth/membershipServiceImplementation.d.ts +1 -1
- package/dist/core/auth/oauth/oidcIdToken.d.ts +25 -16
- package/dist/core/auth/oauth/oidcProvider.d.ts +6 -4
- package/dist/core/auth/oauth/providers.d.ts +3 -1
- package/dist/core/auth/oneTimeToken.d.ts +2 -3
- package/dist/core/auth/passwordConfirmCookie.d.ts +15 -6
- package/dist/core/auth/passwordLogin.d.ts +5 -5
- package/dist/core/auth/pendingMfaCookie.d.ts +2 -2
- package/dist/core/auth/policy.d.ts +23 -10
- package/dist/core/auth/requireAuthCapability.d.ts +3 -0
- package/dist/core/auth/resolveMembershipService.d.ts +3 -2
- package/dist/core/auth/saml/samlAssertionReplay.d.ts +4 -4
- package/dist/core/auth/saml/samlServiceProvider.d.ts +11 -7
- package/dist/core/auth/scimAuthMiddleware.d.ts +10 -3
- package/dist/core/auth/sessionCookie.d.ts +20 -9
- package/dist/core/auth/sessionGuard.d.ts +14 -3
- package/dist/core/cache/createCacheStore.d.ts +6 -3
- package/dist/core/cache/redisCacheStore.d.ts +5 -1
- package/dist/core/cache/repository.d.ts +5 -1
- package/dist/core/cache/simpleCache.d.ts +2 -1
- package/dist/core/cache/tokens.d.ts +8 -0
- package/dist/core/config/applicationConfig.d.ts +21 -0
- package/dist/core/config/configSnapshot.d.ts +3 -0
- package/dist/core/config/envSchema.d.ts +3 -2
- package/dist/core/contracts/application.d.ts +153 -0
- package/dist/core/contracts/authUserDirectory.d.ts +24 -7
- package/dist/core/contracts/container.d.ts +20 -23
- package/dist/core/contracts/di.d.ts +4 -2
- package/dist/core/contracts/executionContext.d.ts +5 -0
- package/dist/core/contracts/executionOperations.d.ts +10 -0
- package/dist/core/contracts/executionOwnership.d.ts +38 -0
- package/dist/core/contracts/persistence.d.ts +20 -0
- package/dist/core/contracts/serviceTokens.d.ts +32 -18
- package/dist/core/contracts/services.d.ts +63 -0
- package/dist/core/contracts/token.d.ts +19 -0
- package/dist/core/crypto/fieldEncryption.d.ts +19 -7
- package/dist/core/crypto/fieldEncryptionRotation.d.ts +21 -5
- package/dist/core/crypto/mfaSecret.d.ts +10 -3
- package/dist/core/database/baseRepository.d.ts +14 -10
- package/dist/core/database/bindings.d.ts +6 -0
- package/dist/core/database/bunSql.d.ts +3 -12
- package/dist/core/database/definitions.d.ts +209 -0
- package/dist/core/database/dialect.d.ts +5 -24
- package/dist/core/database/driverPorts.d.ts +116 -0
- package/dist/core/database/errors.d.ts +47 -7
- package/dist/core/database/factory.d.ts +51 -31
- package/dist/core/database/index.d.ts +9 -10
- package/dist/core/database/keyset.d.ts +2 -1
- package/dist/core/database/legacyNativeTransaction.d.ts +5 -0
- package/dist/core/database/manager.d.ts +12 -0
- package/dist/core/database/model.d.ts +91 -97
- package/dist/core/database/modelQuery.d.ts +9 -5
- package/dist/core/database/modelRegistry.d.ts +52 -33
- package/dist/core/database/mysqlConnection.d.ts +1 -19
- package/dist/core/database/mysqlNative.d.ts +38 -0
- package/dist/core/database/nativeTransactions.d.ts +16 -0
- package/dist/core/database/ormInternal.d.ts +85 -0
- package/dist/core/database/ormRuntime.d.ts +4 -0
- package/dist/core/database/ownedReadOnlyObservation.d.ts +16 -0
- package/dist/core/database/postgresNative.d.ts +11 -0
- package/dist/core/database/query.d.ts +24 -23
- package/dist/core/database/queryPlanSnapshot.d.ts +7 -0
- package/dist/core/database/rawMysql.d.ts +7 -0
- package/dist/core/database/rawPostgres.d.ts +23 -0
- package/dist/core/database/rawSqlite.d.ts +6 -0
- package/dist/core/database/relationQueries.d.ts +3 -2
- package/dist/core/database/relationQuery.d.ts +24 -6
- package/dist/core/database/repositoryQuery.d.ts +6 -1
- package/dist/core/database/schema/driver.d.ts +1 -1
- package/dist/core/database/seeders/types.d.ts +1 -1
- package/dist/core/database/session.d.ts +13 -0
- package/dist/core/database/sessionFactory.d.ts +9 -0
- package/dist/core/database/sqlDialects.d.ts +22 -0
- package/dist/core/database/tokens.d.ts +7 -0
- package/dist/core/database/transactionSession.d.ts +43 -0
- package/dist/core/errors/http.d.ts +4 -1
- package/dist/core/events/{eventBus.d.ts → eventBusClass.d.ts} +1 -3
- package/dist/core/events/index.d.ts +2 -3
- package/dist/core/events/outbox/index.d.ts +44 -13
- package/dist/core/events/outbox/metrics.d.ts +4 -4
- package/dist/core/events/outbox/workerTransport.d.ts +17 -0
- package/dist/core/http/authMiddleware.d.ts +2 -2
- package/dist/core/http/authorizeMiddleware.d.ts +2 -2
- package/dist/core/http/bodySizeLimitMiddleware.d.ts +1 -1
- package/dist/core/http/conditionalResponse.d.ts +7 -2
- package/dist/core/http/contentSecurityPolicy.d.ts +4 -3
- package/dist/core/http/corsMiddleware.d.ts +2 -1
- package/dist/core/http/csrfMiddleware.d.ts +6 -1
- package/dist/core/http/csrfToken.d.ts +17 -7
- package/dist/core/http/databaseError.d.ts +4 -0
- package/dist/core/http/etag.d.ts +5 -2
- package/dist/core/http/flashMiddleware.d.ts +1 -1
- package/dist/core/http/flashSession.d.ts +13 -7
- package/dist/core/http/index.d.ts +1 -1
- package/dist/core/http/loginThrottleMiddleware.d.ts +3 -3
- package/dist/core/http/memoryThrottleMiddleware.d.ts +2 -2
- package/dist/core/http/parseMultipartUpload.d.ts +3 -2
- package/dist/core/http/requestMetaContext.d.ts +5 -0
- package/dist/core/http/requireAbilityMiddleware.d.ts +1 -1
- package/dist/core/http/requireAuthMiddleware.d.ts +2 -2
- package/dist/core/http/requirePasswordConfirmMiddleware.d.ts +2 -1
- package/dist/core/http/requireVerifiedMiddleware.d.ts +2 -2
- package/dist/core/http/requireWebAuthMiddleware.d.ts +2 -2
- package/dist/core/http/response.d.ts +4 -3
- package/dist/core/http/scimThrottleMiddleware.d.ts +4 -3
- package/dist/core/http/securedRouteModelBinding.d.ts +10 -3
- package/dist/core/http/securityHeadersMiddleware.d.ts +1 -2
- package/dist/core/http/signedUrl.d.ts +8 -6
- package/dist/core/http/throttleMiddleware.d.ts +9 -5
- package/dist/core/http/uploads.d.ts +9 -3
- package/dist/core/http/webErrorResponse.d.ts +8 -2
- package/dist/core/jobs/exportAuditLogsJob.d.ts +5 -2
- package/dist/core/jobs/invalidateCacheTagsJob.d.ts +5 -4
- package/dist/core/lifecycle/gracefulShutdown.d.ts +2 -5
- package/dist/core/logging/requestLoggingMiddleware.d.ts +1 -1
- package/dist/core/mail/mailer.d.ts +7 -5
- package/dist/core/openapi/generator.d.ts +12 -4
- package/dist/core/openapi/registeredRoute.d.ts +4 -4
- package/dist/core/queue/createAppQueue.d.ts +9 -4
- package/dist/core/queue/failedJobMetrics.d.ts +11 -2
- package/dist/core/queue/failedJobRepository.d.ts +6 -3
- package/dist/core/queue/failedJobService.d.ts +1 -0
- package/dist/core/queue/index.d.ts +16 -6
- package/dist/core/queue/jobRegistry.d.ts +3 -2
- package/dist/core/queue/jobRunner.d.ts +10 -4
- package/dist/core/queue/publicQueue.d.ts +18 -9
- package/dist/core/queue/queueConfig.d.ts +20 -10
- package/dist/core/queue/queueHandoff.d.ts +31 -0
- package/dist/core/queue/queueMetrics.d.ts +10 -3
- package/dist/core/queue/queueServices.d.ts +28 -0
- package/dist/core/queue/queueWorkerTransport.d.ts +28 -0
- package/dist/core/queue/redisQueue.d.ts +19 -10
- package/dist/core/queue/redisQueueKeys.d.ts +5 -5
- package/dist/core/queue/redisStreams.d.ts +17 -10
- package/dist/core/queue/resilientQueue.d.ts +10 -4
- package/dist/core/queue/types.d.ts +1 -0
- package/dist/core/runtime/appKeyPrefix.d.ts +5 -5
- package/dist/core/runtime/application.d.ts +7 -0
- package/dist/core/runtime/executionContext.d.ts +9 -0
- package/dist/core/runtime/executionTasks.d.ts +49 -0
- package/dist/core/runtime/resourceJournal.d.ts +67 -0
- package/dist/core/runtime/serviceGraph.d.ts +14 -0
- package/dist/core/security/oauthState.d.ts +13 -9
- package/dist/core/security/publicReads.d.ts +2 -2
- package/dist/core/security/safeFetch.d.ts +1 -0
- package/dist/core/security/safeUrl.d.ts +3 -0
- package/dist/core/security/scimTenantTokens.d.ts +1 -1
- package/dist/core/security/tokenExpiry.d.ts +1 -1
- package/dist/core/security/webhookSignature.d.ts +1 -1
- package/dist/core/storage/storage.d.ts +24 -16
- package/dist/core/tenant/databaseTenantContext.d.ts +5 -7
- package/dist/core/tenant/resolveTenant.d.ts +2 -2
- package/dist/core/tenant/scopedDatabasePolicy.d.ts +8 -0
- package/dist/core/tenant/tenantDatabaseScope.d.ts +3 -7
- package/dist/core/tenant/tenantMiddleware.d.ts +15 -4
- package/dist/core/tracing/otel.d.ts +4 -6
- package/dist/core/tracing/tracingMiddleware.d.ts +3 -3
- package/dist/core/view/etaViewEngine.d.ts +1 -1
- package/dist/core/view/index.d.ts +5 -4
- package/dist/core/view/tokens.d.ts +8 -0
- package/dist/core/view/viewRenderer.d.ts +2 -2
- package/dist/core/view/webErrorView.d.ts +8 -7
- package/dist/core/view/webLayoutData.d.ts +6 -4
- package/dist/entries/audit/exportAuditLogs.js +87 -1024
- package/dist/entries/audit/siemFormatter.js +4 -90
- package/dist/entries/auth/abilityCatalog.js +28 -0
- package/dist/entries/auth/accessControl.js +5 -16
- package/dist/entries/auth/accountStateMigration.js +216 -236
- package/dist/entries/auth/authOutcome.js +80 -0
- package/dist/entries/auth/authReader.js +68 -0
- package/dist/entries/auth/basicAuthGuard.js +144 -1249
- package/dist/entries/auth/emailVerification.js +2 -2
- package/dist/entries/auth/intendedUrlCookie.js +35 -59
- package/dist/entries/auth/jwt.js +22 -47
- package/dist/entries/auth/jwtGuard.js +99 -231
- package/dist/entries/auth/membershipMiddleware.js +71 -10
- package/dist/entries/auth/membershipScope.js +16 -22
- package/dist/entries/auth/membershipService.js +11 -28
- package/dist/entries/auth/oauth/oidcProvider.js +59 -64
- package/dist/entries/auth/oauth/providers.js +12 -95
- package/dist/entries/auth/oauth/samlProvider.js +53 -1080
- package/dist/entries/auth/oneTimeToken.js +27 -289
- package/dist/entries/auth/passwordConfirmCookie.js +40 -63
- package/dist/entries/auth/passwordLogin.js +94 -399
- package/dist/entries/auth/pendingMfaCookie.js +6 -6
- package/dist/entries/auth/policy.js +22 -56
- package/dist/entries/auth/saml/samlServiceProvider.js +55 -1084
- package/dist/entries/auth/scimAuthMiddleware.js +16 -3358
- package/dist/entries/auth/sessionCookie.js +58 -73
- package/dist/entries/auth/sessionGuard.js +95 -248
- package/dist/entries/auth/tokenHash.js +11 -43
- package/dist/entries/cache/createCacheStore.js +126 -117
- package/dist/entries/cache/repository.js +25 -0
- package/dist/entries/cache/simpleCache.js +12 -7
- package/dist/entries/cache/tokens.js +9 -0
- package/dist/entries/config/applicationConfig.js +163 -0
- package/dist/entries/config/envSchema.js +21 -4
- package/dist/entries/contracts/application.js +1 -0
- package/dist/entries/contracts/authUserDirectory.js +10 -0
- package/dist/entries/contracts/container.js +99 -26
- package/dist/entries/contracts/di.js +3 -0
- package/dist/entries/contracts/executionContext.js +7 -0
- package/dist/entries/contracts/executionOperations.js +7 -0
- package/dist/entries/contracts/executionOwnership.js +7 -0
- package/dist/entries/contracts/membership.js +1 -0
- package/dist/entries/contracts/persistence.js +1 -0
- package/dist/entries/contracts/serviceTokens.js +26 -116
- package/dist/entries/contracts/services.js +98 -0
- package/dist/entries/contracts/token.js +41 -0
- package/dist/entries/crypto/fieldEncryption.js +49 -50
- package/dist/entries/crypto/mfaSecret.js +86 -82
- package/dist/entries/database/acquisitionMetrics.js +107 -0
- package/dist/entries/database/baseRepository.d.ts +2 -0
- package/dist/entries/database/bindings.js +2082 -0
- package/dist/entries/database/definitions.js +175 -0
- package/dist/entries/database/errors.js +114 -89
- package/dist/entries/database/factory.js +67 -28
- package/dist/entries/database/migrations.js +172 -224
- package/dist/entries/database/model.d.ts +1 -0
- package/dist/entries/database/ownedReadOnlyObservation.js +1282 -0
- package/dist/entries/database/query.js +159 -161
- package/dist/entries/database/repositoryQuery.d.ts +1 -0
- package/dist/entries/database/repositoryQuery.js +1 -1373
- package/dist/entries/database/schema.js +216 -236
- package/dist/entries/database/session.js +1 -0
- package/dist/entries/database/sqliteConnection.js +525 -83
- package/dist/entries/database/tokens.js +9 -0
- package/dist/entries/errors/http.js +118 -1
- package/dist/entries/http/authMiddleware.js +8 -5
- package/dist/entries/http/authorizeMiddleware.js +1 -1
- package/dist/entries/http/bodySizeLimitMiddleware.js +2 -2
- package/dist/entries/http/clientIp.js +2 -2
- package/dist/entries/http/conditionalResponse.js +19 -7
- package/dist/entries/http/corsMiddleware.js +6 -101
- package/dist/entries/http/csrfMiddleware.js +92 -106
- package/dist/entries/http/csrfToken.js +58 -94
- package/dist/entries/http/etag.js +7 -4
- package/dist/entries/http/flashMiddleware.js +57 -99
- package/dist/entries/http/flashSession.js +41 -68
- package/dist/entries/http/memoryThrottleMiddleware.js +43 -186
- package/dist/entries/http/metricsMiddleware.js +2 -16
- package/dist/entries/http/parseMultipartUpload.js +15 -29
- package/dist/entries/http/requireAbilityMiddleware.js +2 -2
- package/dist/entries/http/requirePasswordConfirmMiddleware.js +19 -31
- package/dist/entries/http/requireVerifiedMiddleware.js +4 -7
- package/dist/entries/http/requireWebAuthMiddleware.js +2 -2
- package/dist/entries/http/response.js +67 -233
- package/dist/entries/http/routeMiddleware.js +0 -14
- package/dist/entries/http/scimThrottleMiddleware.js +43 -237
- package/dist/entries/http/securedRouteModelBinding.js +37 -25
- package/dist/entries/http/securityHeadersMiddleware.js +8 -25
- package/dist/entries/http/signedUrl.js +20 -110
- package/dist/entries/http/throttleMiddleware.js +41 -185
- package/dist/entries/http/uploads.js +9 -24
- package/dist/entries/jobs/exportAuditLogsJob.js +17 -1498
- package/dist/entries/jobs/invalidateCacheTagsJob.js +12 -47
- package/dist/entries/logging/requestLoggingMiddleware.js +4 -4
- package/dist/entries/mail/mailer.js +68 -78
- package/dist/entries/openapi/generator.js +33 -100
- package/dist/entries/queue/createAppQueue.js +416 -254
- package/dist/entries/queue/failedJobRepository.js +19 -8
- package/dist/entries/queue/failedJobService.js +1 -0
- package/dist/entries/queue/jobRunner.js +141 -66
- package/dist/entries/queue/publicQueue.js +411 -255
- package/dist/entries/queue/queueConfig.js +61 -0
- package/dist/entries/queue/queueHandoff.js +318 -0
- package/dist/entries/queue/queueMetrics.js +989 -1384
- package/dist/entries/queue/queueServices.js +133 -0
- package/dist/entries/queue/queueWorkerTransport.js +1703 -0
- package/dist/entries/queue/redisQueue.js +282 -180
- package/dist/entries/queue.js +6 -45
- package/dist/entries/runtime/application.js +1585 -0
- package/dist/entries/runtime/asyncContextStore.js +0 -16
- package/dist/entries/security/oauthState.js +35 -67
- package/dist/entries/security/publicReads.js +4 -4
- package/dist/entries/security/safeFetch.js +1 -0
- package/dist/entries/security/scimTenantTokens.js +3 -3
- package/dist/entries/security/tokenExpiry.js +2 -2
- package/dist/entries/security/totp.js +1 -87
- package/dist/entries/security/webhookSignature.js +2 -90
- package/dist/entries/storage/storage.js +120 -45
- package/dist/entries/tenant/databaseTenantContext.js +6 -907
- package/dist/entries/tenant/publicTenantHost.js +78 -0
- package/dist/entries/tenant/resolveTenant.js +14 -0
- package/dist/entries/tenant/scopedDatabasePolicy.js +75 -0
- package/dist/entries/tenant/tenancyConfig.js +1 -19
- package/dist/entries/tenant/tenantDatabaseScope.js +3 -892
- package/dist/entries/tracing/tracingMiddleware.js +104 -173
- package/dist/entries/view/tokens.js +11 -0
- package/dist/framework/public-api.d.ts +62 -44
- package/dist/index.js +10433 -11347
- package/dist/internal/ormInternal.js +117 -0
- package/dist/internal/ormRuntime.js +5000 -0
- package/package.json +158 -46
- package/dist/core/database/bindConnection.d.ts +0 -1
- package/dist/core/database/boundConnection.d.ts +0 -5
- package/dist/core/database/defaultConnection.d.ts +0 -7
- package/dist/core/database/namedConnections.d.ts +0 -15
- package/dist/core/database/readOnlyCollector.d.ts +0 -7
- package/dist/core/database/repositoryConnection.d.ts +0 -4
- package/dist/core/database/transaction.d.ts +0 -23
- package/dist/core/database/transactionControl.d.ts +0 -6
- package/dist/core/events/deferredModelEvents.d.ts +0 -7
- package/dist/core/facades/index.d.ts +0 -10
- package/dist/core/runtime/applicationRegistry.d.ts +0 -18
- package/dist/entries/database/bindConnection.js +0 -1
- package/dist/entries/database/boundConnection.js +0 -1
- package/dist/entries/database/defaultConnection.js +0 -1
- package/dist/entries/database/namedConnections.js +0 -1
- package/dist/entries/database/repositoryConnection.js +0 -1
- package/dist/entries/database/transaction.js +0 -1
- package/dist/entries/facades.js +0 -711
- package/dist/entries/runtime/applicationRegistry.js +0 -1
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
err = [e];
|
|
8
|
-
}
|
|
9
|
-
if (err)
|
|
10
|
-
throw err[0];
|
|
11
|
-
return res;
|
|
12
|
-
};
|
|
2
|
+
// ../../src/core/auth/membershipServiceImplementation.ts
|
|
3
|
+
import { ForbiddenError as ForbiddenError2 } from "@getstrata/core/errors/http";
|
|
4
|
+
|
|
5
|
+
// ../../src/core/auth/accessControl.ts
|
|
6
|
+
import { ForbiddenError } from "@getstrata/core/errors/http";
|
|
13
7
|
|
|
14
8
|
// ../../src/core/runtime/asyncContextStore.ts
|
|
15
9
|
import { AsyncLocalStorage } from "async_hooks";
|
|
@@ -24,19 +18,13 @@ function createAsyncContextStore(key) {
|
|
|
24
18
|
globalRecord[symbol] = store;
|
|
25
19
|
return store;
|
|
26
20
|
}
|
|
27
|
-
var init_asyncContextStore = () => {};
|
|
28
|
-
|
|
29
|
-
// ../../src/core/auth/membershipServiceImplementation.ts
|
|
30
|
-
import { resolveMembershipLookup } from "@getstrata/core/auth/membershipContext";
|
|
31
|
-
import { ForbiddenError as ForbiddenError2 } from "@getstrata/core/errors/http";
|
|
32
|
-
|
|
33
|
-
// ../../src/core/auth/accessControl.ts
|
|
34
|
-
import { ForbiddenError } from "@getstrata/core/errors/http";
|
|
35
21
|
|
|
36
22
|
// ../../src/core/auth/authContext.ts
|
|
37
|
-
init_asyncContextStore();
|
|
38
23
|
var authContext = createAsyncContextStore("@getstrata/authContext");
|
|
39
24
|
var credentialSourceContext = createAsyncContextStore("@getstrata/credentialSource");
|
|
25
|
+
function runWithAuthContext(user, credentialSource, callback) {
|
|
26
|
+
return authContext.run(user, () => credentialSourceContext.run(credentialSource, callback));
|
|
27
|
+
}
|
|
40
28
|
function currentAuthUser() {
|
|
41
29
|
return authContext.getStore() ?? null;
|
|
42
30
|
}
|
|
@@ -74,7 +62,7 @@ function resolveUserId(user) {
|
|
|
74
62
|
// ../../src/core/auth/membershipServiceImplementation.ts
|
|
75
63
|
class MembershipService {
|
|
76
64
|
members;
|
|
77
|
-
constructor(members
|
|
65
|
+
constructor(members) {
|
|
78
66
|
this.members = members;
|
|
79
67
|
}
|
|
80
68
|
async listOrganizationIdsForUser(userId) {
|
|
@@ -130,13 +118,8 @@ class MembershipService {
|
|
|
130
118
|
}
|
|
131
119
|
var membershipServiceImplementation_default = MembershipService;
|
|
132
120
|
// ../../src/core/auth/resolveMembershipService.ts
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const dependencies = resolveApplicationDependencies();
|
|
136
|
-
if (dependencies.container.has("core.membership")) {
|
|
137
|
-
return dependencies.container.resolve("core.membership");
|
|
138
|
-
}
|
|
139
|
-
return new membershipServiceImplementation_default;
|
|
121
|
+
function resolveMembershipService(members) {
|
|
122
|
+
return new membershipServiceImplementation_default(members);
|
|
140
123
|
}
|
|
141
124
|
export {
|
|
142
125
|
membershipServiceImplementation_default as default,
|
|
@@ -85,6 +85,7 @@ async function safeFetch(input, init = {}, options = {}) {
|
|
|
85
85
|
}
|
|
86
86
|
const maxRedirects = options.maxRedirects ?? 0;
|
|
87
87
|
const urlOptions = {
|
|
88
|
+
production: options.production,
|
|
88
89
|
allowHttp: options.allowHttp,
|
|
89
90
|
resolveDns: options.resolveDns ?? true,
|
|
90
91
|
allowPrivate: options.allowPrivate
|
|
@@ -138,26 +139,6 @@ async function safeFetch(input, init = {}, options = {}) {
|
|
|
138
139
|
// ../../src/core/auth/oauth/oidcIdToken.ts
|
|
139
140
|
import { createHash, createPublicKey, createVerify } from "crypto";
|
|
140
141
|
|
|
141
|
-
// ../../src/core/runtime/appEnv.ts
|
|
142
|
-
var NON_PRODUCTION_APP_ENVS = new Set(["local", "development", "dev", "test", "testing", "ci"]);
|
|
143
|
-
function normalizeEnvValue(value) {
|
|
144
|
-
return (value ?? "").trim().toLowerCase();
|
|
145
|
-
}
|
|
146
|
-
function isProductionEnv(env = process.env) {
|
|
147
|
-
const appEnv = normalizeEnvValue(env.APP_ENV);
|
|
148
|
-
const nodeEnv = normalizeEnvValue(env.NODE_ENV);
|
|
149
|
-
if (appEnv === "production" || nodeEnv === "production") {
|
|
150
|
-
return true;
|
|
151
|
-
}
|
|
152
|
-
if (appEnv === "") {
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
return !NON_PRODUCTION_APP_ENVS.has(appEnv);
|
|
156
|
-
}
|
|
157
|
-
function envFlagEnabled(value) {
|
|
158
|
-
return value === "true";
|
|
159
|
-
}
|
|
160
|
-
|
|
161
142
|
// ../../src/core/security/timingSafeCompare.ts
|
|
162
143
|
import { timingSafeEqual } from "crypto";
|
|
163
144
|
function timingSafeCompareString(left, right) {
|
|
@@ -171,8 +152,20 @@ function timingSafeCompareString(left, right) {
|
|
|
171
152
|
|
|
172
153
|
// ../../src/core/auth/oauth/oidcIdToken.ts
|
|
173
154
|
var JWKS_TTL_MS = 60 * 60 * 1000;
|
|
174
|
-
|
|
175
|
-
|
|
155
|
+
function createOidcClient(input = { production: true }) {
|
|
156
|
+
if (typeof input.production !== "boolean" || input.allowPrivate !== undefined && typeof input.allowPrivate !== "boolean")
|
|
157
|
+
throw new TypeError("OIDC requires an explicit valid network policy.");
|
|
158
|
+
const state = {
|
|
159
|
+
policy: Object.freeze({ ...input }),
|
|
160
|
+
discoveryCache: new Map,
|
|
161
|
+
jwksCache: new Map
|
|
162
|
+
};
|
|
163
|
+
return Object.freeze({
|
|
164
|
+
loadDiscovery: (issuer) => loadOidcDiscovery(issuer, state),
|
|
165
|
+
verifyIdToken: (token, options) => verifyOidcIdToken(token, options, state),
|
|
166
|
+
fetchOptions: (url) => oidcSafeFetchOptions(url, state.policy)
|
|
167
|
+
});
|
|
168
|
+
}
|
|
176
169
|
function issuerOrigin(issuer) {
|
|
177
170
|
return issuer.replace(/\/$/, "");
|
|
178
171
|
}
|
|
@@ -180,11 +173,11 @@ function oidcLoopbackHost(hostname) {
|
|
|
180
173
|
const host = hostname.trim().toLowerCase().replace(/^\[|\]$/gu, "");
|
|
181
174
|
return host === "localhost" || host === "127.0.0.1" || host === "::1";
|
|
182
175
|
}
|
|
183
|
-
function oidcOutboundAllowsPrivate(url) {
|
|
184
|
-
if (
|
|
176
|
+
function oidcOutboundAllowsPrivate(url, policy) {
|
|
177
|
+
if (policy.production) {
|
|
185
178
|
return false;
|
|
186
179
|
}
|
|
187
|
-
if (
|
|
180
|
+
if (policy.allowPrivate) {
|
|
188
181
|
return true;
|
|
189
182
|
}
|
|
190
183
|
try {
|
|
@@ -193,42 +186,51 @@ function oidcOutboundAllowsPrivate(url) {
|
|
|
193
186
|
return false;
|
|
194
187
|
}
|
|
195
188
|
}
|
|
196
|
-
function oidcSafeFetchOptions(url) {
|
|
189
|
+
function oidcSafeFetchOptions(url, policy) {
|
|
197
190
|
return {
|
|
198
|
-
|
|
199
|
-
|
|
191
|
+
production: policy.production,
|
|
192
|
+
allowHttp: !policy.production,
|
|
193
|
+
allowPrivate: oidcOutboundAllowsPrivate(url, policy),
|
|
200
194
|
timeoutMs: 1e4,
|
|
201
195
|
maxRedirects: 0
|
|
202
196
|
};
|
|
203
197
|
}
|
|
204
|
-
async function fetchJson(url) {
|
|
205
|
-
const response = await safeFetch(url, { headers: { accept: "application/json" } }, oidcSafeFetchOptions(url));
|
|
198
|
+
async function fetchJson(url, state) {
|
|
199
|
+
const response = await safeFetch(url, { headers: { accept: "application/json" } }, oidcSafeFetchOptions(url, state.policy));
|
|
206
200
|
return await response.json();
|
|
207
201
|
}
|
|
208
|
-
async function loadOidcDiscovery(issuer) {
|
|
202
|
+
async function loadOidcDiscovery(issuer, state) {
|
|
209
203
|
const key = issuerOrigin(issuer);
|
|
210
|
-
const cached = discoveryCache.get(key);
|
|
204
|
+
const cached = state.discoveryCache.get(key);
|
|
211
205
|
if (cached && Date.now() - cached.fetchedAt < JWKS_TTL_MS) {
|
|
212
206
|
return cached.discovery;
|
|
213
207
|
}
|
|
214
|
-
const
|
|
215
|
-
|
|
208
|
+
const raw = await fetchJson(`${key}/.well-known/openid-configuration`, state);
|
|
209
|
+
const document = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
|
|
210
|
+
const { authorization_endpoint, token_endpoint, jwks_uri, issuer: declaredIssuer } = document;
|
|
211
|
+
if (typeof authorization_endpoint !== "string" || !authorization_endpoint.trim() || typeof token_endpoint !== "string" || !token_endpoint.trim() || typeof jwks_uri !== "string" || !jwks_uri.trim()) {
|
|
216
212
|
throw new Error("OIDC discovery document did not include authorization_endpoint, jwks_uri, and token_endpoint.");
|
|
217
213
|
}
|
|
218
|
-
|
|
214
|
+
const discovery = Object.freeze({
|
|
215
|
+
...typeof declaredIssuer === "string" ? { issuer: declaredIssuer } : {},
|
|
216
|
+
authorization_endpoint: authorization_endpoint.trim(),
|
|
217
|
+
token_endpoint: token_endpoint.trim(),
|
|
218
|
+
jwks_uri: jwks_uri.trim()
|
|
219
|
+
});
|
|
220
|
+
state.discoveryCache.set(key, { discovery, fetchedAt: Date.now() });
|
|
219
221
|
return discovery;
|
|
220
222
|
}
|
|
221
|
-
async function loadOidcJwks(jwksUri, options = {}) {
|
|
222
|
-
const cached = jwksCache.get(jwksUri);
|
|
223
|
+
async function loadOidcJwks(jwksUri, state, options = {}) {
|
|
224
|
+
const cached = state.jwksCache.get(jwksUri);
|
|
223
225
|
if (!options.force && cached && Date.now() - cached.fetchedAt < JWKS_TTL_MS) {
|
|
224
226
|
return cached.keys;
|
|
225
227
|
}
|
|
226
|
-
const body = await fetchJson(jwksUri);
|
|
228
|
+
const body = await fetchJson(jwksUri, state);
|
|
227
229
|
const keys = Array.isArray(body.keys) ? body.keys : [];
|
|
228
230
|
if (keys.length === 0) {
|
|
229
231
|
throw new Error("OIDC JWKS document did not include signing keys.");
|
|
230
232
|
}
|
|
231
|
-
jwksCache.set(jwksUri, { keys, fetchedAt: Date.now() });
|
|
233
|
+
state.jwksCache.set(jwksUri, { keys, fetchedAt: Date.now() });
|
|
232
234
|
return keys;
|
|
233
235
|
}
|
|
234
236
|
function decodeJwtPart(value) {
|
|
@@ -298,7 +300,7 @@ function assertIdTokenClaims(payload, options) {
|
|
|
298
300
|
throw new Error("OIDC ID token is not yet valid.");
|
|
299
301
|
}
|
|
300
302
|
}
|
|
301
|
-
async function verifyOidcIdToken(token, options) {
|
|
303
|
+
async function verifyOidcIdToken(token, options, state) {
|
|
302
304
|
const parts = token.split(".");
|
|
303
305
|
if (parts.length !== 3 || !parts[0] || !parts[1] || !parts[2]) {
|
|
304
306
|
throw new Error("OIDC ID token signature is invalid.");
|
|
@@ -307,10 +309,10 @@ async function verifyOidcIdToken(token, options) {
|
|
|
307
309
|
if (header?.alg !== "RS256") {
|
|
308
310
|
throw new Error("OIDC ID token algorithm must be RS256.");
|
|
309
311
|
}
|
|
310
|
-
let keys = await loadOidcJwks(options.jwksUri);
|
|
312
|
+
let keys = await loadOidcJwks(options.jwksUri, state);
|
|
311
313
|
let candidates = header.kid ? keys.filter((key) => key.kid === header.kid) : keys;
|
|
312
314
|
if (header.kid && candidates.length === 0) {
|
|
313
|
-
keys = await loadOidcJwks(options.jwksUri, { force: true });
|
|
315
|
+
keys = await loadOidcJwks(options.jwksUri, state, { force: true });
|
|
314
316
|
candidates = keys.filter((key) => key.kid === header.kid);
|
|
315
317
|
}
|
|
316
318
|
const signingInput = `${parts[0]}.${parts[1]}`;
|
|
@@ -332,10 +334,6 @@ async function verifyOidcIdToken(token, options) {
|
|
|
332
334
|
assertIdTokenClaims(payload, options);
|
|
333
335
|
return payload;
|
|
334
336
|
}
|
|
335
|
-
function resetOidcDiscoveryCacheForTests() {
|
|
336
|
-
discoveryCache.clear();
|
|
337
|
-
jwksCache.clear();
|
|
338
|
-
}
|
|
339
337
|
|
|
340
338
|
// ../../src/core/auth/oauth/oidcProvider.ts
|
|
341
339
|
function base64Url(bytes) {
|
|
@@ -351,29 +349,27 @@ function createOidcHandshake() {
|
|
|
351
349
|
function codeChallenge(verifier) {
|
|
352
350
|
return createHash2("sha256").update(verifier).digest("base64url");
|
|
353
351
|
}
|
|
354
|
-
function requireOidcEndpoint(value, name) {
|
|
355
|
-
const trimmed = value?.trim() ?? "";
|
|
356
|
-
if (!trimmed) {
|
|
357
|
-
throw new Error(`OIDC discovery document did not include ${name}.`);
|
|
358
|
-
}
|
|
359
|
-
return trimmed;
|
|
360
|
-
}
|
|
361
352
|
|
|
362
353
|
class OidcProvider {
|
|
363
|
-
options;
|
|
364
354
|
name;
|
|
355
|
+
options;
|
|
356
|
+
client;
|
|
365
357
|
constructor(options) {
|
|
366
|
-
this.options =
|
|
358
|
+
this.options = Object.freeze({
|
|
359
|
+
...options,
|
|
360
|
+
scopes: options.scopes && Object.freeze([...options.scopes])
|
|
361
|
+
});
|
|
367
362
|
this.name = options.name;
|
|
363
|
+
this.client = createOidcClient(options.networkPolicy);
|
|
368
364
|
}
|
|
369
365
|
getAuthorizationUrl(_state, _redirectUri = this.options.redirectUri) {
|
|
370
366
|
throw new Error("OidcProvider.getAuthorizationUrl cannot complete PKCE. Use createAuthorization() and pass the handshake to exchangeCode().");
|
|
371
367
|
}
|
|
372
368
|
async createAuthorization(state = createOidcHandshake().state, redirectUri = this.options.redirectUri) {
|
|
373
|
-
const discovery = await
|
|
369
|
+
const discovery = await this.client.loadDiscovery(this.options.issuer);
|
|
374
370
|
const handshake = { ...createOidcHandshake(), state };
|
|
375
371
|
return {
|
|
376
|
-
url: this.buildAuthorizationUrl(state, handshake, redirectUri,
|
|
372
|
+
url: this.buildAuthorizationUrl(state, handshake, redirectUri, discovery.authorization_endpoint),
|
|
377
373
|
handshake
|
|
378
374
|
};
|
|
379
375
|
}
|
|
@@ -394,7 +390,7 @@ class OidcProvider {
|
|
|
394
390
|
if (!handshake?.nonce?.trim() || !handshake.codeVerifier?.trim()) {
|
|
395
391
|
throw new Error("OIDC token exchange requires the PKCE handshake from createAuthorization().");
|
|
396
392
|
}
|
|
397
|
-
const discovery = await
|
|
393
|
+
const discovery = await this.client.loadDiscovery(this.options.issuer);
|
|
398
394
|
const body = new URLSearchParams({
|
|
399
395
|
grant_type: "authorization_code",
|
|
400
396
|
code,
|
|
@@ -403,12 +399,12 @@ class OidcProvider {
|
|
|
403
399
|
client_secret: this.options.clientSecret,
|
|
404
400
|
code_verifier: handshake.codeVerifier
|
|
405
401
|
});
|
|
406
|
-
const tokenEndpoint =
|
|
402
|
+
const tokenEndpoint = discovery.token_endpoint;
|
|
407
403
|
const tokenResponse = await safeFetch(tokenEndpoint, {
|
|
408
404
|
method: "POST",
|
|
409
405
|
headers: { "content-type": "application/x-www-form-urlencoded" },
|
|
410
406
|
body
|
|
411
|
-
},
|
|
407
|
+
}, this.client.fetchOptions(tokenEndpoint));
|
|
412
408
|
const tokenBody = await tokenResponse.json();
|
|
413
409
|
if (!tokenBody.access_token) {
|
|
414
410
|
throw new Error("OIDC token exchange failed.");
|
|
@@ -416,11 +412,11 @@ class OidcProvider {
|
|
|
416
412
|
if (!tokenBody.id_token) {
|
|
417
413
|
throw new Error("OIDC token exchange did not return an ID token.");
|
|
418
414
|
}
|
|
419
|
-
const payload = await
|
|
415
|
+
const payload = await this.client.verifyIdToken(tokenBody.id_token, {
|
|
420
416
|
issuer: this.options.issuer,
|
|
421
417
|
clientId: this.options.clientId,
|
|
422
418
|
nonce: handshake.nonce,
|
|
423
|
-
jwksUri:
|
|
419
|
+
jwksUri: discovery.jwks_uri,
|
|
424
420
|
accessToken: tokenBody.access_token
|
|
425
421
|
});
|
|
426
422
|
if (typeof payload.email !== "string" || !payload.email.trim()) {
|
|
@@ -438,6 +434,5 @@ class OidcProvider {
|
|
|
438
434
|
}
|
|
439
435
|
export {
|
|
440
436
|
OidcProvider,
|
|
441
|
-
createOidcHandshake
|
|
442
|
-
resetOidcDiscoveryCacheForTests
|
|
437
|
+
createOidcHandshake
|
|
443
438
|
};
|
|
@@ -1,90 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// ../../src/core/runtime/appEnv.ts
|
|
3
|
-
var NON_PRODUCTION_APP_ENVS = new Set(["local", "development", "dev", "test", "testing", "ci"]);
|
|
4
|
-
function normalizeEnvValue(value) {
|
|
5
|
-
return (value ?? "").trim().toLowerCase();
|
|
6
|
-
}
|
|
7
|
-
function isProductionEnv(env = process.env) {
|
|
8
|
-
const appEnv = normalizeEnvValue(env.APP_ENV);
|
|
9
|
-
const nodeEnv = normalizeEnvValue(env.NODE_ENV);
|
|
10
|
-
if (appEnv === "production" || nodeEnv === "production") {
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
if (appEnv === "") {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
return !NON_PRODUCTION_APP_ENVS.has(appEnv);
|
|
17
|
-
}
|
|
18
|
-
function envFlagEnabled(value) {
|
|
19
|
-
return value === "true";
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// ../../src/core/runtime/appKeyPrefix.ts
|
|
23
|
-
function appKeyPrefix() {
|
|
24
|
-
return process.env.APP_KEY_PREFIX?.trim() || "strata";
|
|
25
|
-
}
|
|
26
|
-
function appCookieName(kind) {
|
|
27
|
-
return `${appKeyPrefix()}_${kind}`;
|
|
28
|
-
}
|
|
29
|
-
function appDevSecret(kind) {
|
|
30
|
-
return `${appKeyPrefix()}-dev-${kind}`;
|
|
31
|
-
}
|
|
32
|
-
function requireConfiguredSecret(names, devKind, env = process.env) {
|
|
33
|
-
for (const name of names) {
|
|
34
|
-
const value = env[name]?.trim();
|
|
35
|
-
if (value) {
|
|
36
|
-
return value;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
if (isProductionEnv(env)) {
|
|
40
|
-
throw new Error(`${names[0]} must be set outside development. Do not derive secrets from the app name.`);
|
|
41
|
-
}
|
|
42
|
-
return appDevSecret(devKind);
|
|
43
|
-
}
|
|
44
|
-
function namespacedRedisKey(kind) {
|
|
45
|
-
return `${appKeyPrefix()}:${kind}`;
|
|
46
|
-
}
|
|
47
|
-
function smtpEhloHost() {
|
|
48
|
-
const raw = process.env.MAIL_EHLO?.trim() || `${appKeyPrefix()}.local`;
|
|
49
|
-
const safe = raw.replace(/[^a-zA-Z0-9.-]/g, "");
|
|
50
|
-
return safe || "strata.local";
|
|
51
|
-
}
|
|
52
|
-
function siemEventType() {
|
|
53
|
-
return process.env.SIEM_EVENT_TYPE?.trim() || `${appKeyPrefix()}.audit`;
|
|
54
|
-
}
|
|
55
|
-
function appUserAgent() {
|
|
56
|
-
return process.env.APP_USER_AGENT?.trim() || appKeyPrefix();
|
|
57
|
-
}
|
|
58
|
-
function otelServiceName() {
|
|
59
|
-
return process.env.OTEL_SERVICE_NAME?.trim() || `${appKeyPrefix()}-api`;
|
|
60
|
-
}
|
|
61
|
-
function webhookSignatureHeader() {
|
|
62
|
-
return process.env.WEBHOOK_SIGNATURE_HEADER?.trim() || `x-${appKeyPrefix()}-signature`;
|
|
63
|
-
}
|
|
64
|
-
function appDisplayName() {
|
|
65
|
-
return process.env.APP_NAME?.trim() || "Strata";
|
|
66
|
-
}
|
|
67
|
-
function appEnv() {
|
|
68
|
-
return process.env.APP_ENV?.trim() || "local";
|
|
69
|
-
}
|
|
70
|
-
function appUrl() {
|
|
71
|
-
return (process.env.APP_URL?.trim() || "http://localhost:3000").replace(/\/$/, "");
|
|
72
|
-
}
|
|
73
|
-
function apiPrefix() {
|
|
74
|
-
const raw = process.env.API_PREFIX?.trim() || "/api/v1";
|
|
75
|
-
const withSlash = raw.startsWith("/") ? raw : `/${raw}`;
|
|
76
|
-
const trimmed = withSlash.replace(/\/+$/, "");
|
|
77
|
-
return trimmed || "/api/v1";
|
|
78
|
-
}
|
|
79
|
-
function sdkClientClassName() {
|
|
80
|
-
const override = process.env.APP_SDK_CLASS?.trim();
|
|
81
|
-
if (override && /^[A-Za-z_][A-Za-z0-9_]*$/.test(override)) {
|
|
82
|
-
return override;
|
|
83
|
-
}
|
|
84
|
-
const fromName = appDisplayName().replace(/[^A-Za-z0-9]/g, "");
|
|
85
|
-
return fromName ? `${fromName}Client` : "AppClient";
|
|
86
|
-
}
|
|
87
|
-
|
|
88
2
|
// ../../src/core/security/safeFetch.ts
|
|
89
3
|
import { pinUrlToAddress, resolveSafeOutboundTarget } from "@getstrata/core/security/safeUrl";
|
|
90
4
|
var DEFAULT_FETCH_TIMEOUT_MS = 1e4;
|
|
@@ -168,6 +82,7 @@ async function safeFetch(input, init = {}, options = {}) {
|
|
|
168
82
|
}
|
|
169
83
|
const maxRedirects = options.maxRedirects ?? 0;
|
|
170
84
|
const urlOptions = {
|
|
85
|
+
production: options.production,
|
|
171
86
|
allowHttp: options.allowHttp,
|
|
172
87
|
resolveDns: options.resolveDns ?? true,
|
|
173
88
|
allowPrivate: options.allowPrivate
|
|
@@ -219,14 +134,14 @@ async function safeFetch(input, init = {}, options = {}) {
|
|
|
219
134
|
}
|
|
220
135
|
|
|
221
136
|
// ../../src/core/auth/oauth/providers.ts
|
|
222
|
-
async function githubVerifiedEmail(accessToken) {
|
|
137
|
+
async function githubVerifiedEmail(accessToken, options) {
|
|
223
138
|
const emailsResponse = await safeFetch("https://api.github.com/user/emails", {
|
|
224
139
|
headers: {
|
|
225
140
|
authorization: `Bearer ${accessToken}`,
|
|
226
141
|
accept: "application/json",
|
|
227
|
-
"user-agent":
|
|
142
|
+
"user-agent": options.userAgent
|
|
228
143
|
}
|
|
229
|
-
}, { timeoutMs: 1e4, maxRedirects: 0 });
|
|
144
|
+
}, { timeoutMs: 1e4, maxRedirects: 0, production: options.production });
|
|
230
145
|
const emails = await emailsResponse.json();
|
|
231
146
|
if (!Array.isArray(emails)) {
|
|
232
147
|
return null;
|
|
@@ -237,10 +152,12 @@ async function githubVerifiedEmail(accessToken) {
|
|
|
237
152
|
}
|
|
238
153
|
|
|
239
154
|
class GitHubOAuthProvider {
|
|
240
|
-
options;
|
|
241
155
|
name = "github";
|
|
156
|
+
options;
|
|
242
157
|
constructor(options) {
|
|
243
|
-
|
|
158
|
+
if (typeof options.production !== "boolean" || !options.userAgent?.trim())
|
|
159
|
+
throw new TypeError("Explicit GitHub OAuth production policy and user agent are required.");
|
|
160
|
+
this.options = Object.freeze({ ...options });
|
|
244
161
|
}
|
|
245
162
|
getAuthorizationUrl(state, redirectUri = this.options.redirectUri) {
|
|
246
163
|
const params = new URLSearchParams({
|
|
@@ -264,7 +181,7 @@ class GitHubOAuthProvider {
|
|
|
264
181
|
code,
|
|
265
182
|
redirect_uri: redirectUri
|
|
266
183
|
})
|
|
267
|
-
}, { timeoutMs: 1e4, maxRedirects: 0 });
|
|
184
|
+
}, { timeoutMs: 1e4, maxRedirects: 0, production: this.options.production });
|
|
268
185
|
const tokenBody = await tokenResponse.json();
|
|
269
186
|
if (!tokenBody.access_token) {
|
|
270
187
|
throw new Error("GitHub OAuth token exchange failed.");
|
|
@@ -273,11 +190,11 @@ class GitHubOAuthProvider {
|
|
|
273
190
|
headers: {
|
|
274
191
|
authorization: `Bearer ${tokenBody.access_token}`,
|
|
275
192
|
accept: "application/json",
|
|
276
|
-
"user-agent":
|
|
193
|
+
"user-agent": this.options.userAgent
|
|
277
194
|
}
|
|
278
|
-
}, { timeoutMs: 1e4, maxRedirects: 0 });
|
|
195
|
+
}, { timeoutMs: 1e4, maxRedirects: 0, production: this.options.production });
|
|
279
196
|
const profile = await profileResponse.json();
|
|
280
|
-
const email = await githubVerifiedEmail(tokenBody.access_token);
|
|
197
|
+
const email = await githubVerifiedEmail(tokenBody.access_token, this.options);
|
|
281
198
|
if (!email) {
|
|
282
199
|
throw new Error("GitHub OAuth profile did not include a verified email address.");
|
|
283
200
|
}
|