Skip to content

Commit

Permalink
SSH topology api backend (#623)
Browse files Browse the repository at this point in the history
* update api to include new info finder family findings and scan config

* update api to include new info finder family findings and scan config

* update backend logic

* temp update ui to enabled info finder scan type

* fix compilation

* add missing handling in assetscanprocessor

* add missing wait group to wait for the channel processing in the ssh topology scanner

* fixing InfoFinderKey

* fix unit test

* remove unused arg in withInfoFinderConfig

* avoid converting nil results

* fix typos in error prints

* add demo data

* make linter happy

* add unit tests

* fix print under assetscanprocessor families

* add description and example for data under InfoFinderInfo

* add missing license header
  • Loading branch information
FrimIdan committed Sep 5, 2023
1 parent e34d684 commit cec6d1f
Show file tree
Hide file tree
Showing 29 changed files with 1,094 additions and 122 deletions.
12 changes: 12 additions & 0 deletions api/models/families.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,15 @@ func (c *ExploitsConfig) GetScannersList() []string {

return []string{"exploitdb"}
}

func (c *InfoFinderConfig) IsEnabled() bool {
return c != nil && c.Enabled != nil && *c.Enabled
}

func (c *InfoFinderConfig) GetScannersList() []string {
if c != nil && c.Scanners != nil && len(*c.Scanners) != 0 {
return *c.Scanners
}

return []string{"sshTopology"}
}
95 changes: 90 additions & 5 deletions api/models/models.gen.go

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

76 changes: 76 additions & 0 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,8 @@ components:
type: integer
totalSecrets:
type: integer
totalInfoFinder:
type: integer
totalVulnerabilities:
$ref: '#/components/schemas/VulnerabilityScanSummary'

Expand Down Expand Up @@ -1215,6 +1217,18 @@ components:
$ref: '#/components/schemas/MisconfigurationsConfig'
exploits:
$ref: '#/components/schemas/ExploitsConfig'
infoFinder:
$ref: '#/components/schemas/InfoFinderConfig'

InfoFinderConfig:
type: object
properties:
enabled:
type: boolean
scanners:
type: array
items:
type: string

VulnerabilitiesConfig:
type: object
Expand Down Expand Up @@ -1732,6 +1746,8 @@ components:
$ref: '#/components/schemas/MisconfigurationScan'
exploits:
$ref: '#/components/schemas/ExploitScan'
infoFinder:
$ref: '#/components/schemas/InfoFinderScan'
findingsProcessed:
type: boolean
resourceCleanup:
Expand Down Expand Up @@ -1786,6 +1802,10 @@ components:
type: array
items:
$ref: '#/components/schemas/AssetScanInputScanStats'
infoFinder:
type: array
items:
$ref: '#/components/schemas/AssetScanInputScanStats'

AssetScanTemplateReadOnly:
type: object
Expand Down Expand Up @@ -1844,6 +1864,9 @@ components:
exploits:
$ref: '#/components/schemas/ExploitScan'
readOnly: true
infoFinder:
$ref: '#/components/schemas/InfoFinderScan'
readOnly: true
findingsProcessed:
type: boolean
readOnly: true
Expand Down Expand Up @@ -1922,6 +1945,8 @@ components:
$ref: '#/components/schemas/AssetScanState'
exploits:
$ref: '#/components/schemas/AssetScanState'
infoFinder:
$ref: '#/components/schemas/AssetScanState'

AssetScanState:
type: object
Expand Down Expand Up @@ -2237,6 +2262,44 @@ components:
$ref: '#/components/schemas/Misconfiguration'
nullable: true

InfoFinderScan:
type: object
properties:
scanners:
type: array
items:
type: string
nullable: true
infos:
type: array
items:
$ref: '#/components/schemas/InfoFinderInfo'
nullable: true

InfoFinderInfo:
type: object
properties:
scannerName:
type: string
type:
$ref: '#/components/schemas/InfoType'
path:
type: string
description: "File path containing the info"
data:
type: string
description: "The data found by the scanner in the specific path for a specific type. See example for SSHKnownHostFingerprint info type"
example: "2048 SHA256:YQuPOM8ld6FOA9HbKCgkCJWHuGt4aTRD7hstjJpRhxc xxxx (RSA)"

InfoType:
type: string
enum:
- SSHKnownHostFingerprint
- SSHAuthorizedKeyFingerprint
- SSHPrivateKeyFingerprint
- SSHDaemonKeyFingerprint
- UNKNOWN

ExploitScan:
type: object
properties:
Expand Down Expand Up @@ -2268,6 +2331,7 @@ components:
- MISCONFIGURATION
- ROOTKIT
- EXPLOIT
- INFOFINDER

FindingExists:
type: object
Expand Down Expand Up @@ -2361,6 +2425,16 @@ components:
type: string
required: [objectType]

InfoFinderFindingInfo:
type: object
allOf:
- $ref: '#/components/schemas/InfoFinderInfo'
- type: object
properties:
objectType:
type: string
required: [ objectType ]

Finding:
type: object
properties:
Expand Down Expand Up @@ -2396,6 +2470,7 @@ components:
- $ref: '#/components/schemas/MisconfigurationFindingInfo'
- $ref: '#/components/schemas/RootkitFindingInfo'
- $ref: '#/components/schemas/ExploitFindingInfo'
- $ref: '#/components/schemas/InfoFinderFindingInfo'
discriminator:
propertyName: objectType
mapping:
Expand All @@ -2406,6 +2481,7 @@ components:
Misconfiguration: '#/components/schemas/MisconfigurationFindingInfo'
Rootkit: '#/components/schemas/RootkitFindingInfo'
Exploit: '#/components/schemas/ExploitFindingInfo'
InfoFinder: '#/components/schemas/InfoFinderFindingInfo'

responses:
Success:
Expand Down
Loading

0 comments on commit cec6d1f

Please sign in to comment.