pcibraro / hawknet

Hawk protocol implementation for .NET
MIT License
114 stars 35 forks source link

timestampskew issue #6

Closed TeigeJDavidson closed 10 years ago

TeigeJDavidson commented 11 years ago

Please check the Timestamp validation in the Checkstamp check

in the GetAuthorizationHeader why divide by 1000, since the value is supposed to be seconds?

    var normalizedTs = (ConvertToUnixTimestamp((ts.HasValue)
            ? ts.Value : DateTime.UtcNow)).ToString(); //removed / 1000

this causes issues in the CheckTimeStamp

    private static bool CheckTimestamp(string ts, int timestampSkewSec)
    {
        double parsedTs;
        if (double.TryParse(ts, out parsedTs))
        {
            var now = ConvertToUnixTimestamp(DateTime.Now);

            // Check timestamp staleness
            if (Math.Abs(parsedTs - now) > timestampSkewSec) //* 1000 
            {
                return false;
            }
            else
            {