aws-runtime-bridge 1.9.5 → 1.9.6

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.
Files changed (2) hide show
  1. package/dist/index.js +20 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -254,24 +254,32 @@ const app = express();
254
254
  // 中间件配置
255
255
  app.use(cors({
256
256
  origin(origin, callback) {
257
- if (!origin || allowedCorsOrigins.includes(origin)) {
257
+ // 允许无来源请求(非浏览器客户端、curl 等)
258
+ if (!origin) {
259
+ callback(null, true);
260
+ return;
261
+ }
262
+ // AWS_RUNTIME_CORS_ORIGINS=* 时放行所有来源
263
+ if (allowedCorsOrigins.includes("*")) {
264
+ callback(null, true);
265
+ return;
266
+ }
267
+ if (allowedCorsOrigins.includes(origin)) {
258
268
  callback(null, true);
259
269
  return;
260
270
  }
261
271
  // 允许 bridge 自身端口的来源(dashboard/登录页面同源请求)
262
- if (origin) {
263
- try {
264
- const url = new URL(origin);
265
- if ((url.hostname === "localhost" || url.hostname === "127.0.0.1") &&
266
- url.port === String(port)) {
267
- callback(null, true);
268
- return;
269
- }
270
- }
271
- catch {
272
- // URL 解析失败,继续拒绝
272
+ try {
273
+ const url = new URL(origin);
274
+ if ((url.hostname === "localhost" || url.hostname === "127.0.0.1") &&
275
+ url.port === String(port)) {
276
+ callback(null, true);
277
+ return;
273
278
  }
274
279
  }
280
+ catch {
281
+ // URL 解析失败,继续拒绝
282
+ }
275
283
  callback(new Error(`[runtime-bridge] CORS origin is not allowed: ${origin}`));
276
284
  },
277
285
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aws-runtime-bridge",
3
- "version": "1.9.5",
3
+ "version": "1.9.6",
4
4
  "description": "AgentsWorkStudio runtime bridge service for machine-level agent runtime integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",