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 3 commits into from Dec 16, 2014


None yet
2 participants

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

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)) {

This comment has been minimized.


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)


This comment has been minimized.


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 :(


This comment has been minimized.


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 pull request Dec 16, 2014

@philipmuir philipmuir merged commit 500fd80 into bigcommerce:master Dec 16, 2014

@t-richards t-richards deleted the t-richards:signature-verification branch Dec 16, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment