Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] set statement right side expression evaluation #268

Open
3 tasks done
richardmarshall opened this issue Feb 28, 2024 · 1 comment
Open
3 tasks done

[BUG] set statement right side expression evaluation #268

richardmarshall opened this issue Feb 28, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@richardmarshall
Copy link
Collaborator

Please fill all required sections

Kind of proposals

required
You can turn on multiple checkboxes.

  • [] Parser
  • Linter
  • Simulator
  • Testing

Describe the problem

Both the interpreter and linter are evaluating the right side of a set statement before performing type checking. In some cases this is accepting expressions that Fastly will reject.

For example assigning a conditional expression to a string variable is not valid but passes the type checking because the resulting bool value can be coerced to a string during assignment.

VCL code that cause the problem / reproduceable

The following VCL passes linting and will not cause an error in the interpreter.

set req.http.foo = (req.http.bar == "baz");

Expected behavior

Linter / interpreter should report an error.

Fiddle showing Fastly error for this case:
https://fiddle.fastly.dev/fiddle/b05aaad8

@richardmarshall richardmarshall added the bug Something isn't working label Feb 28, 2024
@ysugimoto
Copy link
Owner

I will tackle to solve this issue.

@ysugimoto ysugimoto self-assigned this Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants