Skip to content

Need to defend against timing attacks #1

@joetrimble

Description

@joetrimble

First thank you for taking the time to write the article and put this repo together.

I noticed while reading through your example that currently no secure comparison is being used when comparing the signature passed by GitHub to the signature you have generated. You will likely want to incorporate something like Plug.Crypto.secure_compare/2 in your is_payload_signature_valid?/2 function to avoid the possibility of timing attacks.

Also, you may want to consider hex encoding your payload signature as that is what GitHub is doing. Maybe something like Base.encode16(case: :lower) and I believe the header from GitHub is X-Hub-Signature-256. The X-Hub-Signature uses sha1 instead of sha256.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions