Giter Site home page Giter Site logo

Comments (4)

paragonie-scott avatar paragonie-scott commented on June 15, 2024

What is the value of protected $hmac_ip?

from anti-csrf.

ncou avatar ncou commented on June 15, 2024

Hi,

Same thing here. the token set in session is different from the value in the hidden text field.
The _CSRF_INDEX is the same in session and in the hidden text field.

The validateRequest return "TRUE" even if the value in the field is different from the value session.

$hmac_ip is TRUE

from anti-csrf.

ncou avatar ncou commented on June 15, 2024

After a quick debug, it's because hmac_ip is TRUE.

If set to false, the token value in the hidden field is the same than in the session.

from anti-csrf.

paragonie-scott avatar paragonie-scott commented on June 15, 2024

Yep. What this feature does is, instead of just placing the CSRF token in the form output, it outputs hash_hmac('sha256', $IPaddress, $csrfToken).

anti-csrf/src/AntiCSRF.php

Lines 162 to 174 in 606274f

if ($this->hmac_ip !== false) {
// Use HMAC to only allow this particular IP to send this request
$token = $this->encode(
\hash_hmac(
$this->hashAlgo,
isset($this->server['REMOTE_ADDR'])
? $this->server['REMOTE_ADDR']
: '127.0.0.1',
\base64_decode($token),
true
)
);
}

I'm tagging this as a documentation bug.

from anti-csrf.

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.