You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(cors): defer parameter resolution in https callables and requests
### Description
Fixes an issue where passing a parameterized CORS origin (`Expression`) to HTTPS functions attempts to evaluate the parameter at global module definition time rather than request runtime.
This updates `resolveCorsOrigin` to execute per-request, gracefully catching missing environment variables or empty parameters and disabling CORS (`origin: false`) as a secure fallback.
Additionally, this updates V1 `https.onRequest` to accept an options object (`HttpsOptions`) supporting custom `cors` configuration, aligning with V2.
### Scenarios Tested
- Added unit tests in `spec/common/providers/https.spec.ts` verifying `resolveCorsOrigin` successfully extracts runtime values from `StringParam` and `ListParam` Expressions, and safely defaults to `false` when params are missing or evaluate to empty lists/strings.
- Added unit tests in `spec/v1/providers/https.spec.ts` verifying V1 `onRequest` correctly enforces custom CORS options and does not crash when passed an Expression.
- Added unit tests in `spec/v2/providers/https.spec.ts` verifying passing Expressions to `onRequest` and `onCall` CORS options does not cause definition-time crashes.
- Ran the full `npm test` suite to confirm zero regressions.
### Sample Commands
`npm test`
0 commit comments