You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SignatureProvider.verifyHeader accepts future timestamps: the tolerance check is one-sided #1698
SignatureProvider.verifyHeader (src/common/crypto/signature-provider.ts) checks the timestamp in one direction only:
if(parseInt(timestamp,10)<Date.now()-tolerance){thrownewSignatureVerificationException('Timestamp outside the tolerance zone');}
Effect
An old timestamp is rejected. A timestamp far in the future is accepted, and the SDK gives no signal. A receiver whose clock runs behind loses replay protection in that direction, and a captured future-dated header stays valid until real time catches up with it. The message "outside the tolerance zone" reads as a two-sided check, which it is not.
Request
Compare the absolute difference against the tolerance so that both too-old and too-new timestamps are rejected:
if(Math.abs(Date.now()-parseInt(timestamp,10))>tolerance){thrownewSignatureVerificationException('Timestamp outside the tolerance zone');}
Please also reject a non-numeric timestamp (parseInt returns NaN, and every comparison with NaN is false, so a malformed t= passes the check).
The defaults are 180000 ms for constructEvent and 30000 ms for constructAction. Neither the unit nor the default appears in the public types or the docs. Please state both.
Activity