@portel/photon 1.34.1 → 1.34.2

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.
@@ -27,7 +27,7 @@ import { getDefaultContext } from '../context.js';
27
27
  import { EnvStore, resolvePhotonNamespace } from '../context-store.js';
28
28
  import { createLogger } from '../shared/logger.js';
29
29
  import { getErrorMessage } from '../shared/error-handler.js';
30
- import { timingSafeEqual, readBody, SimpleRateLimiter, ipInAllowlist, parseAllowlistEnv, } from '../shared/security.js';
30
+ import { timingSafeEqual, readBody, SimpleRateLimiter, ipInAllowlist, parseAllowlistEnv, getCorsOrigin, } from '../shared/security.js';
31
31
  import { audit } from '../shared/audit.js';
32
32
  import { recordExecution, previewResult, readExecutionHistory, sweepAllBases as sweepExecutionHistoryBases, } from './execution-history.js';
33
33
  import { WorkerManager } from './worker-manager.js';
@@ -1978,7 +1978,9 @@ function startWebhookServer(port) {
1978
1978
  return;
1979
1979
  webhookServer = http.createServer((req, res) => {
1980
1980
  void (async () => {
1981
- res.setHeader('Access-Control-Allow-Origin', '*');
1981
+ const corsOrigin = getCorsOrigin(req);
1982
+ if (corsOrigin)
1983
+ res.setHeader('Access-Control-Allow-Origin', corsOrigin);
1982
1984
  res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
1983
1985
  res.setHeader('Access-Control-Allow-Headers', 'Content-Type, X-Webhook-Secret, X-Photon-Name');
1984
1986
  if (req.method === 'OPTIONS') {