Hi, in postman before the request is sent, you can...
# pact-broker
a
Hi, in postman before the request is sent, you can create a script like the below for encrypting your payload via key. Does the open source broker support such as thing? So i add my secret 'somewhere' in the broker and it will do the encrypting? Or can we inject codeblocks to extend functionality? The context for this question is for the webhook. So basically we want to encrypt our request payload in webhook payload. Thanks 🙂
Copy code
const payload = pm.request.body.raw;
const key = 'secret';
var hmacSha = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA1, key);
var hashBytes = hmacSha.update(payload).finalize();
var signature = CryptoJS.enc.Hex.stringify(hashBytes);
pm.request.headers.add({
    key: 'X-myapp-signature',
    value: signature,
    headerFormat: "RFC3986"
});
m
There is no feature for that, sorry.
what’s the need to encrypt it - what system are you planning on calling?
a
Hey Matt, thanks for the response. Basically the (security) policies of the company i work for, means i have to use the solution our cloud provider comes with in running pipelines with (verify) tests from our provider api's --> incoming webhooks. However this 'incoming webhook' from the cloud provider is reachable/possible to execute from every network/everywhere on the internet, which is obviously not wat we want. DDOS attacks and such. So to circumvent that you can use a 'key' with the incoming webhook, which kind of fulfills the role of authorization in this case. But this would mean this encryption part with the key would need to be done on a per request basis in the broker, which i now understand there is currently no functionality for.
👍 1
we are now thinking of having nginx behind the broker to encrypt the payload
m
Yeah, some form of middle ware or proxy could do the job I guess!