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

perf: js plugin should start from now and work out to max clock skew #1

Open
asoorm opened this issue Oct 1, 2018 · 0 comments
Open

Comments

@asoorm
Copy link
Owner

asoorm commented Oct 1, 2018

  for (var i = now - ALLOWED_CLOCK_SKEW; i <= now + ALLOWED_CLOCK_SKEW; i ++) {

    var raw = token + SHARED_SECRET + i;

    var shaObj = new jsSHA("SHA-256", "TEXT");
    shaObj.update(raw);
    var hash = shaObj.getHash("HEX");

    if (hash === signature) {
      return preBodyToHeaders.ReturnData(req, sess.meta_data);
    }
  }

Current implementation checks from now - ALLOWED_CLOCK_SKEW to now + ALLOWED_CLOCK_SKEW.

More appropriate would be to check from now, and work out to avoid needless hash checking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant