@@ -2,8 +2,6 @@ package storage
2
2
3
3
import (
4
4
"context"
5
- "encoding/json"
6
- "io"
7
5
"io/fs"
8
6
"path/filepath"
9
7
"strings"
@@ -49,26 +47,6 @@ func (s *Signature) SigningEnabled() bool {
49
47
return s .IncludeEmptySignatures
50
48
}
51
49
52
- // AddExtension includes the signature manifest of the vsix. Signing happens on
53
- // demand, so leave the manifest unsigned. This is safe to do even if
54
- // 'signExtensions' is disabled, as these files lay dormant until signed.
55
- func (s * Signature ) AddExtension (ctx context.Context , manifest * VSIXManifest , vsix []byte , extra ... File ) (string , error ) {
56
- sigManifest , err := extensionsign .GenerateSignatureManifest (vsix )
57
- if err != nil {
58
- return "" , xerrors .Errorf ("generate signature manifest: %w" , err )
59
- }
60
-
61
- sigManifestJSON , err := json .Marshal (sigManifest )
62
- if err != nil {
63
- return "" , xerrors .Errorf ("encode signature manifest: %w" , err )
64
- }
65
-
66
- return s .Storage .AddExtension (ctx , manifest , vsix , append (extra , File {
67
- RelativePath : sigManifestName ,
68
- Content : sigManifestJSON ,
69
- })... )
70
- }
71
-
72
50
func (s * Signature ) Manifest (ctx context.Context , publisher , name string , version Version ) (* VSIXManifest , error ) {
73
51
manifest , err := s .Storage .Manifest (ctx , publisher , name , version )
74
52
if err != nil {
@@ -95,8 +73,7 @@ func (s *Signature) Manifest(ctx context.Context, publisher, name string, versio
95
73
// Open will intercept requests for signed extensions payload.
96
74
// It does this by looking for 'SigzipFileExtension' or p7s.sig.
97
75
//
98
- // The signed payload and signing process is taken from:
99
- // https://github.com/filiptronicek/node-ovsx-sign
76
+ // The signed payload is completely empty. Nothing it actually signed.
100
77
//
101
78
// Some notes:
102
79
//
@@ -110,22 +87,8 @@ func (s *Signature) Manifest(ctx context.Context, publisher, name string, versio
110
87
// will not work.
111
88
func (s * Signature ) Open (ctx context.Context , fp string ) (fs.File , error ) {
112
89
if s .SigningEnabled () && strings .HasSuffix (filepath .Base (fp ), SigzipFileExtension ) {
113
- // hijack this request, sign the sig manifest
114
- manifest , err := s .Storage .Open (ctx , filepath .Join (filepath .Dir (fp ), sigManifestName ))
115
- if err != nil {
116
- // If this file is missing, it means the extension was added before
117
- // signatures were handled by the marketplace.
118
- // TODO: Generate the sig manifest payload and insert it?
119
- return nil , xerrors .Errorf ("open signature manifest: %w" , err )
120
- }
121
- defer manifest .Close ()
122
-
123
- manifestData , err := io .ReadAll (manifest )
124
- if err != nil {
125
- return nil , xerrors .Errorf ("read signature manifest: %w" , err )
126
- }
127
-
128
- signed , err := s .SigZip (ctx , manifestData )
90
+ // hijack this request, return an empty signature payload
91
+ signed , err := extensionsign .IncludeEmptySignature ()
129
92
if err != nil {
130
93
return nil , xerrors .Errorf ("sign and zip manifest: %w" , err )
131
94
}
@@ -137,13 +100,3 @@ func (s *Signature) Open(ctx context.Context, fp string) (fs.File, error) {
137
100
138
101
return s .Storage .Open (ctx , fp )
139
102
}
140
-
141
- // SigZip currently just returns an empty signature.
142
- func (s * Signature ) SigZip (ctx context.Context , sigManifest []byte ) ([]byte , error ) {
143
- signed , err := extensionsign .IncludeEmptySignature (sigManifest )
144
- if err != nil {
145
- s .Logger .Error (ctx , "signing manifest" , slog .Error (err ))
146
- return nil , xerrors .Errorf ("sign and zip manifest: %w" , err )
147
- }
148
- return signed , nil
149
- }
0 commit comments