Skip to content

Commit 2d5b4d5

Browse files
committed
adds tag annotation, fixes wrong security definition
1 parent cbdd770 commit 2d5b4d5

19 files changed

+817
-318
lines changed

cmd/devguard/main.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,12 @@ var release string // Will be filled at build time
6464
// @securityDefinitions.apikey CookieAuth
6565
// @in cookie
6666
// @name ory_kratos_session
67+
// @description Session-based authentication using Ory Kratos
6768

68-
// @securityDefinitions.apikey ApiKeyAuth
69-
// @in header
70-
// @name X-API-Key
69+
// @securityDefinitions.apikey PATAuth
70+
// @in header
71+
// @name X-Signature
72+
// @description Personal Access Token authentication using HTTP request signing. Requires X-Signature and X-Fingerprint headers.
7173
func main() {
7274
//os.Setenv("TZ", "UTC")
7375
shared.LoadConfig() // nolint: errcheck

controllers/artifact_controller.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ func informationSourceToString(source informationSource) string {
6161
}
6262

6363
// @Summary Create artifact
64+
// @Tags Artifacts
6465
// @Security CookieAuth
65-
// @Security ApiKeyAuth
66+
// @Security PATAuth
6667
// @Param organization path string true "Organization slug"
6768
// @Param projectSlug path string true "Project slug"
6869
// @Param assetSlug path string true "Asset slug"
@@ -125,8 +126,9 @@ func (c *ArtifactController) Create(ctx shared.Context) error {
125126
}
126127

127128
// @Summary Delete artifact
129+
// @Tags Artifacts
128130
// @Security CookieAuth
129-
// @Security ApiKeyAuth
131+
// @Security PATAuth
130132
// @Param organization path string true "Organization slug"
131133
// @Param projectSlug path string true "Project slug"
132134
// @Param assetSlug path string true "Asset slug"
@@ -182,8 +184,9 @@ func (c *ArtifactController) DeleteArtifact(ctx shared.Context) error {
182184
}
183185

184186
// @Summary Sync external sources for artifact
187+
// @Tags Artifacts
185188
// @Security CookieAuth
186-
// @Security ApiKeyAuth
189+
// @Security PATAuth
187190
// @Param organization path string true "Organization slug"
188191
// @Param projectSlug path string true "Project slug"
189192
// @Param assetSlug path string true "Asset slug"
@@ -234,8 +237,9 @@ func (c *ArtifactController) SyncExternalSources(ctx shared.Context) error {
234237
}
235238

236239
// @Summary Update artifact
240+
// @Tags Artifacts
237241
// @Security CookieAuth
238-
// @Security ApiKeyAuth
242+
// @Security PATAuth
239243
// @Param organization path string true "Organization slug"
240244
// @Param projectSlug path string true "Project slug"
241245
// @Param assetSlug path string true "Asset slug"

controllers/asset_controller.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func (a *AssetController) RunDaemonPipeline(ctx shared.Context) error {
5353
}
5454

5555
// @Summary Lookup asset by provider
56+
// @Tags Assets
5657
// @Param provider query string true "Provider name"
5758
// @Param id query string true "Repository ID"
5859
// @Success 200 {object} dtos.LookupResponse
@@ -96,8 +97,9 @@ func (a *AssetController) HandleLookup(ctx shared.Context) error {
9697
}
9798

9899
// @Summary List assets
100+
// @Tags Assets
99101
// @Security CookieAuth
100-
// @Security ApiKeyAuth
102+
// @Security PATAuth
101103
// @Param organization path string true "Organization slug"
102104
// @Param projectSlug path string true "Project slug"
103105
// @Success 200 {array} dtos.AssetDTO
@@ -141,8 +143,9 @@ func (a *AssetController) AttachSigningKey(ctx shared.Context) error {
141143
}
142144

143145
// @Summary Delete asset
146+
// @Tags Assets
144147
// @Security CookieAuth
145-
// @Security ApiKeyAuth
148+
// @Security PATAuth
146149
// @Param organization path string true "Organization slug"
147150
// @Param projectSlug path string true "Project slug"
148151
// @Param assetSlug path string true "Asset slug"
@@ -174,8 +177,9 @@ func (a *AssetController) GetSecrets(ctx shared.Context) error {
174177
}
175178

176179
// @Summary Create asset
180+
// @Tags Assets
177181
// @Security CookieAuth
178-
// @Security ApiKeyAuth
182+
// @Security PATAuth
179183
// @Param organization path string true "Organization slug"
180184
// @Param projectSlug path string true "Project slug"
181185
// @Param body body dtos.AssetCreateRequest true "Request body"
@@ -205,8 +209,9 @@ func (a *AssetController) Create(ctx shared.Context) error {
205209
}
206210

207211
// @Summary Get asset details
212+
// @Tags Assets
208213
// @Security CookieAuth
209-
// @Security ApiKeyAuth
214+
// @Security PATAuth
210215
// @Param organization path string true "Organization slug"
211216
// @Param projectSlug path string true "Project slug"
212217
// @Param assetSlug path string true "Asset slug"
@@ -224,8 +229,9 @@ func (a *AssetController) Read(ctx shared.Context) error {
224229
}
225230

226231
// @Summary Update asset
232+
// @Tags Assets
227233
// @Security CookieAuth
228-
// @Security ApiKeyAuth
234+
// @Security PATAuth
229235
// @Param organization path string true "Organization slug"
230236
// @Param projectSlug path string true "Project slug"
231237
// @Param assetSlug path string true "Asset slug"

controllers/asset_version_controller.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ func NewAssetVersionController(
7171
}
7272

7373
// @Summary Get asset version details
74+
// @Tags Asset Versions
7475
// @Security CookieAuth
75-
// @Security ApiKeyAuth
76+
// @Security PATAuth
7677
// @Param organization path string true "Organization slug"
7778
// @Param projectSlug path string true "Project slug"
7879
// @Param assetSlug path string true "Asset slug"
@@ -85,8 +86,9 @@ func (a *AssetVersionController) Read(ctx shared.Context) error {
8586
}
8687

8788
// @Summary Create asset version
89+
// @Tags Asset Versions
8890
// @Security CookieAuth
89-
// @Security ApiKeyAuth
91+
// @Security PATAuth
9092
// @Param organization path string true "Organization slug"
9193
// @Param projectSlug path string true "Project slug"
9294
// @Param assetSlug path string true "Asset slug"
@@ -120,8 +122,9 @@ func (a *AssetVersionController) Create(ctx shared.Context) error {
120122
}
121123

122124
// @Summary Delete asset version
125+
// @Tags Asset Versions
123126
// @Security CookieAuth
124-
// @Security ApiKeyAuth
127+
// @Security PATAuth
125128
// @Param organization path string true "Organization slug"
126129
// @Param projectSlug path string true "Project slug"
127130
// @Param assetSlug path string true "Asset slug"
@@ -139,8 +142,9 @@ func (a *AssetVersionController) Delete(ctx shared.Context) error {
139142
}
140143

141144
// @Summary List asset versions
145+
// @Tags Asset Versions
142146
// @Security CookieAuth
143-
// @Security ApiKeyAuth
147+
// @Security PATAuth
144148
// @Param organization path string true "Organization slug"
145149
// @Param projectSlug path string true "Project slug"
146150
// @Param assetSlug path string true "Asset slug"
@@ -240,8 +244,9 @@ func (a *AssetVersionController) GetDependencyPathFromPURL(ctx shared.Context) e
240244
}
241245

242246
// @Summary Get SBOM in JSON format
247+
// @Tags Asset Versions
243248
// @Security CookieAuth
244-
// @Security ApiKeyAuth
249+
// @Security PATAuth
245250
// @Param organization path string true "Organization slug"
246251
// @Param projectSlug path string true "Project slug"
247252
// @Param assetSlug path string true "Asset slug"
@@ -297,8 +302,9 @@ func (a *AssetVersionController) VEXXML(ctx shared.Context) error {
297302
}
298303

299304
// @Summary Get VEX in JSON format
305+
// @Tags Asset Versions
300306
// @Security CookieAuth
301-
// @Security ApiKeyAuth
307+
// @Security PATAuth
302308
// @Param organization path string true "Organization slug"
303309
// @Param projectSlug path string true "Project slug"
304310
// @Param assetSlug path string true "Asset slug"
@@ -454,8 +460,9 @@ func (a *AssetVersionController) buildVeX(ctx shared.Context) (*normalize.CdxBom
454460
}
455461

456462
// @Summary Get asset version metrics
463+
// @Tags Asset Versions
457464
// @Security CookieAuth
458-
// @Security ApiKeyAuth
465+
// @Security PATAuth
459466
// @Param organization path string true "Organization slug"
460467
// @Param projectSlug path string true "Project slug"
461468
// @Param assetSlug path string true "Asset slug"

controllers/attestation_controller.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ func NewAttestationController(repository shared.AttestationRepository, assetVers
2626
}
2727

2828
// @Summary List attestations
29+
// @Tags Attestations
2930
// @Security CookieAuth
30-
// @Security ApiKeyAuth
31+
// @Security PATAuth
3132
// @Param organization path string true "Organization slug"
3233
// @Param projectSlug path string true "Project slug"
3334
// @Param assetSlug path string true "Asset slug"
@@ -48,8 +49,9 @@ func (a *AttestationController) List(ctx shared.Context) error {
4849
}
4950

5051
// @Summary Create attestation
52+
// @Tags Attestations
5153
// @Security CookieAuth
52-
// @Security ApiKeyAuth
54+
// @Security PATAuth
5355
// @Param body body object true "Attestation content"
5456
// @Param X-Asset-Ref header string false "Asset version name"
5557
// @Param X-Artifact-Name header string false "Artifact name"

controllers/csaf_controller.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ func NewCSAFController(dependencyVulnRepository shared.DependencyVulnRepository,
5050
}
5151

5252
// @Summary Get CSAF index file
53+
// @Tags CSAF
5354
// @Security CookieAuth
54-
// @Security ApiKeyAuth
55+
// @Security PATAuth
5556
// @Param organization path string true "Organization slug"
5657
// @Param projectSlug path string true "Project slug"
5758
// @Param assetSlug path string true "Asset slug"
@@ -79,8 +80,9 @@ func (controller *CSAFController) GetIndexFile(ctx shared.Context) error {
7980
}
8081

8182
// @Summary Get CSAF changes CSV
83+
// @Tags CSAF
8284
// @Security CookieAuth
83-
// @Security ApiKeyAuth
85+
// @Security PATAuth
8486
// @Param organization path string true "Organization slug"
8587
// @Param projectSlug path string true "Project slug"
8688
// @Param assetSlug path string true "Asset slug"
@@ -339,6 +341,7 @@ func (controller *CSAFController) GetOpenPGPFile(ctx shared.Context) error {
339341
}
340342

341343
// @Summary Get CSAF aggregator metadata
344+
// @Tags CSAF
342345
// @Success 200 {object} object
343346
// @Router /.well-known/csaf-aggregator/aggregator.json [get]
344347
func (controller *CSAFController) GetAggregatorJSON(ctx shared.Context) error {
@@ -409,8 +412,9 @@ func (controller *CSAFController) GetAggregatorJSON(ctx shared.Context) error {
409412
}
410413

411414
// @Summary Get CSAF provider metadata for organization
415+
// @Tags CSAF
412416
// @Security CookieAuth
413-
// @Security ApiKeyAuth
417+
// @Security PATAuth
414418
// @Param organization path string true "Organization slug"
415419
// @Success 200 {object} object
416420
// @Router /organizations/{organization}/csaf/provider-metadata.json [get]
@@ -469,8 +473,9 @@ func getPublicKeyFingerprint() string {
469473
// from here on: code that handles the creation of csaf reports them self
470474

471475
// @Summary Get CSAF report
476+
// @Tags CSAF
472477
// @Security CookieAuth
473-
// @Security ApiKeyAuth
478+
// @Security PATAuth
474479
// @Param organization path string true "Organization slug"
475480
// @Param projectSlug path string true "Project slug"
476481
// @Param assetSlug path string true "Asset slug"

controllers/dependency_vuln_controller.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,9 @@ func (controller DependencyVulnController) ListByAssetIDWithoutHandledExternalEv
127127
}
128128

129129
// @Summary List dependency vulnerabilities
130+
// @Tags Vulnerabilities
130131
// @Security CookieAuth
131-
// @Security ApiKeyAuth
132+
// @Security PATAuth
132133
// @Param organization path string true "Organization slug"
133134
// @Param projectSlug path string true "Project slug"
134135
// @Param assetSlug path string true "Asset slug"
@@ -250,8 +251,9 @@ func (controller DependencyVulnController) Mitigate(ctx shared.Context) error {
250251
}
251252

252253
// @Summary Get dependency vulnerability details
254+
// @Tags Vulnerabilities
253255
// @Security CookieAuth
254-
// @Security ApiKeyAuth
256+
// @Security PATAuth
255257
// @Param organization path string true "Organization slug"
256258
// @Param projectSlug path string true "Project slug"
257259
// @Param assetSlug path string true "Asset slug"
@@ -366,8 +368,9 @@ func (controller DependencyVulnController) SyncDependencyVulns(ctx shared.Contex
366368
}
367369

368370
// @Summary Create vulnerability event
371+
// @Tags Vulnerabilities
369372
// @Security CookieAuth
370-
// @Security ApiKeyAuth
373+
// @Security PATAuth
371374
// @Param organization path string true "Organization slug"
372375
// @Param projectSlug path string true "Project slug"
373376
// @Param assetSlug path string true "Asset slug"

controllers/first_party_vuln_controller.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ func NewFirstPartyVulnController(firstPartyVulnRepository shared.FirstPartyVulnR
3535
}
3636

3737
// @Summary List first-party vulnerabilities by organization
38+
// @Tags Vulnerabilities
3839
// @Security CookieAuth
39-
// @Security ApiKeyAuth
40+
// @Security PATAuth
4041
// @Param organization path string true "Organization slug"
4142
// @Param search query string false "Search term"
4243
// @Success 200 {object} object
@@ -69,8 +70,9 @@ func (c FirstPartyVulnController) ListByOrgPaged(ctx shared.Context) error {
6970
}
7071

7172
// @Summary List first-party vulnerabilities by project
73+
// @Tags Vulnerabilities
7274
// @Security CookieAuth
73-
// @Security ApiKeyAuth
75+
// @Security PATAuth
7476
// @Param organization path string true "Organization slug"
7577
// @Param projectSlug path string true "Project slug"
7678
// @Param search query string false "Search term"
@@ -131,8 +133,9 @@ func (c FirstPartyVulnController) Mitigate(ctx shared.Context) error {
131133
}
132134

133135
// @Summary Get first-party vulnerability details
136+
// @Tags Vulnerabilities
134137
// @Security CookieAuth
135-
// @Security ApiKeyAuth
138+
// @Security PATAuth
136139
// @Param vulnID path string true "Vulnerability ID"
137140
// @Success 200 {object} dtos.DetailedFirstPartyVulnDTO
138141
// @Router /vulns/{vulnID} [get]
@@ -150,8 +153,9 @@ func (c FirstPartyVulnController) Read(ctx shared.Context) error {
150153
return ctx.JSON(200, convertFirstPartyVulnToDetailedDTO(firstPartyVuln))
151154
}
152155
// @Summary Create first-party vulnerability event
156+
// @Tags Vulnerabilities
153157
// @Security CookieAuth
154-
// @Security ApiKeyAuth
158+
// @Security PATAuth
155159
// @Param vulnID path string true "Vulnerability ID"
156160
// @Param body body object true "Event data"
157161
// @Success 200 {object} dtos.DetailedFirstPartyVulnDTO
@@ -204,8 +208,9 @@ func (c FirstPartyVulnController) CreateEvent(ctx shared.Context) error {
204208
}
205209

206210
// @Summary List first-party vulnerabilities by asset version
211+
// @Tags Vulnerabilities
207212
// @Security CookieAuth
208-
// @Security ApiKeyAuth
213+
// @Security PATAuth
209214
// @Param organization path string true "Organization slug"
210215
// @Param projectSlug path string true "Project slug"
211216
// @Param assetSlug path string true "Asset slug"
@@ -237,8 +242,9 @@ func (c FirstPartyVulnController) ListPaged(ctx shared.Context) error {
237242
}
238243

239244
// @Summary Get first-party vulnerabilities as SARIF
245+
// @Tags Vulnerabilities
240246
// @Security CookieAuth
241-
// @Security ApiKeyAuth
247+
// @Security PATAuth
242248
// @Param organization path string true "Organization slug"
243249
// @Param projectSlug path string true "Project slug"
244250
// @Param assetSlug path string true "Asset slug"

controllers/integration_controller.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ func (c *IntegrationController) AutoSetup(ctx shared.Context) error {
4646
}
4747

4848
// @Summary List repositories from integrations
49+
// @Tags Integrations
4950
// @Security CookieAuth
50-
// @Security ApiKeyAuth
51+
// @Security PATAuth
5152
// @Success 200 {array} object
5253
// @Router /integrations/repositories [get]
5354
func (c *IntegrationController) ListRepositories(ctx shared.Context) error {
@@ -115,6 +116,7 @@ func (c *IntegrationController) TestAndSaveJiraIntegration(ctx shared.Context) e
115116
}
116117

117118
// @Summary GitLab OAuth2 callback
119+
// @Tags Integrations
118120
// @Security CookieAuth
119121
// @Param integrationName path string true "Integration name"
120122
// @Success 200
@@ -138,6 +140,7 @@ func (c *IntegrationController) GitLabOauth2Callback(ctx shared.Context) error {
138140
}
139141

140142
// @Summary GitLab OAuth2 login
143+
// @Tags Integrations
141144
// @Security CookieAuth
142145
// @Param integrationName path string true "Integration name"
143146
// @Success 200

0 commit comments

Comments
 (0)