Hi, I understand from other posts I’ve seen here that FQL is not lazily evaluated, and so injection is, for all intents and purposes, impossible.
I would like to see some way to directly override that in FQL, such as an EvalLambda
or some such, that we could use to pass internal values to a Lambda passed in as an argument.
My use case in particular is I would like to have some set of “query builder” UDFs that I can then create other, more restricted, UDFs out of. Those more restricted UDFs I can give permission to users to use, whereas those UDFs accepting Lambdas would not be available to them.
Query(
Lambda(
["match_set", "filter_lambda"],
Map(
Paginate(
Filter(
Var("match_set"),
Var("filter_lambda")
)
),
Lambda(
"refToFetch",
Get(Var("refToFetch"))
)
)
)
)
In my example above I would like to be able to pass in a filter_lambda
and have it evaluated as if it were directly written inside the Filter.
With EvalLambda a possible API could be:
EvalLambda(lambda, args)
thus making my above request possible with something like
Query(
Lambda(
["match_set", "filter_lambda"],
Map(
Paginate(
Filter(
Var("match_set"),
Lambda(
"ref",
EvalLambda(Var("filter_lambda"), Var("ref"))
)
)
),
Lambda(
"refToFetch",
Get(Var("refToFetch"))
)
)
)
)
It’d be even cooler if it could draw in the "ref"
implicitly from the surrounding Filter
.
Apologies if I’m missing something obvious here