Skip to content

chore: improve validation of Security tag in swaggerparser #15660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
rename ProvisionerKet to CoderProvisionerKey in swagger doc
  • Loading branch information
defelmnq committed Nov 26, 2024
commit 971124900daee6a61c07758533e9e20ab6e53354
2 changes: 1 addition & 1 deletion coderd/apidoc/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion coderd/apidoc/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions coderd/coderdtest/swaggerparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func assertPathParametersDefined(t *testing.T, comment SwaggerComment) {
func assertSecurityDefined(t *testing.T, comment SwaggerComment) {
authorizedSecurityTags := []string{
"CoderSessionToken",
"ProvisionerKey",
"CoderProvisionerKey",
}

if comment.router == "/updatecheck" ||
Expand All @@ -313,7 +313,7 @@ func assertSecurityDefined(t *testing.T, comment SwaggerComment) {
comment.router == "/users/otp/change-password" {
return // endpoints do not require authorization
}
assert.Containsf(t, authorizedSecurityTags, comment.security, "@Security must be in %v", authorizedSecurityTags)
assert.Containsf(t, authorizedSecurityTags, comment.security, "@Security must be either of these options: %v", authorizedSecurityTags)
}

func assertAccept(t *testing.T, comment SwaggerComment) {
Expand Down
2 changes: 1 addition & 1 deletion enterprise/coderd/provisionerkeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func (api *API) deleteProvisionerKey(rw http.ResponseWriter, r *http.Request) {

// @Summary Fetch provisioner key details
// @ID fetch-provisioner-key-details
// @Security ProvisionerKey
// @Security CoderProvisionerKey
// @Produce json
// @Tags Enterprise
// @Param provisionerkey path string true "Provisioner Key"
Expand Down
Loading