Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signature verification #4

Merged
merged 3 commits into from Dec 16, 2014
Merged

Signature verification #4

merged 3 commits into from Dec 16, 2014

Conversation

@t-richards
Copy link
Contributor

@t-richards t-richards commented Dec 12, 2014

This fixes a security flaw in the parse_signed_request function. I'm not the only one to encounter issues with this code - see http://stackoverflow.com/questions/24463410/bigcommerce-fail-to-verify-the-load-callbacks

if (time_strcmp($sig, $expected_sig)) {
error_log('Bad Signed JSON signature!');
$expectedSignature = hash_hmac('sha256', $jsonStr, clientSecret(), $raw = false);
if (!hash_equals($expectedSignature, $signature)) {
Copy link
Contributor

@philipmuir philipmuir Dec 15, 2014

hash_equals only exists in php 5.6+
We should note that in the README or pull in a compatibility lib (t-richards/hash_equals looks good)

@philipmuir
Copy link
Contributor

@philipmuir philipmuir commented Dec 15, 2014

Thanks for this.

The example ruby/php/python apps and server side implementation in our oauth server all had different authors and very different level of scrutinization/code review :(

@t-richards
Copy link
Contributor Author

@t-richards t-richards commented Dec 16, 2014

t-richards/hash_equals is really a fork of realityking/hash_equals that I don't intend to keep around for too much longer. I've added the original to the composer deps.

philipmuir added a commit that referenced this issue Dec 16, 2014
@philipmuir philipmuir merged commit 500fd80 into bigcommerce:master Dec 16, 2014
@t-richards t-richards deleted the signature-verification branch Dec 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants