Git Product home page Git Product logo

http-hmac-php's People

Contributors

blkperl avatar charuag avatar cookieguru avatar cpliakas avatar eduardoweiland avatar gaitholabi avatar galphanet avatar itafroma avatar japerry avatar jeichorn avatar kevinhankens avatar mansinahar avatar mhouriet avatar miromichalicka avatar ndelrossi avatar peter279k avatar scrutinizer-auto-fixer avatar secretsayan avatar smatyas avatar steveedwardsacquia avatar svolpe43 avatar wadjeroudi avatar ynx avatar

Stargazers

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

Watchers

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

http-hmac-php's Issues

ResponseAuthenticator should not attempt to authenticate responses if it receives an authentication failure response from the server

Via typhonius/acquia-php-sdk-v2#1, ResponseAuthenticator will throw a MalformedRequest exception if it detects there is no X-Server-Authorization-HMAC-SHA256 header.

However, according to the spec, the header should be set if, and only if, the request could be authenticated (emphasis mine):

If the server authenticates the request successfully, it will add the following HTTP headers to the response (for all non-HEAD requests):

X-Server-Authorization-HMAC-SHA256: <HMACServerAuthorization>

ResponseAuthenticator should not throw an exception if the server response indicates the request could not be authenticated. We're probably safe to assume that this means a 401 response.

401 Signature not valid

I'm using the Guzzle handler on the request side and the Symfony firewall on the response side, everything seems to be configured as it should (the key is found, the headers are found, etc..) but I alway receive the "401 Signature not valid" response.

I also tried without the symfony intergration, doing the validation manually but the problem remain the same.

I believe either there is a bug or there is something missing in the documentation.

Please tell me what information you need to resolve this issue. Thanks !

PHP 8 compatibility

Hey, I tried to install this library on Symfony 5.2 with PHP 8

composer update
Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "5.2.*"
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires acquia/http-hmac-php ^5.0 -> satisfiable by acquia/http-hmac-php[5.0.0].
    - acquia/http-hmac-php 5.0.0 requires php ^7.2 -> your php version (8.0.2) does not satisfy that requirement.

By default it will install ^3.4 which in turn will later result in

In ClassExistenceResource.php line 74:

  Class "Symfony\Component\Security\Http\Firewall\ListenerInterface" not found while loading "Acquia\Hmac\Symfony\HmacAuthenticationListener".

Are there any plans on supporting PHP 8 any soon?

Thanks in advance!

Response::getBody->getContents() returns empty string

Hey,

In ResponseSigner.php the Response body stream in being consumed by signResponse() at line 60. Although explicit casting using __toString() will always rewind a stream before reading it, calling the getContents() method from StreamInterface will not. As a result, the middleware is breaking expected behavior, since Response::getBody()->getContents() will always return empty string after a POST.

I fixed it with a simple $response->getBody()->rewind() just after assigning $parts. I guess you can also use tell() and the seek() but I failed to find any real-life scenarios where it would make sense for a middleware to start reading the stream halfway through.

Do you want a pull request for this or is the fix trivial enough like this?

Cheers,

Matt

Deprecate and drop support for PHP 5.5

PHP 5.5 reached end of life at the end of July: we should stop supporting it, as it would avoid us having to maintain polyfills like in #21.

My recommendation is to deprecate it in the next version, 3.1.2, and then release an acquia/http-hmac-php 4.0 that removes the hash_equals() polyfill and pegs support to PHP 5.6 only.

Not compatible with drupal/core-recommended 10.2.2 or later

Describe the bug
I created a ticket at https://www.drupal.org/project/drupal/issues/3424183#comment-15464851

When trying to upgrade Drupal core to 10.2.2 or later with drupal/core-recommended installed, it fails.

drupal/core-recommended requires symfony/psr-http-message-bridge ~v6.4.0
acquia/http-hmac-php requires "symfony/psr-http-message-bridge": "^2.0",

Problem 1

  • Root composer.json requires drupal/core-recommended 10.2.3 -> satisfiable by drupal/core-recommended[10.2.3].
  • drupal/core-recommended 10.2.3 requires symfony/psr-http-message-bridge ~v6.4.0 -> found symfony/psr-http-message-bridge[v6.4.0-BETA1, ..., 6.4.x-dev] but these were not loaded, likely because it conflicts with another require.

Implement v2 of the HTTP HMAC Spec

Version 1 is effectively deprecated, v2 is the latest and greatest. We should implement v2 of the spec in this library.

This will likely be a massive refactoring, so this will result in a 3.0 version of this library. We can therefore drop support for the V1 version of the algorithm, as if you are using V1 then you should stick with the V2 version of this library.

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.