Skip to content

Commit d9f56cd

Browse files
committed
Merge branch 'master' into herman/scep-provisioner-decrypter
2 parents 9d3b78a + 83e5d42 commit d9f56cd

25 files changed

+529
-265
lines changed

.goreleaser.yml

+119-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ archives:
3636
# Most common use case is to archive as zip on Windows.
3737
# Default is empty.
3838
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Version }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}"
39-
rlcp: true
4039
format_overrides:
4140
- goos: windows
4241
format: zip
@@ -88,7 +87,6 @@ nfpms:
8887

8988
source:
9089
enabled: true
91-
rlcp: true
9290
name_template: '{{ .ProjectName }}_{{ .Version }}'
9391

9492
checksum:
@@ -199,6 +197,124 @@ release:
199197
# - glob: ./glob/**/to/**/file/**/*
200198
# - glob: ./glob/foo/to/bar/file/foobar/override_from_previous
201199

200+
winget:
201+
-
202+
# IDs of the archives to use.
203+
# Empty means all IDs.
204+
ids: [ default ]
205+
206+
#
207+
# Default: ProjectName
208+
# Templates: allowed
209+
name: step-ca
210+
211+
# Publisher name.
212+
#
213+
# Templates: allowed
214+
# Required.
215+
publisher: Smallstep
216+
217+
# Your app's description.
218+
#
219+
# Templates: allowed
220+
# Required.
221+
short_description: "A private certificate authority (X.509 & SSH) & ACME server for secure automated certificate management."
222+
223+
# License name.
224+
#
225+
# Templates: allowed
226+
# Required.
227+
license: "Apache-2.0"
228+
229+
# Publisher URL.
230+
#
231+
# Templates: allowed
232+
publisher_url: "https://smallstep.com"
233+
234+
# Publisher support URL.
235+
#
236+
# Templates: allowed
237+
publisher_support_url: "https://github.com/smallstep/certificates/discussions"
238+
239+
# URL which is determined by the given Token (github, gitlab or gitea).
240+
#
241+
# Default depends on the client.
242+
# Templates: allowed
243+
url_template: "https://github.com/smallstep/certificates/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
244+
245+
# Git author used to commit to the repository.
246+
commit_author:
247+
name: goreleaserbot
248+
email: goreleaser@smallstep.com
249+
250+
# The project name and current git tag are used in the format string.
251+
#
252+
# Templates: allowed
253+
commit_msg_template: "{{ .PackageIdentifier }}: {{ .Tag }}"
254+
255+
# Your app's homepage.
256+
homepage: "https://github.com/smallstep/certificates"
257+
258+
# Your app's long description.
259+
#
260+
# Templates: allowed
261+
description: ""
262+
263+
# License URL.
264+
#
265+
# Templates: allowed
266+
license_url: "https://github.com/smallstep/certificates/blob/master/LICENSE"
267+
268+
# Release notes URL.
269+
#
270+
# Templates: allowed
271+
release_notes_url: "https://github.com/smallstep/certificates/releases/tag/{{.Version}}"
272+
273+
# Create the PR - for testing
274+
skip_upload: false
275+
276+
# Tags.
277+
tags:
278+
- certificates
279+
- smallstep
280+
- tls
281+
282+
# Repository to push the generated files to.
283+
repository:
284+
owner: smallstep
285+
name: winget-pkgs
286+
branch: step
287+
288+
# Optionally a token can be provided, if it differs from the token
289+
# provided to GoReleaser
290+
# Templates: allowed
291+
#token: "{{ .Env.GITHUB_PERSONAL_AUTH_TOKEN }}"
292+
293+
# Sets up pull request creation instead of just pushing to the given branch.
294+
# Make sure the 'branch' property is different from base before enabling
295+
# it.
296+
#
297+
# Since: v1.17
298+
pull_request:
299+
# Whether to enable it or not.
300+
enabled: true
301+
#check_boxes: true
302+
# Whether to open the PR as a draft or not.
303+
#
304+
# Default: false
305+
# Since: v1.19
306+
# draft: true
307+
308+
# Base can also be another repository, in which case the owner and name
309+
# above will be used as HEAD, allowing cross-repository pull requests.
310+
#
311+
# Since: v1.19
312+
base:
313+
owner: microsoft
314+
name: winget-pkgs
315+
branch: master
316+
317+
202318
scoops:
203319
-
204320
ids: [ default ]
@@ -208,7 +324,7 @@ scoops:
208324
# Default for gitea is "https://gitea.com/<repo_owner>/<repo_name>/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
209325
url_template: "http://github.com/smallstep/certificates/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
210326
# Repository to push the app manifest to.
211-
bucket:
327+
repository:
212328
owner: smallstep
213329
name: scoop-bucket
214330

