volnix / csrf Goto Github PK
View Code? Open in Web Editor NEWCSRF protection library that compares provided token to session token to ensure request validity
License: MIT License
CSRF protection library that compares provided token to session token to ensure request validity
License: MIT License
Can we please have support for php 5.3? AFAIK it's only 1 edit :)
When a request is submitted and validated the same token is used for new requests.
I've changed line 72 which was originally only returning a boolean and I'm generating a new token if the original one is consumed:
if(static::compare($request_data[$token_name], static::getToken($token_name))){
static::generateToken($token_name);
return true;
} else {
return false;
}
You readme.md has a function in it that doesn't exist
See the changes in pull request #7
Hi,
I just want to advice that this code (README.md):
<form action="index.php" method="post">
<?= \Volnix\CSRF\CSRF::getAsHiddenInput('custom_token_name') ?>
<input type="text" name="action" placeholder="Enter an action."/>
<input type="submit" value="Submit" name="sub"/>
</form>
is invalid because the method getAsHiddenInput()
doesn't exist.
The real name of the method is getHiddenInputString()
When a request is send in ajax, the token are regenerate.
The token in form are invalid because the page are not reload.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.