@vibesdotdev/kit 1.0.0-rc.3 → 1.0.0-rc.4
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/lib/server/handles/active-org.d.ts +12 -0
- package/dist/lib/server/handles/active-org.js +4 -3
- package/dist/lib/server/handles/index.d.ts +1 -1
- package/dist/lib/server/handles/index.js +1 -1
- package/dist/lib/server/index.d.ts +1 -1
- package/dist/lib/server/index.js +1 -1
- package/package.json +8 -8
|
@@ -47,6 +47,18 @@ interface ActiveOrgCookieOptions {
|
|
|
47
47
|
maxAge: number;
|
|
48
48
|
domain?: string;
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* The caller's validated org-membership id set, or `null` when NEITHER
|
|
52
|
+
* userContext (account-web) nor a JWT `orgs` claim is available to validate
|
|
53
|
+
* against (legacy token). Header validation treats `null` as fail-closed, and
|
|
54
|
+
* so must any other caller deciding whether a request may name an org.
|
|
55
|
+
*/
|
|
56
|
+
export declare function verifiedMembershipOrgIds(locals: {
|
|
57
|
+
userContext?: unknown;
|
|
58
|
+
user?: {
|
|
59
|
+
orgs?: unknown;
|
|
60
|
+
} | null;
|
|
61
|
+
}): Set<string> | null;
|
|
50
62
|
/**
|
|
51
63
|
* Create a handle that reads the activeOrg cookie and populates
|
|
52
64
|
* event.locals.activeOrgId.
|
|
@@ -43,9 +43,10 @@ export const ACTIVE_ORG_HEADER_NAME = 'x-vibes-active-org';
|
|
|
43
43
|
/**
|
|
44
44
|
* The caller's validated org-membership id set, or `null` when NEITHER
|
|
45
45
|
* userContext (account-web) nor a JWT `orgs` claim is available to validate
|
|
46
|
-
* against (legacy token). Header validation treats `null` as fail-closed
|
|
46
|
+
* against (legacy token). Header validation treats `null` as fail-closed, and
|
|
47
|
+
* so must any other caller deciding whether a request may name an org.
|
|
47
48
|
*/
|
|
48
|
-
function
|
|
49
|
+
export function verifiedMembershipOrgIds(locals) {
|
|
49
50
|
const orgs = readUserContext(locals)?.organizations;
|
|
50
51
|
if (orgs) {
|
|
51
52
|
return new Set(orgs.map((org) => org.id));
|
|
@@ -96,7 +97,7 @@ export function createActiveOrgHandle() {
|
|
|
96
97
|
// user-scoped data while believing it acts as the org.
|
|
97
98
|
const headerOrgId = event.request.headers.get(ACTIVE_ORG_HEADER_NAME)?.trim();
|
|
98
99
|
if (headerOrgId) {
|
|
99
|
-
const members =
|
|
100
|
+
const members = verifiedMembershipOrgIds(locals);
|
|
100
101
|
if (!members || !members.has(headerOrgId)) {
|
|
101
102
|
return forbiddenActiveOrgResponse();
|
|
102
103
|
}
|
|
@@ -28,7 +28,7 @@ export { createUserContextHandle, invalidateUserContext } from './user-context.j
|
|
|
28
28
|
export type { UserContextHandleOptions } from './user-context.js';
|
|
29
29
|
export { checkProjectAccessViaProjectsApi, createActiveProjectHandle, invalidateActiveProjectAccess, readActiveProjectCookie, setActiveProjectCookie, ACTIVE_PROJECT_COOKIE_NAME } from './active-project.js';
|
|
30
30
|
export type { ActiveProjectHandleOptions, ProjectAccessFetcher } from './active-project.js';
|
|
31
|
-
export { createActiveOrgHandle, readActiveOrgCookie, setActiveOrgCookie, ACTIVE_ORG_COOKIE_NAME, ACTIVE_ORG_HEADER_NAME } from './active-org.js';
|
|
31
|
+
export { createActiveOrgHandle, readActiveOrgCookie, setActiveOrgCookie, ACTIVE_ORG_COOKIE_NAME, ACTIVE_ORG_HEADER_NAME, verifiedMembershipOrgIds } from './active-org.js';
|
|
32
32
|
export { createOrgMembershipHandle } from './org-membership.js';
|
|
33
33
|
export { scopeFromLocals, tryScopeFromLocals } from './scope.js';
|
|
34
34
|
export type { VibesScope } from './scope.js';
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
*/
|
|
27
27
|
export { createUserContextHandle, invalidateUserContext } from './user-context.js';
|
|
28
28
|
export { checkProjectAccessViaProjectsApi, createActiveProjectHandle, invalidateActiveProjectAccess, readActiveProjectCookie, setActiveProjectCookie, ACTIVE_PROJECT_COOKIE_NAME } from './active-project.js';
|
|
29
|
-
export { createActiveOrgHandle, readActiveOrgCookie, setActiveOrgCookie, ACTIVE_ORG_COOKIE_NAME, ACTIVE_ORG_HEADER_NAME } from './active-org.js';
|
|
29
|
+
export { createActiveOrgHandle, readActiveOrgCookie, setActiveOrgCookie, ACTIVE_ORG_COOKIE_NAME, ACTIVE_ORG_HEADER_NAME, verifiedMembershipOrgIds } from './active-org.js';
|
|
30
30
|
export { createOrgMembershipHandle } from './org-membership.js';
|
|
31
31
|
export { scopeFromLocals, tryScopeFromLocals } from './scope.js';
|
|
32
32
|
export { actingScopeFromLocals, matchesActingOwner } from './acting-scope.js';
|
|
@@ -40,7 +40,7 @@ export type { FormActionConfig } from './action';
|
|
|
40
40
|
export { vibesLayoutLoad as vibesLayout, vibesLayoutAuth, vibesLayoutFeature } from './layout/load';
|
|
41
41
|
export type { VibesLayoutLoadOptions, FeatureGateOptions } from './layout/load';
|
|
42
42
|
export { createVibesHandle, createBasicVibesHandle, createVibesErrorHandler, createMaintenanceHandle, createAuthHandle, createAuthWrapperHandle, createActivityHandle, applySecurityHeaders, matchSecurityProfile, applySecurityProfile, enhanceUserContext, createPreferenceLoader, shouldSkipActivityLogging, isPublicRoute, isAssetRequest, serializeError, createCacheControlHandle, applyCacheControl, createCorsHandle } from './hooks';
|
|
43
|
-
export { createUserContextHandle, invalidateUserContext, createActiveProjectHandle, checkProjectAccessViaProjectsApi, invalidateActiveProjectAccess, readActiveProjectCookie, setActiveProjectCookie, ACTIVE_PROJECT_COOKIE_NAME, createActiveOrgHandle, readActiveOrgCookie, setActiveOrgCookie, ACTIVE_ORG_COOKIE_NAME, createOrgMembershipHandle, scopeFromLocals, tryScopeFromLocals, actingScopeFromLocals, matchesActingOwner, createAuthEnforcementHandle, createActiveUserGateHandle, createDemoAwareAuthEnforcementHandle, createDemoAwareActiveUserGateHandle, createDemoBannerHandle, createPermissionFetchHandle, invalidatePermissionCache } from './handles';
|
|
43
|
+
export { createUserContextHandle, invalidateUserContext, createActiveProjectHandle, checkProjectAccessViaProjectsApi, invalidateActiveProjectAccess, readActiveProjectCookie, setActiveProjectCookie, ACTIVE_PROJECT_COOKIE_NAME, createActiveOrgHandle, readActiveOrgCookie, setActiveOrgCookie, ACTIVE_ORG_COOKIE_NAME, verifiedMembershipOrgIds, createOrgMembershipHandle, scopeFromLocals, tryScopeFromLocals, actingScopeFromLocals, matchesActingOwner, createAuthEnforcementHandle, createActiveUserGateHandle, createDemoAwareAuthEnforcementHandle, createDemoAwareActiveUserGateHandle, createDemoBannerHandle, createPermissionFetchHandle, invalidatePermissionCache } from './handles';
|
|
44
44
|
export type { UserContextHandleOptions, AuthEnforcementOptions, ActiveUserGateOptions, ActiveUserStatus, PermissionFetchHandleOptions, VibesScope, ActingScope } from './handles';
|
|
45
45
|
export type { VibesHandleConfig, SecurityConfig, MaintenanceConfig, AuthConfig, ActivityConfig, ActivityLogEntry, ActivityLoggerFunction, CSPConfig, SecurityHeadersConfig, SecurityPattern, ContextLoaders, UserContextConfig, ErrorHandlerConfig, CacheControlOptions } from './hooks';
|
|
46
46
|
export type { VibesConfig, VibesHandler, VibesContext, AuthConfig as VibesAuthConfig, RateLimitConfig, CachingConfig, BillingConfig, ValidationConfig, MetadataConfig } from '../types';
|
package/dist/lib/server/index.js
CHANGED
|
@@ -44,7 +44,7 @@ export { vibesLayoutLoad as vibesLayout, vibesLayoutAuth, vibesLayoutFeature } f
|
|
|
44
44
|
// Hooks integration for SvelteKit
|
|
45
45
|
export { createVibesHandle, createBasicVibesHandle, createVibesErrorHandler, createMaintenanceHandle, createAuthHandle, createAuthWrapperHandle, createActivityHandle, applySecurityHeaders, matchSecurityProfile, applySecurityProfile, enhanceUserContext, createPreferenceLoader, shouldSkipActivityLogging, isPublicRoute, isAssetRequest, serializeError, createCacheControlHandle, applyCacheControl, createCorsHandle } from './hooks';
|
|
46
46
|
// Composable handles for the handle chain
|
|
47
|
-
export { createUserContextHandle, invalidateUserContext, createActiveProjectHandle, checkProjectAccessViaProjectsApi, invalidateActiveProjectAccess, readActiveProjectCookie, setActiveProjectCookie, ACTIVE_PROJECT_COOKIE_NAME, createActiveOrgHandle, readActiveOrgCookie, setActiveOrgCookie, ACTIVE_ORG_COOKIE_NAME, createOrgMembershipHandle, scopeFromLocals, tryScopeFromLocals, actingScopeFromLocals, matchesActingOwner, createAuthEnforcementHandle, createActiveUserGateHandle, createDemoAwareAuthEnforcementHandle, createDemoAwareActiveUserGateHandle, createDemoBannerHandle, createPermissionFetchHandle, invalidatePermissionCache } from './handles';
|
|
47
|
+
export { createUserContextHandle, invalidateUserContext, createActiveProjectHandle, checkProjectAccessViaProjectsApi, invalidateActiveProjectAccess, readActiveProjectCookie, setActiveProjectCookie, ACTIVE_PROJECT_COOKIE_NAME, createActiveOrgHandle, readActiveOrgCookie, setActiveOrgCookie, ACTIVE_ORG_COOKIE_NAME, verifiedMembershipOrgIds, createOrgMembershipHandle, scopeFromLocals, tryScopeFromLocals, actingScopeFromLocals, matchesActingOwner, createAuthEnforcementHandle, createActiveUserGateHandle, createDemoAwareAuthEnforcementHandle, createDemoAwareActiveUserGateHandle, createDemoBannerHandle, createPermissionFetchHandle, invalidatePermissionCache } from './handles';
|
|
48
48
|
// Helper functions
|
|
49
49
|
export {
|
|
50
50
|
// Authentication helpers
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibesdotdev/kit",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.4",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@codemirror/autocomplete": "^6.20.4",
|
|
6
6
|
"@codemirror/commands": "^6.11.1",
|
|
@@ -47,15 +47,15 @@
|
|
|
47
47
|
"tailwind-variants": "^3.3.1",
|
|
48
48
|
"tw-animate-css": "^1.4.0",
|
|
49
49
|
"vaul-svelte": "^1.0.0-next.7",
|
|
50
|
-
"@vibesdotdev/surface-sveltekit": "^1.0.0-rc.
|
|
50
|
+
"@vibesdotdev/surface-sveltekit": "^1.0.0-rc.4"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@humanspeak/svelte-markdown": "^1.9.5",
|
|
54
54
|
"@iconify/svelte": "^5.2.3",
|
|
55
55
|
"@sveltejs/kit": "^2.70.3",
|
|
56
|
-
"@vibesdotdev/config": "^1.0.0-rc.
|
|
57
|
-
"@vibesdotdev/infra-core": "^1.0.0-rc.
|
|
58
|
-
"@vibesdotdev/kernel": "^1.0.0-rc.
|
|
56
|
+
"@vibesdotdev/config": "^1.0.0-rc.4",
|
|
57
|
+
"@vibesdotdev/infra-core": "^1.0.0-rc.5",
|
|
58
|
+
"@vibesdotdev/kernel": "^1.0.0-rc.7",
|
|
59
59
|
"drizzle-orm": "^0.45.4",
|
|
60
60
|
"svelte": "^5.57.2",
|
|
61
61
|
"tailwindcss": "^4.3.3",
|
|
@@ -1363,10 +1363,10 @@
|
|
|
1363
1363
|
"ui-components",
|
|
1364
1364
|
"typescript"
|
|
1365
1365
|
],
|
|
1366
|
-
"gitHead": "
|
|
1366
|
+
"gitHead": "6bbec0948115ec8da30b8ca050834c1ce81678ad",
|
|
1367
1367
|
"_vibes_source": {
|
|
1368
1368
|
"repo": "ssh://git@git.vibes.dev/vibesdotdev/kit.git",
|
|
1369
|
-
"sha": "
|
|
1370
|
-
"workspaceDigest": "sha256:
|
|
1369
|
+
"sha": "6bbec0948115ec8da30b8ca050834c1ce81678ad",
|
|
1370
|
+
"workspaceDigest": "sha256:56faf7a330d6e35063c1d928c6f3afa4237c70bfa499b3be765e84e88e3b921f"
|
|
1371
1371
|
}
|
|
1372
1372
|
}
|