falco
falco copied to clipboard
[BUG] Parser/Linter Include statement order resolution can be improved
In the following scenario Falco fails but Fastly succeeds:
# depenency1.vcl
sub foo {
set req.backend = httpbin_org;
}
# main.vcl
backend httpbin_org {
.connect_timeout = 1s;
.dynamic = true;
.port = "443";
.host = "httpbin.org";
.first_byte_timeout = 20s;
.max_connections = 500;
.between_bytes_timeout = 20s;
.share_key = "xei5lohleex3Joh5ie5uy7du";
.ssl = true;
.ssl_sni_hostname = "httpbin.org";
.ssl_cert_hostname = "httpbin.org";
.ssl_check_cert = always;
.min_tls_version = "1.2";
.max_tls_version = "1.2";
}
sub vcl_recv {
call foo;
}
This might be a harder change to resolve but I think the correct approach is instead of linting the VCL separately we should be combining them into a single vcl and then parse/lint that as one. I believe this is the behaviour that fastly would do.
I think we can go in DFS style parsing where when we see an include
statement we push it into the AST