Skip to content

feat: accept RegExp values in Expression/thenElse for CORS options - #1944

Draft
IzaakGough wants to merge 2 commits into
masterfrom
@invertase/feat-accept-RegExp-values-in-Expression-for-cors-options
Draft

feat: accept RegExp values in Expression/thenElse for CORS options#1944
IzaakGough wants to merge 2 commits into
masterfrom
@invertase/feat-accept-RegExp-values-in-Expression-for-cors-options

Conversation

@IzaakGough

@IzaakGough IzaakGough commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Fixes #1943

relnote: none

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request extends the Expression type and related helper functions to support RegExp and Array<string | RegExp> types, enabling dynamic selection of CORS origins via ternary expressions. It also updates the cors option in HTTPS options to use the shared CorsOption type and adds comprehensive unit tests. However, a high-severity issue was identified in src/params/types.ts where a single RegExp (not wrapped in an array) falls through to the default else block in refOf, resulting in an unquoted string representation that is invalid in CEL. A suggestion has been provided to explicitly handle RegExp and wrap its string representation in JSON.stringify.

Comment thread src/params/types.ts
A single RegExp (not wrapped in an array) passed to thenElse fell
through to arg.toString(), producing an unquoted /pattern/ in the
generated CEL string, which is invalid and fails at deploy time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Params CompareExpression .thenElse does not support RegExp as value, therefore disallows the use of RegExp values for CORS options

2 participants