forked from alexedwards/scs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
session.go
852 lines (739 loc) · 21.1 KB
/
session.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
package scs
import (
"bytes"
"crypto/rand"
"encoding/base64"
"encoding/gob"
"encoding/json"
"errors"
"fmt"
"net/http"
"sort"
"strconv"
"strings"
"sync"
"time"
)
// sessionName is a custom type for the request context key.
type sessionName string
// ErrTypeAssertionFailed is returned by operations on session data where the
// received value could not be type asserted or converted into the required type.
var ErrTypeAssertionFailed = errors.New("type assertion failed")
// Session contains data for the current session.
type Session struct {
token string
data map[string]interface{}
deadline time.Time
store Store
opts *options
loadErr error
mu sync.Mutex
}
// cookie wraps http.Cookie, adding SameSite support
type cookie struct {
std *http.Cookie // "stdlib cookie"
sameSite string
}
func (c *cookie) String() string {
v := c.std.String()
if c.sameSite != "" {
v = v + "; SameSite=" + c.sameSite
}
return v
}
func newSession(store Store, opts *options) *Session {
return &Session{
data: make(map[string]interface{}),
deadline: time.Now().Add(opts.lifetime),
store: store,
opts: opts,
}
}
func load(r *http.Request, store Store, opts *options) *Session {
// Check to see if there is an already loaded session in the request context.
val := r.Context().Value(sessionName(opts.name))
if val != nil {
s, ok := val.(*Session)
if !ok {
return &Session{loadErr: fmt.Errorf("scs: can not assert %T to *Session", val)}
}
return s
}
cookie, err := r.Cookie(opts.name)
if err == http.ErrNoCookie {
return newSession(store, opts)
} else if err != nil {
return &Session{loadErr: err}
}
if cookie.Value == "" {
return newSession(store, opts)
}
token := cookie.Value
j, found, err := store.Find(token)
if err != nil {
return &Session{loadErr: err}
}
if found == false {
return newSession(store, opts)
}
data, deadline, err := decodeFromJSON(j)
if err != nil {
return &Session{loadErr: err}
}
s := &Session{
token: token,
data: data,
deadline: deadline,
store: store,
opts: opts,
}
return s
}
func (s *Session) write(w http.ResponseWriter) error {
s.mu.Lock()
defer s.mu.Unlock()
j, err := encodeToJSON(s.data, s.deadline)
if err != nil {
return err
}
expiry := s.deadline
if s.opts.idleTimeout > 0 {
ie := time.Now().Add(s.opts.idleTimeout)
if ie.Before(expiry) {
expiry = ie
}
}
if ce, ok := s.store.(cookieStore); ok {
s.token, err = ce.MakeToken(j, expiry)
if err != nil {
return err
}
} else {
if s.token == "" {
s.token, err = generateToken()
if err != nil {
return err
}
}
err = s.store.Save(s.token, j, expiry)
if err != nil {
return err
}
}
cookie := &cookie{
std: &http.Cookie{
Name: s.opts.name,
Value: s.token,
Path: s.opts.path,
Domain: s.opts.domain,
Secure: s.opts.secure,
HttpOnly: s.opts.httpOnly,
},
sameSite: s.opts.sameSite,
}
if s.opts.persist == true {
// Round up expiry time to the nearest second.
cookie.std.Expires = time.Unix(expiry.Unix()+1, 0)
cookie.std.MaxAge = int(expiry.Sub(time.Now()).Seconds() + 1)
}
// Overwrite any existing cookie header for the session...
var set bool
for i, h := range w.Header()["Set-Cookie"] {
if strings.HasPrefix(h, fmt.Sprintf("%s=", s.opts.name)) {
w.Header()["Set-Cookie"][i] = cookie.String()
set = true
break
}
}
// Or set a new one if necessary.
if !set {
w.Header().Add("Set-Cookie", cookie.String())
}
return nil
}
// Token returns the token value that represents given session data.
// NOTE: The method returns the empty string if session hasn't yet been written to the store.
// If you're using the CookieStore this token will change each time the session is modified.
func (s *Session) Token() string {
return s.token
}
// GetString returns the string value for a given key from the session data. The
// zero value for a string ("") is returned if the key does not exist. An ErrTypeAssertionFailed
// error is returned if the value could not be type asserted or converted to a
// string.
func (s *Session) GetString(key string) (string, error) {
v, exists, err := s.get(key)
if err != nil {
return "", err
}
if exists == false {
return "", nil
}
str, ok := v.(string)
if ok == false {
return "", ErrTypeAssertionFailed
}
return str, nil
}
// PutString adds a string value and corresponding key to the the session data.
// Any existing value for the key will be replaced.
func (s *Session) PutString(w http.ResponseWriter, key string, val string) error {
return s.put(w, key, val)
}
// PopString removes the string value for a given key from the session data
// and returns it. The zero value for a string ("") is returned if the key does
// not exist. An ErrTypeAssertionFailed error is returned if the value could not
// be type asserted to a string.
func (s *Session) PopString(w http.ResponseWriter, key string) (string, error) {
v, exists, err := s.pop(w, key)
if err != nil {
return "", err
}
if exists == false {
return "", nil
}
str, ok := v.(string)
if ok == false {
return "", ErrTypeAssertionFailed
}
return str, nil
}
// GetBool returns the bool value for a given key from the session data. The
// zero value for a bool (false) is returned if the key does not exist. An ErrTypeAssertionFailed
// error is returned if the value could not be type asserted to a bool.
func (s *Session) GetBool(key string) (bool, error) {
v, exists, err := s.get(key)
if err != nil {
return false, err
}
if exists == false {
return false, nil
}
b, ok := v.(bool)
if ok == false {
return false, ErrTypeAssertionFailed
}
return b, nil
}
// PutBool adds a bool value and corresponding key to the session data. Any existing
// value for the key will be replaced.
func (s *Session) PutBool(w http.ResponseWriter, key string, val bool) error {
return s.put(w, key, val)
}
// PopBool removes the bool value for a given key from the session data and returns
// it. The zero value for a bool (false) is returned if the key does not exist.
// An ErrTypeAssertionFailed error is returned if the value could not be type
// asserted to a bool.
func (s *Session) PopBool(w http.ResponseWriter, key string) (bool, error) {
v, exists, err := s.pop(w, key)
if err != nil {
return false, err
}
if exists == false {
return false, nil
}
b, ok := v.(bool)
if ok == false {
return false, ErrTypeAssertionFailed
}
return b, nil
}
// GetInt returns the int value for a given key from the session data. The zero
// value for an int (0) is returned if the key does not exist. An ErrTypeAssertionFailed
// error is returned if the value could not be type asserted or converted to a int.
func (s *Session) GetInt(key string) (int, error) {
v, exists, err := s.get(key)
if err != nil {
return 0, err
}
if exists == false {
return 0, nil
}
switch v := v.(type) {
case int:
return v, nil
case json.Number:
return strconv.Atoi(v.String())
}
return 0, ErrTypeAssertionFailed
}
// PutInt adds an int value and corresponding key to the session data. Any existing
// value for the key will be replaced.
func (s *Session) PutInt(w http.ResponseWriter, key string, val int) error {
return s.put(w, key, val)
}
// PopInt removes the int value for a given key from the session data and returns
// it. The zero value for an int (0) is returned if the key does not exist. An
// ErrTypeAssertionFailed error is returned if the value could not be type asserted
// or converted to a int.
func (s *Session) PopInt(w http.ResponseWriter, key string) (int, error) {
v, exists, err := s.pop(w, key)
if err != nil {
return 0, err
}
if exists == false {
return 0, nil
}
switch v := v.(type) {
case int:
return v, nil
case json.Number:
return strconv.Atoi(v.String())
}
return 0, ErrTypeAssertionFailed
}
// GetInt64 returns the int64 value for a given key from the session data. The
// zero value for an int (0) is returned if the key does not exist. An ErrTypeAssertionFailed
// error is returned if the value could not be type asserted or converted to a int64.
func (s *Session) GetInt64(key string) (int64, error) {
v, exists, err := s.get(key)
if err != nil {
return 0, err
}
if exists == false {
return 0, nil
}
switch v := v.(type) {
case int64:
return v, nil
case json.Number:
return v.Int64()
}
return 0, ErrTypeAssertionFailed
}
// PutInt64 adds an int64 value and corresponding key to the session data. Any existing
// value for the key will be replaced.
func (s *Session) PutInt64(w http.ResponseWriter, key string, val int64) error {
return s.put(w, key, val)
}
// PopInt64 remvoes the int64 value for a given key from the session data
// and returns it. The zero value for an int (0) is returned if the key does not
// exist. An ErrTypeAssertionFailed error is returned if the value could not be
// type asserted or converted to a int64.
func (s *Session) PopInt64(w http.ResponseWriter, key string) (int64, error) {
v, exists, err := s.pop(w, key)
if err != nil {
return 0, err
}
if exists == false {
return 0, nil
}
switch v := v.(type) {
case int64:
return v, nil
case json.Number:
return v.Int64()
}
return 0, ErrTypeAssertionFailed
}
// GetFloat returns the float64 value for a given key from the session data. The
// zero value for an float (0) is returned if the key does not exist. An ErrTypeAssertionFailed
// error is returned if the value could not be type asserted or converted to a
// float64.
func (s *Session) GetFloat(key string) (float64, error) {
v, exists, err := s.get(key)
if err != nil {
return 0, err
}
if exists == false {
return 0, nil
}
switch v := v.(type) {
case float64:
return v, nil
case json.Number:
return v.Float64()
}
return 0, ErrTypeAssertionFailed
}
// PutFloat adds an float64 value and corresponding key to the session data. Any
// existing value for the key will be replaced.
func (s *Session) PutFloat(w http.ResponseWriter, key string, val float64) error {
return s.put(w, key, val)
}
// PopFloat removes the float64 value for a given key from the session data
// and returns it. The zero value for an float (0) is returned if the key does
// not exist. An ErrTypeAssertionFailed error is returned if the value could not
// be type asserted or converted to a float64.
func (s *Session) PopFloat(w http.ResponseWriter, key string) (float64, error) {
v, exists, err := s.pop(w, key)
if err != nil {
return 0, err
}
if exists == false {
return 0, nil
}
switch v := v.(type) {
case float64:
return v, nil
case json.Number:
return v.Float64()
}
return 0, ErrTypeAssertionFailed
}
// GetTime returns the time.Time value for a given key from the session data. The
// zero value for a time.Time object is returned if the key does not exist (this
// can be checked for with the time.IsZero method). An ErrTypeAssertionFailed
// error is returned if the value could not be type asserted or converted to a
// time.Time.
func (s *Session) GetTime(key string) (time.Time, error) {
v, exists, err := s.get(key)
if err != nil {
return time.Time{}, err
}
if exists == false {
return time.Time{}, nil
}
switch v := v.(type) {
case time.Time:
return v, nil
case string:
return time.Parse(time.RFC3339, v)
}
return time.Time{}, ErrTypeAssertionFailed
}
// PutTime adds an time.Time value and corresponding key to the session data. Any
// existing value for the key will be replaced.
func (s *Session) PutTime(w http.ResponseWriter, key string, val time.Time) error {
return s.put(w, key, val)
}
// PopTime removes the time.Time value for a given key from the session data
// and returns it. The zero value for a time.Time object is returned if the key
// does not exist (this can be checked for with the time.IsZero method). An ErrTypeAssertionFailed
// error is returned if the value could not be type asserted or converted to a
// time.Time.
func (s *Session) PopTime(w http.ResponseWriter, key string) (time.Time, error) {
v, exists, err := s.pop(w, key)
if err != nil {
return time.Time{}, err
}
if exists == false {
return time.Time{}, nil
}
switch v := v.(type) {
case time.Time:
return v, nil
case string:
return time.Parse(time.RFC3339, v)
}
return time.Time{}, ErrTypeAssertionFailed
}
// GetBytes returns the byte slice ([]byte) value for a given key from the session
// data. The zero value for a slice (nil) is returned if the key does not exist.
// An ErrTypeAssertionFailed error is returned if the value could not be type
// asserted or converted to []byte.
func (s *Session) GetBytes(key string) ([]byte, error) {
v, exists, err := s.get(key)
if err != nil {
return nil, err
}
if exists == false {
return nil, nil
}
switch v := v.(type) {
case []byte:
return v, nil
case string:
return base64.StdEncoding.DecodeString(v)
}
return nil, ErrTypeAssertionFailed
}
// PutBytes adds a byte slice ([]byte) value and corresponding key to the the
// session data. Any existing value for the key will be replaced.
func (s *Session) PutBytes(w http.ResponseWriter, key string, val []byte) error {
if val == nil {
return errors.New("value must not be nil")
}
return s.put(w, key, val)
}
// PopBytes removes the byte slice ([]byte) value for a given key from the session
// data and returns it. The zero value for a slice (nil) is returned if the key
// does not exist. An ErrTypeAssertionFailed error is returned if the value could
// not be type asserted or converted to a []byte.
func (s *Session) PopBytes(w http.ResponseWriter, key string) ([]byte, error) {
v, exists, err := s.pop(w, key)
if err != nil {
return nil, err
}
if exists == false {
return nil, nil
}
switch v := v.(type) {
case []byte:
return v, nil
case string:
return base64.StdEncoding.DecodeString(v)
}
return nil, ErrTypeAssertionFailed
}
// GetObject reads the data for a given session key into an arbitrary object
// (represented by the dst parameter). It should only be used to retrieve custom
// data types that have been stored using PutObject. The object represented by dst
// will remain unchanged if the key does not exist.
//
// The dst parameter must be a pointer.
func (s *Session) GetObject(key string, dst interface{}) error {
b, err := s.GetBytes(key)
if err != nil {
return err
}
if b == nil {
return nil
}
return gobDecode(b, dst)
}
// PutObject adds an arbitrary object and corresponding key to the the session data.
// Any existing value for the key will be replaced.
//
// The val parameter must be a pointer to your object.
//
// PutObject is typically used to store custom data types. It encodes the object
// into a gob and then into a base64-encoded string which is persisted by the
// session store. This makes PutObject (and the accompanying GetObject and PopObject
// functions) comparatively expensive operations.
//
// Because gob encoding is used, the fields on custom types must be exported in
// order to be persisted correctly. Custom data types must also be registered with
// gob.Register before PutObject is called (see https://golang.org/pkg/encoding/gob/#Register).
func (s *Session) PutObject(w http.ResponseWriter, key string, val interface{}) error {
if val == nil {
return errors.New("value must not be nil")
}
b, err := gobEncode(val)
if err != nil {
return err
}
return s.PutBytes(w, key, b)
}
// PopObject removes the data for a given session key and reads it into a custom
// object (represented by the dst parameter). It should only be used to retrieve
// custom data types that have been stored using PutObject. The object represented
// by dst will remain unchanged if the key does not exist.
//
// The dst parameter must be a pointer.
func (s *Session) PopObject(w http.ResponseWriter, key string, dst interface{}) error {
b, err := s.PopBytes(w, key)
if err != nil {
return err
}
if b == nil {
return nil
}
return gobDecode(b, dst)
}
// Keys returns a slice of all key names present in the session data, sorted
// alphabetically. If the session contains no data then an empty slice will be
// returned.
func (s *Session) Keys() ([]string, error) {
if s.loadErr != nil {
return nil, s.loadErr
}
s.mu.Lock()
defer s.mu.Unlock()
keys := make([]string, len(s.data))
i := 0
for k := range s.data {
keys[i] = k
i++
}
sort.Strings(keys)
return keys, nil
}
// Exists returns true if the given key is present in the session data.
func (s *Session) Exists(key string) (bool, error) {
if s.loadErr != nil {
return false, s.loadErr
}
s.mu.Lock()
defer s.mu.Unlock()
_, exists := s.data[key]
return exists, nil
}
// Remove deletes the given key and corresponding value from the session data.
// If the key is not present this operation is a no-op.
func (s *Session) Remove(w http.ResponseWriter, key string) error {
if s.loadErr != nil {
return s.loadErr
}
s.mu.Lock()
_, exists := s.data[key]
if exists == false {
s.mu.Unlock()
return nil
}
delete(s.data, key)
s.mu.Unlock()
return s.write(w)
}
// Clear removes all data for the current session. The session token and lifetime
// are unaffected. If there is no data in the current session this operation is
// a no-op.
func (s *Session) Clear(w http.ResponseWriter) error {
if s.loadErr != nil {
return s.loadErr
}
s.mu.Lock()
if len(s.data) == 0 {
s.mu.Unlock()
return nil
}
for key := range s.data {
delete(s.data, key)
}
s.mu.Unlock()
return s.write(w)
}
// RenewToken creates a new session token while retaining the current session
// data. The session lifetime is also reset.
//
// The old session token and accompanying data are deleted from the session store.
//
// To mitigate the risk of session fixation attacks, it's important that you call
// RenewToken before making any changes to privilege levels (e.g. login and
// logout operations). See https://www.owasp.org/index.php/Session_fixation for
// additional information.
func (s *Session) RenewToken(w http.ResponseWriter) error {
if s.loadErr != nil {
return s.loadErr
}
s.mu.Lock()
err := s.store.Delete(s.token)
if err != nil {
s.mu.Unlock()
return err
}
token, err := generateToken()
if err != nil {
s.mu.Unlock()
return err
}
s.token = token
s.deadline = time.Now().Add(s.opts.lifetime)
s.mu.Unlock()
return s.write(w)
}
// Destroy deletes the current session. The session token and accompanying
// data are deleted from the session store, and the client is instructed to
// delete the session cookie.
//
// Any further operations on the session in the same request cycle will result in a
// new session being created.
//
// A new empty session will be created for any client that subsequently tries
// to use the destroyed session token.
func (s *Session) Destroy(w http.ResponseWriter) error {
if s.loadErr != nil {
return s.loadErr
}
s.mu.Lock()
defer s.mu.Unlock()
err := s.store.Delete(s.token)
if err != nil {
return err
}
s.token = ""
for key := range s.data {
delete(s.data, key)
}
cookie := &http.Cookie{
Name: s.opts.name,
Value: "",
Path: s.opts.path,
Domain: s.opts.domain,
Secure: s.opts.secure,
HttpOnly: s.opts.httpOnly,
Expires: time.Unix(1, 0),
MaxAge: -1,
}
http.SetCookie(w, cookie)
return nil
}
// Touch writes the session data in order to update the expiry time when an
// Idle Timeout has been set. If IdleTimeout is not > 0, then Touch is a no-op.
func (s *Session) Touch(w http.ResponseWriter) error {
if s.loadErr != nil {
return s.loadErr
}
if s.opts.idleTimeout > 0 {
return s.write(w)
}
return nil
}
func (s *Session) get(key string) (interface{}, bool, error) {
if s.loadErr != nil {
return nil, false, s.loadErr
}
s.mu.Lock()
defer s.mu.Unlock()
v, exists := s.data[key]
return v, exists, nil
}
func (s *Session) put(w http.ResponseWriter, key string, val interface{}) error {
if s.loadErr != nil {
return s.loadErr
}
s.mu.Lock()
s.data[key] = val
s.mu.Unlock()
return s.write(w)
}
func (s *Session) pop(w http.ResponseWriter, key string) (interface{}, bool, error) {
if s.loadErr != nil {
return nil, false, s.loadErr
}
s.mu.Lock()
v, exists := s.data[key]
if exists == false {
s.mu.Unlock()
return nil, false, nil
}
delete(s.data, key)
s.mu.Unlock()
err := s.write(w)
if err != nil {
return nil, false, err
}
return v, true, nil
}
func generateToken() (string, error) {
b := make([]byte, 32)
_, err := rand.Read(b)
if err != nil {
return "", err
}
return base64.RawURLEncoding.EncodeToString(b), nil
}
func gobEncode(v interface{}) ([]byte, error) {
buf := new(bytes.Buffer)
err := gob.NewEncoder(buf).Encode(v)
if err != nil {
return nil, err
}
return buf.Bytes(), nil
}
func gobDecode(b []byte, dst interface{}) error {
buf := bytes.NewBuffer(b)
return gob.NewDecoder(buf).Decode(dst)
}
func encodeToJSON(data map[string]interface{}, deadline time.Time) ([]byte, error) {
return json.Marshal(&struct {
Data map[string]interface{} `json:"data"`
Deadline int64 `json:"deadline"`
}{
Data: data,
Deadline: deadline.UnixNano(),
})
}
func decodeFromJSON(j []byte) (map[string]interface{}, time.Time, error) {
aux := struct {
Data map[string]interface{} `json:"data"`
Deadline int64 `json:"deadline"`
}{}
dec := json.NewDecoder(bytes.NewReader(j))
dec.UseNumber()
err := dec.Decode(&aux)
if err != nil {
return nil, time.Time{}, err
}
return aux.Data, time.Unix(0, aux.Deadline), nil
}