ast+topdown: add net.lookup_ip_addr built-in function (#3995)

Since the golang stdlib function doesn't do any caching, we add the result
to the BuiltinContext.Cache so it's cached, and consistent, within a single
policy evaluation.

There is no decision made here about using netgo or netcgo: we're following
suit wrt how golang expects you to do it: From my understanding, using the
OS means for DNS resolution is the preferred way: it gives you per-host
caching, and it allows the user to affect how DNS resolution works in many
ways.

This means the same logic that applies to all other places where we resolve
domain names into addresses (notably `http.send`) applies to this built-in,
too.

Also:

* workflow/pull_request: don't fail-fast for matrix jobs

Even if one platform fails it would be interesting to see what happens
on the others.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
This commit is contained in:
Stephan Renatus
2021-11-16 07:39:14 +01:00
committed by GitHub
parent 075344b850
commit 8a1aab376f
443 changed files with 41250 additions and 5095 deletions
+17
View File
@@ -2193,6 +2193,23 @@
"type": "function"
}
},
{
"name": "net.lookup_ip_addr",
"decl": {
"args": [
{
"type": "string"
}
],
"result": {
"of": {
"type": "string"
},
"type": "set"
},
"type": "function"
}
},
{
"name": "numbers.range",
"decl": {