builtins: Add AWS Sig v4 signing builtin. (#5376)

This commit adds initial support for AWS's SigV4 request signing system,
which will allow OPA's existing `http.send` builtin to be used to more
conveniently query cloud resources. It automates away most of the pain
around signing the request headers and body, and is designed to compose
with `http.send` directly.

Internally, this also refactors AWS SigV4 request signing, so that the
signing logic is shared between the builtin and the REST plugin for AWS.

Fixes: #3749

Signed-off-by: Philip Conrad <philipaconrad@gmail.com>
This commit is contained in:
Philip Conrad
2022-11-18 15:11:47 -05:00
committed by GitHub
parent 976bbec765
commit ed76301eb6
12 changed files with 843 additions and 145 deletions
+44
View File
@@ -3074,6 +3074,50 @@
"type": "function"
}
},
{
"name": "providers.aws.sign_req",
"decl": {
"args": [
{
"dynamic": {
"key": {
"type": "string"
},
"value": {
"type": "any"
}
},
"type": "object"
},
{
"dynamic": {
"key": {
"type": "string"
},
"value": {
"type": "any"
}
},
"type": "object"
},
{
"type": "number"
}
],
"result": {
"dynamic": {
"key": {
"type": "any"
},
"value": {
"type": "any"
}
},
"type": "object"
},
"type": "function"
}
},
{
"name": "rand.intn",
"decl": {