Skip to content

Commit

Permalink
Revisit Scan API model to allow for ScanConfig expand, snapshot and s…
Browse files Browse the repository at this point in the history
…ummary
  • Loading branch information
Tehsmash committed Mar 1, 2023
1 parent 71ccfc9 commit 291a9af
Show file tree
Hide file tree
Showing 14 changed files with 554 additions and 161 deletions.
104 changes: 96 additions & 8 deletions api/models/models.gen.go

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

119 changes: 108 additions & 11 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -540,17 +540,63 @@ components:
endTime:
type: string
format: date-time
scanConfigId:
description: The ID of the config that this scan was initiated from (optionanl)
type: string
scanFamiliesConfig:
# The configuration as it was in the config when the scan was created
$ref: '#/components/schemas/ScanFamiliesConfig'
scanConfig:
$ref: '#/components/schemas/ScanConfigRelationship'
scanConfigSnapshot:
$ref: '#/components/schemas/ScanConfigData'
targetIDs:
description: List of target IDs that are targeted for scanning as part of this scan
type: array
items:
type: string
state:
description: The lifecycle state of this scan.
type: string
enum:
- Pending
- Discovered
- InProgress
- Failed
- Done
stateMessage:
description: Human-readable message indicating details about the last state transition.
type: string
stateReason:
description: Machine-readable, UpperCamelCase text indicating the reason for the condition's last transition.
type: string
enum:
- Aborted
- TimedOut
- OneOrMoreTargetFailedToScan
- DiscoveryFailed
- Unexpected
- NothingToScan
- Success
summary:
$ref: '#/components/schemas/ScanSummary'

ScanSummary:
description: A summary of the progress of a scan for informational purposes.
type: object
properties:
jobsLeftToRun:
type: integer
jobsCompleted:
type: integer
totalPackages:
type: integer
totalExploits:
type: integer
totalMalware:
type: integer
totalMisconfigurations:
type: integer
totalRootkits:
type: integer
totalSecrets:
type: integer
totalVulnerabilities:
type: integer

ScanExists:
type: object
Expand Down Expand Up @@ -640,13 +686,13 @@ components:
required:
- total

ScanConfig:
ScanConfigData:
type: object
description: Describes a multi-target scheduled scan config.
description: |
Fields for a ScanConfig so they can be shared between the ScanConfig,
ScanConfigRelationship and used for the ScanConfig snapshot in the
scan.
properties:
id:
type: string
readOnly: true
name:
type: string
scanFamiliesConfig:
Expand All @@ -656,6 +702,36 @@ components:
scheduled:
$ref: '#/components/schemas/RuntimeScheduleScanConfigType'

ScanConfigRelationship:
type: object
description: Describes a relationship to a scan config which can be expanded.
allOf:
- $ref: '#/components/schemas/ScanConfigData'
- type: object
properties:
id:
type: string
name:
readOnly: true
scanFamiliesConfig:
readOnly: true
scope:
readOnly: true
scheduled:
readOnly: true
required: ['id']

ScanConfig:
type: object
description: Describes a multi-target scheduled scan config.
allOf:
- $ref: '#/components/schemas/ScanConfigData'
- type: object
properties:
id:
type: string
readOnly: true

ScanConfigExists:
type: object
properties:
Expand Down Expand Up @@ -964,10 +1040,31 @@ components:
$ref: '#/components/schemas/MisconfigurationScan'
exploits:
$ref: '#/components/schemas/ExploitScan'
summary:
$ref: '#/components/schemas/TargetScanResultSummary'
required:
- targetId
- scanId

TargetScanResultSummary:
description: A summary of target scan result for informational purposes.
type: object
properties:
totalPackages:
type: integer
totalExploits:
type: integer
totalMalware:
type: integer
totalMisconfigurations:
type: integer
totalRootkits:
type: integer
totalSecrets:
type: integer
totalVulnerabilities:
type: integer

TargetScanResultExists:
type: object
properties:
Expand Down
Loading

0 comments on commit 291a9af

Please sign in to comment.