streamby-core 0.28.0 → 0.28.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.
|
@@ -298,12 +298,11 @@ function exportRouter(config) {
|
|
|
298
298
|
const origin = req.headers.origin;
|
|
299
299
|
let effectiveAllowedOrigins = exportMetadata.allowedOrigin;
|
|
300
300
|
const projectOrigins = project.allowedOrigin;
|
|
301
|
-
// If export's allowedOrigin is ['*'] or
|
|
302
|
-
if (!effectiveAllowedOrigins || (effectiveAllowedOrigins.length === 1 && effectiveAllowedOrigins[0] === '*')) {
|
|
301
|
+
// If export's allowedOrigin is empty, ['*'], or not set, it inherits from the project.
|
|
302
|
+
if (!effectiveAllowedOrigins || effectiveAllowedOrigins.length === 0 || (effectiveAllowedOrigins.length === 1 && effectiveAllowedOrigins[0] === '*')) {
|
|
303
303
|
effectiveAllowedOrigins = projectOrigins;
|
|
304
304
|
}
|
|
305
305
|
else {
|
|
306
|
-
// If the export has its own list, ensure it's a subset of the project's list (if project is not public).
|
|
307
306
|
if (projectOrigins && !projectOrigins.includes('*')) {
|
|
308
307
|
const isSubset = effectiveAllowedOrigins.every((o) => projectOrigins.includes(o));
|
|
309
308
|
if (!isSubset) {
|
|
@@ -329,11 +328,9 @@ function exportRouter(config) {
|
|
|
329
328
|
}
|
|
330
329
|
}
|
|
331
330
|
if (!devModeAllowed) {
|
|
332
|
-
// If there's no origin header, deny access unless the effective scope is public.
|
|
333
331
|
if (!origin && !(effectiveAllowedOrigins && effectiveAllowedOrigins.includes('*'))) {
|
|
334
332
|
return res.status(403).json({ message: 'Origin header required' });
|
|
335
333
|
}
|
|
336
|
-
// Check for public access ('*') or if the request's origin is in the effective list.
|
|
337
334
|
const isAllowed = effectiveAllowedOrigins && (effectiveAllowedOrigins.includes('*') || (origin && effectiveAllowedOrigins.includes(origin)));
|
|
338
335
|
if (!isAllowed) {
|
|
339
336
|
return res.status(403).json({ message: 'Unauthorized' });
|