Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8afb10e

Browse files
authored
chore: improve validation of Security tag in swaggerparser (#15660)
Aims toresolve#15605 There's currently one option valid for the `@Security` tag inswaggerparser - which fails in the CI if we try to put any other value.At least one of our endpoints does not accept `CoderSessionToken` as anoption for the authentication and so we need to add new possibilities inorder to keep the documentation up-to-date.In this PR , I added `ProvisionerKey` which is the way our provisionerdaemon can authenticate to the backend - also modified a bit the code tosimplify other options later.
1 parent60ddcf5 commit8afb10e

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

‎coderd/apidoc/docs.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/apidoc/swagger.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/coderdtest/swaggerparser.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,11 @@ func assertPathParametersDefined(t *testing.T, comment SwaggerComment) {
300300
}
301301

302302
funcassertSecurityDefined(t*testing.T,commentSwaggerComment) {
303+
authorizedSecurityTags:= []string{
304+
"CoderSessionToken",
305+
"CoderProvisionerKey",
306+
}
307+
303308
ifcomment.router=="/updatecheck"||
304309
comment.router=="/buildinfo"||
305310
comment.router=="/"||
@@ -308,7 +313,7 @@ func assertSecurityDefined(t *testing.T, comment SwaggerComment) {
308313
comment.router=="/users/otp/change-password" {
309314
return// endpoints do not require authorization
310315
}
311-
assert.Equal(t,"CoderSessionToken",comment.security,"@Security must beequal CoderSessionToken")
316+
assert.Containsf(t,authorizedSecurityTags,comment.security,"@Security must beeither of these options: %v",authorizedSecurityTags)
312317
}
313318

314319
funcassertAccept(t*testing.T,commentSwaggerComment) {

‎docs/reference/api/enterprise.md

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎enterprise/coderd/provisionerkeys.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func (api *API) deleteProvisionerKey(rw http.ResponseWriter, r *http.Request) {
202202

203203
// @Summary Fetch provisioner key details
204204
// @ID fetch-provisioner-key-details
205-
// @SecurityCoderSessionToken
205+
// @SecurityCoderProvisionerKey
206206
// @Produce json
207207
// @Tags Enterprise
208208
// @Param provisionerkey path string true "Provisioner Key"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp