Giter Site home page Giter Site logo

Comments (5)

ashutosh-narkar avatar ashutosh-narkar commented on July 1, 2024

@c2zwdjnlcg is this something you can look into? @mbamber if you'd like to submit a fix, feel free to do so. Thanks.

from opa.

mbamber avatar mbamber commented on July 1, 2024

If I knew how to fix it, I would have already submitted a PR ๐Ÿ˜›

I've spent the last few hours trying to workout how all the tests etc work but I must admit I'm somewhat floundering. If you can point me in the direction of how to debug the tests, that would certainly help.

from opa.

mbamber avatar mbamber commented on July 1, 2024

I did manage to discover the following though:

Given the following opa test which uses the same data from test/cases/testdata/providers-aws/aws-sign_req.yaml

test_headers if {
    req := {"method": "get", "url": "http://example.com", "headers": {"foo": "bar"}}
    expected := {
      "headers": {
        "Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=foo;host;x-amz-content-sha256;x-amz-date,Signature=8f1dc7c9b9978356a0d0989fd26a95307f4f8a4aa264d8220647b7097d839952",
        "host": "example.com",
        "x-amz-content-sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
        "x-amz-date": "20151228T140825Z",
        "foo": "bar"
      },
      "method": "get",
      "url": "http://example.com"
    }
    aws_config := {
      "aws_access_key": "MYAWSACCESSKEYGOESHERE",
      "aws_secret_access_key": "MYAWSSECRETACCESSKEYGOESHERE",
      "aws_service": "s3",
      "aws_region": "us-east-1",
    }
    r := providers.aws.sign_req(req, aws_config, 1451311705000000000)
    print(r)
    print(expected)
    r == expected
}

... I get the following output:

[redacted].test_headers: FAIL (447.645ยตs)

  {"headers": {"Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=foo;host;x-amz-content-sha256;x-amz-date,Signature=8f1dc7c9b9978356a0d0989fd26a95307f4f8a4aa264d8220647b7097d839952", "host": "example.com", "x-amz-content-sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x-amz-date": "20151228T140825Z"}, "method": "get", "url": "http://example.com"}
  {"headers": {"Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=foo;host;x-amz-content-sha256;x-amz-date,Signature=8f1dc7c9b9978356a0d0989fd26a95307f4f8a4aa264d8220647b7097d839952", "foo": "bar", "host": "example.com", "x-amz-content-sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "x-amz-date": "20151228T140825Z"}, "method": "get", "url": "http://example.com"}

which I think confirms my suspicion that this is a bug (either that or I'm misunderstanding the use of this builtin)

from opa.

c2zwdjnlcg avatar c2zwdjnlcg commented on July 1, 2024

I can't reproduce, you sure you have the right version of the binary? what's the full output of opa version

from opa.

mbamber avatar mbamber commented on July 1, 2024

You're absolutely right, sorry for wasting your time @c2zwdjnlcg

We were using a out of date version in the tests and once upgraded we can confirm that headers are not dropped

from opa.

Related Issues (20)

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.