@@ -141,6 +141,19 @@ describe("DKIM Verifier [unittest]", function () {
141
141
expect ( res . signatures [ 0 ] ?. result ) . to . be . equal ( "SUCCESS" ) ;
142
142
expect ( res . signatures [ 0 ] ?. warnings ) . to . be . empty ;
143
143
} ) ;
144
+ it ( "Received time is after Signature Timestamp" , async function ( ) {
145
+ const res = await verifyEmlFile ( "dkim/time-received_after_creation.eml" ) ;
146
+ expect ( res . signatures . length ) . to . be . equal ( 1 ) ;
147
+ expect ( res . signatures [ 0 ] ?. result ) . to . be . equal ( "SUCCESS" ) ;
148
+ expect ( res . signatures [ 0 ] ?. warnings ) . to . be . empty ;
149
+ } ) ;
150
+ it ( "Received time is briefly before Signature Timestamp" , async function ( ) {
151
+ // I.e. a small clock difference between sender and receiver should not result in an error
152
+ const res = await verifyEmlFile ( "dkim/time-received_briefly_before_creation.eml" ) ;
153
+ expect ( res . signatures . length ) . to . be . equal ( 1 ) ;
154
+ expect ( res . signatures [ 0 ] ?. result ) . to . be . equal ( "SUCCESS" ) ;
155
+ expect ( res . signatures [ 0 ] ?. warnings ) . to . be . empty ;
156
+ } ) ;
144
157
} ) ;
145
158
describe ( "Syntax errors" , function ( ) {
146
159
it ( "Missing v-tag in signature" , async function ( ) {
@@ -250,6 +263,13 @@ describe("DKIM Verifier [unittest]", function () {
250
263
expect ( res . signatures [ 0 ] ?. warnings ) . to . be . an ( 'array' ) .
251
264
that . deep . includes ( { name : "DKIM_SIGWARNING_FROM_NOT_IN_SDID" } ) ;
252
265
} ) ;
266
+ it ( "Received time is before Signature Timestamp" , async function ( ) {
267
+ const res = await verifyEmlFile ( "dkim/time-received_long_before_creation.eml" ) ;
268
+ expect ( res . signatures . length ) . to . be . equal ( 1 ) ;
269
+ expect ( res . signatures [ 0 ] ?. result ) . to . be . equal ( "SUCCESS" ) ;
270
+ expect ( res . signatures [ 0 ] ?. warnings ) . to . be . an ( 'array' ) .
271
+ that . deep . includes ( { name : "DKIM_SIGWARNING_FUTURE" } ) ;
272
+ } ) ;
253
273
} ) ;
254
274
describe ( "Detect and prevent possible attacks" , function ( ) {
255
275
describe ( "Additional unsigned header was added" , function ( ) {
0 commit comments