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

Conversation

Projects
None yet
2 participants
@t-richards
Contributor

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

This comment has been minimized.

@philipmuir

philipmuir Dec 15, 2014

Contributor

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

This comment has been minimized.

Contributor

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

This comment has been minimized.

Contributor

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