acme/api/account_test.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"encoding/json"
88
"fmt"
99
"io"
10+
"net/http"
1011
"net/http/httptest"
1112
"net/url"
1213
"testing"
@@ -313,7 +314,7 @@ func TestHandler_GetOrdersByAccountID(t *testing.T) {
313314
"fail/nil-account": func(t *testing.T) test {
314315
return test{
315316
db: &acme.MockDB{},
316-
ctx: context.WithValue(context.Background(), accContextKey, nil),
317+
ctx: context.WithValue(context.Background(), accContextKey, http.NoBody),
317318
statusCode: 400,
318319
err: acme.NewError(acme.ErrorAccountDoesNotExistType, "account does not exist"),
319320
}
@@ -363,7 +364,7 @@ func TestHandler_GetOrdersByAccountID(t *testing.T) {
363364
tc := run(t)
364365
t.Run(name, func(t *testing.T) {
365366
ctx := acme.NewContext(tc.ctx, tc.db, nil, acme.NewLinker("test.ca.smallstep.com", "acme"), nil)
366-
req := httptest.NewRequest("GET", u, nil)
367+
req := httptest.NewRequest("GET", u, http.NoBody)
367368
req = req.WithContext(ctx)
368369
w := httptest.NewRecorder()
369370
GetOrdersByAccountID(w, req)
@@ -802,7 +803,7 @@ func TestHandler_NewAccount(t *testing.T) {
802803
tc := run(t)
803804
t.Run(name, func(t *testing.T) {
804805
ctx := acme.NewContext(tc.ctx, tc.db, nil, acme.NewLinker("test.ca.smallstep.com", "acme"), nil)
805-
req := httptest.NewRequest("GET", "/foo/bar", nil)
806+
req := httptest.NewRequest("GET", "/foo/bar", http.NoBody)
806807
req = req.WithContext(ctx)
807808
w := httptest.NewRecorder()
808809
NewAccount(w, req)
@@ -1005,7 +1006,7 @@ func TestHandler_GetOrUpdateAccount(t *testing.T) {
10051006
tc := run(t)
10061007
t.Run(name, func(t *testing.T) {
10071008
ctx := acme.NewContext(tc.ctx, tc.db, nil, acme.NewLinker("test.ca.smallstep.com", "acme"), nil)
1008-
req := httptest.NewRequest("GET", "/foo/bar", nil)
1009+
req := httptest.NewRequest("GET", "/foo/bar", http.NoBody)
10091010
req = req.WithContext(ctx)
10101011
w := httptest.NewRecorder()
10111012
GetOrUpdateAccount(w, req)

acme/api/handler_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestHandler_GetNonce(t *testing.T) {
6060
}
6161

6262
// Request with chi context
63-
req := httptest.NewRequest("GET", "http://ca.smallstep.com/nonce", nil)
63+
req := httptest.NewRequest("GET", "http://ca.smallstep.com/nonce", http.NoBody)
6464

6565
for _, tt := range tests {
6666
t.Run(tt.name, func(t *testing.T) {
@@ -175,7 +175,7 @@ func TestHandler_GetDirectory(t *testing.T) {
175175
tc := run(t)
176176
t.Run(name, func(t *testing.T) {
177177
ctx := acme.NewLinkerContext(tc.ctx, acme.NewLinker("test.ca.smallstep.com", "acme"))
178-
req := httptest.NewRequest("GET", "/foo/bar", nil)
178+
req := httptest.NewRequest("GET", "/foo/bar", http.NoBody)
179179
req = req.WithContext(ctx)
180180
w := httptest.NewRecorder()
181181
GetDirectory(w, req)
@@ -347,7 +347,7 @@ func TestHandler_GetAuthorization(t *testing.T) {
347347
tc := run(t)
348348
t.Run(name, func(t *testing.T) {
349349
ctx := acme.NewContext(tc.ctx, tc.db, nil, acme.NewLinker("test.ca.smallstep.com", "acme"), nil)
350-
req := httptest.NewRequest("GET", "/foo/bar", nil)
350+
req := httptest.NewRequest("GET", "/foo/bar", http.NoBody)
351351
req = req.WithContext(ctx)
352352
w := httptest.NewRecorder()
353353
GetAuthorization(w, req)
@@ -489,7 +489,7 @@ func TestHandler_GetCertificate(t *testing.T) {
489489
tc := run(t)
490490
t.Run(name, func(t *testing.T) {
491491
ctx := acme.NewDatabaseContext(tc.ctx, tc.db)
492-
req := httptest.NewRequest("GET", u, nil)
492+
req := httptest.NewRequest("GET", u, http.NoBody)
493493
req = req.WithContext(ctx)
494494
w := httptest.NewRecorder()
495495
GetCertificate(w, req)
@@ -747,7 +747,7 @@ func TestHandler_GetChallenge(t *testing.T) {
747747
tc := run(t)
748748
t.Run(name, func(t *testing.T) {
749749
ctx := acme.NewContext(tc.ctx, tc.db, nil, acme.NewLinker("test.ca.smallstep.com", "acme"), nil)
750-
req := httptest.NewRequest("GET", u, nil)
750+
req := httptest.NewRequest("GET", u, http.NoBody)
751751
req = req.WithContext(ctx)
752752
w := httptest.NewRecorder()
753753
GetChallenge(w, req)

acme/api/middleware_test.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func TestHandler_addNonce(t *testing.T) {
7575
tc := run(t)
7676
t.Run(name, func(t *testing.T) {
7777
ctx := newBaseContext(context.Background(), tc.db)
78-
req := httptest.NewRequest("GET", u, nil).WithContext(ctx)
78+
req := httptest.NewRequest("GET", u, http.NoBody).WithContext(ctx)
7979
w := httptest.NewRecorder()
8080
addNonce(testNext)(w, req)
8181
res := w.Result()
@@ -127,7 +127,7 @@ func TestHandler_addDirLink(t *testing.T) {
127127
for name, run := range tests {
128128
tc := run(t)
129129
t.Run(name, func(t *testing.T) {
130-
req := httptest.NewRequest("GET", "/foo", nil)
130+
req := httptest.NewRequest("GET", "/foo", http.NoBody)
131131
req = req.WithContext(tc.ctx)
132132
w := httptest.NewRecorder()
133133
addDirLink(testNext)(w, req)
@@ -230,7 +230,7 @@ func TestHandler_verifyContentType(t *testing.T) {
230230
if tc.url != "" {
231231
_u = tc.url
232232
}
233-
req := httptest.NewRequest("GET", _u, nil)
233+
req := httptest.NewRequest("GET", _u, http.NoBody)
234234
req = req.WithContext(tc.ctx)
235235
req.Header.Add("Content-Type", tc.contentType)
236236
w := httptest.NewRecorder()
@@ -298,7 +298,7 @@ func TestHandler_isPostAsGet(t *testing.T) {
298298
tc := run(t)
299299
t.Run(name, func(t *testing.T) {
300300
// h := &Handler{}
301-
req := httptest.NewRequest("GET", u, nil)
301+
req := httptest.NewRequest("GET", u, http.NoBody)
302302
req = req.WithContext(tc.ctx)
303303
w := httptest.NewRecorder()
304304
isPostAsGet(testNext)(w, req)
@@ -582,7 +582,7 @@ func TestHandler_verifyAndExtractJWSPayload(t *testing.T) {
582582
tc := run(t)
583583
t.Run(name, func(t *testing.T) {
584584
// h := &Handler{}
585-
req := httptest.NewRequest("GET", u, nil)
585+
req := httptest.NewRequest("GET", u, http.NoBody)
586586
req = req.WithContext(tc.ctx)
587587
w := httptest.NewRecorder()
588588
verifyAndExtractJWSPayload(tc.next)(w, req)
@@ -829,7 +829,7 @@ func TestHandler_lookupJWK(t *testing.T) {
829829
tc := run(t)
830830
t.Run(name, func(t *testing.T) {
831831
ctx := newBaseContext(tc.ctx, tc.db, tc.linker)
832-
req := httptest.NewRequest("GET", u, nil)
832+
req := httptest.NewRequest("GET", u, http.NoBody)
833833
req = req.WithContext(ctx)
834834
w := httptest.NewRecorder()
835835
lookupJWK(tc.next)(w, req)
@@ -1028,7 +1028,7 @@ func TestHandler_extractJWK(t *testing.T) {
10281028
tc := run(t)
10291029
t.Run(name, func(t *testing.T) {
10301030
ctx := newBaseContext(tc.ctx, tc.db)
1031-
req := httptest.NewRequest("GET", u, nil)
1031+
req := httptest.NewRequest("GET", u, http.NoBody)
10321032
req = req.WithContext(ctx)
10331033
w := httptest.NewRecorder()
10341034
extractJWK(tc.next)(w, req)
@@ -1403,7 +1403,7 @@ func TestHandler_validateJWS(t *testing.T) {
14031403
tc := run(t)
14041404
t.Run(name, func(t *testing.T) {
14051405
ctx := newBaseContext(tc.ctx, tc.db)
1406-
req := httptest.NewRequest("GET", u, nil)
1406+
req := httptest.NewRequest("GET", u, http.NoBody)
14071407
req = req.WithContext(ctx)
14081408
w := httptest.NewRecorder()
14091409
validateJWS(tc.next)(w, req)
@@ -1585,7 +1585,7 @@ func TestHandler_extractOrLookupJWK(t *testing.T) {
15851585
tc := prep(t)
15861586
t.Run(name, func(t *testing.T) {
15871587
ctx := newBaseContext(tc.ctx, tc.db, tc.linker)
1588-
req := httptest.NewRequest("GET", u, nil)
1588+
req := httptest.NewRequest("GET", u, http.NoBody)
15891589
req = req.WithContext(ctx)
15901590
w := httptest.NewRecorder()
15911591
extractOrLookupJWK(tc.next)(w, req)
@@ -1670,7 +1670,7 @@ func TestHandler_checkPrerequisites(t *testing.T) {
16701670
tc := run(t)
16711671
t.Run(name, func(t *testing.T) {
16721672
ctx := acme.NewPrerequisitesCheckerContext(tc.ctx, tc.prerequisitesChecker)
1673-
req := httptest.NewRequest("GET", u, nil)
1673+
req := httptest.NewRequest("GET", u, http.NoBody)
16741674
req = req.WithContext(ctx)
16751675
w := httptest.NewRecorder()
16761676
checkPrerequisites(tc.next)(w, req)

acme/api/order_test.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"encoding/json"
99
"fmt"
1010
"io"
11+
"net/http"
1112
"net/http/httptest"
1213
"net/url"
1314
"reflect"
@@ -468,7 +469,7 @@ func TestHandler_GetOrder(t *testing.T) {
468469
tc := run(t)
469470
t.Run(name, func(t *testing.T) {
470471
ctx := newBaseContext(tc.ctx, tc.db, acme.NewLinker("test.ca.smallstep.com", "acme"))
471-
req := httptest.NewRequest("GET", u, nil)
472+
req := httptest.NewRequest("GET", u, http.NoBody)
472473
req = req.WithContext(ctx)
473474
w := httptest.NewRecorder()
474475
GetOrder(w, req)
@@ -1827,7 +1828,7 @@ func TestHandler_NewOrder(t *testing.T) {
18271828
t.Run(name, func(t *testing.T) {
18281829
mockMustAuthority(t, tc.ca)
18291830
ctx := newBaseContext(tc.ctx, tc.db, acme.NewLinker("test.ca.smallstep.com", "acme"))
1830-
req := httptest.NewRequest("GET", u, nil)
1831+
req := httptest.NewRequest("GET", u, http.NoBody)
18311832
req = req.WithContext(ctx)
18321833
w := httptest.NewRecorder()
18331834
NewOrder(w, req)
@@ -2124,7 +2125,7 @@ func TestHandler_FinalizeOrder(t *testing.T) {
21242125
tc := run(t)
21252126
t.Run(name, func(t *testing.T) {
21262127
ctx := newBaseContext(tc.ctx, tc.db, acme.NewLinker("test.ca.smallstep.com", "acme"))
2127-
req := httptest.NewRequest("GET", u, nil)
2128+
req := httptest.NewRequest("GET", u, http.NoBody)
21282129
req = req.WithContext(ctx)
21292130
w := httptest.NewRecorder()
21302131
FinalizeOrder(w, req)

acme/api/revoke_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ func TestHandler_RevokeCert(t *testing.T) {
10721072
t.Run(name, func(t *testing.T) {
10731073
ctx := newBaseContext(tc.ctx, tc.db, acme.NewLinker("test.ca.smallstep.com", "acme"))
10741074
mockMustAuthority(t, tc.ca)
1075-
req := httptest.NewRequest("POST", revokeURL, nil)
1075+
req := httptest.NewRequest("POST", revokeURL, http.NoBody)
10761076
req = req.WithContext(ctx)
10771077
w := httptest.NewRecorder()
10781078
RevokeCert(w, req)
@@ -1094,7 +1094,7 @@ func TestHandler_RevokeCert(t *testing.T) {
10941094
assert.Equals(t, res.Header["Content-Type"], []string{"application/problem+json"})
10951095
} else {
10961096
assert.True(t, bytes.Equal(bytes.TrimSpace(body), []byte{}))
1097-
assert.Equals(t, int64(0), req.ContentLength)
1097+
assert.Equals(t, int64(-1), req.ContentLength)
10981098
assert.Equals(t, []string{fmt.Sprintf("<%s/acme/%s/directory>;rel=\"index\"", baseURL.String(), escProvName)}, res.Header["Link"])
10991099
}
11001100
})

0 commit comments

Comments
 (0)