@@ -2,31 +2,44 @@ package serializer
22
33import (
44 "github.com/hyp3rd/ewrap"
5- "github.com/shamaton/msgpack/v3"
65)
76
87// MsgpackSerializer leverages `msgpack` to serialize the items before storing them in the cache.
8+ //
9+ // Deprecated: This serializer is now a shim and will be removed in a future release for security reasons.
10+ // REF: https://github.com/shamaton/msgpack/pull/60
11+ // Please use the `Marshal` method of the `Serializer` interface instead.
912type MsgpackSerializer struct {}
1013
1114// Marshal serializes the given value into a byte slice.
1215// @param v.
13- func (* MsgpackSerializer ) Marshal (v any ) ([]byte , error ) { // receiver omitted (unused)
14- data , err := msgpack .Marshal (& v )
15- if err != nil {
16- return nil , ewrap .Wrap (err , "failed to marshal msgpack" )
17- }
16+ //
17+ // Deprecated: This method is now a shim and will be removed in a future release for security reasons.
18+ // REF: https://github.com/shamaton/msgpack/pull/60
19+ // Please use the `Marshal` method of the `Serializer` interface instead.
20+ func (* MsgpackSerializer ) Marshal (_ any ) ([]byte , error ) { // receiver omitted (unused)
21+ // data, err := msgpack.Marshal(&v)
22+ // if err != nil {
23+ // return nil, ewrap.Wrap(err, "failed to marshal msgpack")
24+ // }
1825
19- return data , nil
26+ // return data, nil
27+ return nil , ewrap .New ("msgpack serialization is deprecated and has been disabled for security reasons" )
2028}
2129
2230// Unmarshal deserializes the given byte slice into the given value.
2331// @param data
2432// @param v.
25- func (* MsgpackSerializer ) Unmarshal (data []byte , v any ) error { // receiver omitted (unused)
26- err := msgpack .Unmarshal (data , v )
27- if err != nil {
28- return ewrap .Wrap (err , "failed to unmarshal msgpack" )
29- }
33+ //
34+ // Deprecated: This method is now a shim and will be removed in a future release for security reasons.
35+ // REF: https://github.com/shamaton/msgpack/pull/60
36+ // Please use the `Unmarshal` method of the `Serializer` interface instead.
37+ func (* MsgpackSerializer ) Unmarshal (_ []byte , _ any ) error { // receiver omitted (unused)
38+ // err := msgpack.Unmarshal(data, v)
39+ // if err != nil {
40+ // return ewrap.Wrap(err, "failed to unmarshal msgpack")
41+ // }
3042
31- return nil
43+ // return nil
44+ return ewrap .New ("msgpack deserialization is deprecated and has been disabled for security reasons" )
3245}
0 commit comments