Giter Site home page Giter Site logo

cyberark / conjur-action Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 733 KB

GitHub Action for secured CyberArk Conjur secret retrieval and import into Workflows

Home Page: https://github.com/cyberark

License: MIT License

Dockerfile 2.09% Shell 97.91%
conjur cyberark github-action secrets-management

conjur-action's People

Contributors

infamousjoeg avatar ismarc avatar itsbrugu avatar nirupma-verma avatar pradeepcyberark avatar quincycheng avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

cisolutions-nl

conjur-action's Issues

Conjur-Actions doesn't work when Conjur is behind a Cloudflare WAF (Accept-Encoding overridden)

Summary

When attempting to utilize Conjur actions against Conjur EE, accessible through Cloudflare WAF, we encounter an issue where we are unable to retrieve a base64 token.

Reproducible

  • Always
  • Sometimes
  • Non-Reproducible

Error in GitHub actions pipeline:

Malformed authorization token

Steps to Reproduce

In order to troubleshoot this issue we have created two tests:

  1. The first test is directly going to Conjur without any interference of a proxy
  2. The second test (and this is our main case) connecting to Conjur via the Cloudflare WAF.

We performed the test with the following code:

token=$(curl --request POST --data "$INPUT_API_KEY" "$INPUT_URL/authn/$INPUT_ACCOUNT/$hostId/authenticate" --header "Content-Type: application/x-www-form-urlencoded" --header "Accept-Encoding: base64")

echo $token

Output of test scenario one (directly to Conjur via LAN)

eyJwcm90ZWN0ZWQiOiJleUpoYkdjaU9pSmpiMjVxZFhJdWIzSm5MM05zYjNOcGJHOHZkaklpTENKcmFXUWlPaUl3TUdRd1l6TTJORFZoTkRZeVl6RTFaR1ppTnpka1lXVmlNR0UxTURoa01qRTBZVFpqWmprMFlURmpOVEV4WXpnNFpHSmtNVGt5TVRNMU5tRTFaVFl6SW4wPSIsInBheWxvYWQiOiJleUp6ZFdJaU9pSm9iM04wTDFaaGRXeDBMMkYxZEdodUwwTnZibXAxY2w5RFRrcFNYMEZrYldsdVgxQXZaR1ZzWldk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1C4PsqOxfJoY72U-xDr0gQp1HQ02I5WCAX7YzheQkG0z_b-H8XqJsDtuAv8k2BbmwBw80o6FP70BghRY6ku6DwHmkqklHzfTMpeaUEA8hNeSWbSwDR84iGU2MXY9b0AW4-JfL1UbUlwtOYKWCJERpRoQ72jYcOymPaIkLuH55PbKMiIHAbdrgOKJizxhwDERlymnsMW9LBEN9djjYAGt-X9fEGvg57hN3F948uAPYRMPRW30g0p2WncIeuZiR-Zw13wvn0fqk48mECIlkAGvh1uvHsj34gRHz7InPolo6uV"
}

As you can see the output (which is JSON) is not converted to base64. The reason of this is that Cloudflare consistently overrides the "Accept-Encoding: base64" header with "Accept-Encoding: gzip". Which means that the base64 request never arrives at the Conjur server.

Click here to see the documentation regarding this "feature".

Solution

In order to fix this issue the entrypoint.sh should check if the output that contains the token is base64, if not (then it is JSON) it should be encoded to base64.

Our temporary solution is converting the token to base64, since we always connect via the WAF this temporary solution is sufficient.

token=$(curl --request POST --data "$INPUT_API_KEY" "$INPUT_URL/authn/$INPUT_ACCOUNT/$hostId/authenticate" --header "Content-Type: application/x-www-form-urlencoded" --header "Accept-Encoding: base64" | base64 | tr -d '[:space:]')

Version/Tag number

Conjur EE: 13.0
Conur-Action: 2.05

Environment setup

Conjur is being accessed via the Cloudflare WAF

Consideration

We have also encountered this issue with the Red Hat Ansible Automation Platform integration. It seems that the header Accept-Encoding sometimes (always with the Cloudflare WAF) is overridden by proxies. Probably, instead of solving this issue in all scripts/applications/integrations, CyberArk might want to consider returning base64 as a default in the response, instead of the plain JSON.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.