Skip to content

Commit 05057cd

Browse files
authored
feat: add additional containers to interact with (#462)
* feat: add additional containers to interact with * add helper function that returns all availabl sensor types * removed KPA, fixed shra uri, and added transformation changes
1 parent a7f10dd commit 05057cd

File tree

2 files changed

+95
-37
lines changed

2 files changed

+95
-37
lines changed

falcon/containers.go

+16-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ import (
77
type SensorType string
88

99
const (
10-
SidecarSensor SensorType = "falcon-container"
11-
ImageSensor SensorType = "falcon-imageanalyzer"
12-
KacSensor SensorType = "falcon-kac"
13-
NodeSensor SensorType = "falcon-sensor"
10+
SidecarSensor SensorType = "falcon-container"
11+
ImageSensor SensorType = "falcon-imageanalyzer"
12+
KacSensor SensorType = "falcon-kac"
13+
NodeSensor SensorType = "falcon-sensor"
14+
Snapshot SensorType = "falcon-snapshot"
15+
FCSCli SensorType = "fcs"
16+
SHRAController SensorType = "falcon-jobcontroller"
17+
SHRAExecutor SensorType = "falcon-registryassessmentexecutor"
1418
)
1519

1620
// FalconContainerUploadURI parses cloud string (example: us-1, us-2, eu-1, us-gov-1, etc) and returns a URI for uploading a container image for ImageAssessment.
@@ -44,6 +48,14 @@ func FalconContainerSensorImageURI(falconCloud CloudType, sensorType SensorType)
4448
return fmt.Sprintf("%s/falcon-kac/%s/release/falcon-kac", registryFQDN(falconCloud), registryCloud(falconCloud))
4549
case NodeSensor:
4650
return fmt.Sprintf("%s/falcon-sensor/%s/release/falcon-sensor", registryFQDN(falconCloud), registryCloud(falconCloud))
51+
case Snapshot:
52+
return fmt.Sprintf("%s/falcon-snapshot/%s/release/cs-snapshotscanner", registryFQDN(falconCloud), registryCloud(falconCloud))
53+
case FCSCli:
54+
return fmt.Sprintf("%s/fcs/%s/release/cs-fcs", registryFQDN(falconCloud), registryCloud(falconCloud))
55+
case SHRAController:
56+
return fmt.Sprintf("%s/falcon-selfhostedregistryassessment/release/falcon-jobcontroller", registryFQDN(falconCloud))
57+
case SHRAExecutor:
58+
return fmt.Sprintf("%s/falcon-selfhostedregistryassessment/release/falcon-registryassessmentexecutor", registryFQDN(falconCloud))
4759
default:
4860
return fmt.Sprintf("%s/falcon-sensor/%s/release/falcon-sensor", registryFQDN(falconCloud), registryCloud(falconCloud))
4961
}

specs/transformation.jq

+79-33
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
# Add response code "202" to "/devices/entities/devices/tags/v1" endpoint
4040
| .paths."/devices/entities/devices/tags/v1".patch.responses."202" = .paths."/devices/entities/devices/tags/v1".patch.responses."200"
41-
41+
4242

4343
# CGP should be Gcp
4444
| .paths."/cloud-connect-gcp/entities/account/v1".get.operationId = "GetD4CGcpAccount"
@@ -49,14 +49,14 @@
4949
# looks like spotlight is staying to reverting it again... keeping this code incase it can be used some other time.
5050
# | walk(
5151
# if type == "object" and .tags and (.tags | index("spotlight-vulnerabilities")) then
52-
# .tags |= map(gsub("spotlight-vulnerabilities"; "vulnerabilities"))
52+
# .tags |= map(gsub("spotlight-vulnerabilities"; "vulnerabilities"))
5353
# elif type == "object" and .tags and (.tags | index("spotlight-evaluation-logic")) then
54-
# .tags |= map(gsub("spotlight-evaluation-logic"; "vulnerabilities-evaluation-logic"))
55-
# else
54+
# .tags |= map(gsub("spotlight-evaluation-logic"; "vulnerabilities-evaluation-logic"))
55+
# else
5656
# .
5757
# end
5858
# )
59-
59+
6060
# Revert msaspec.QueryResponse back to msa.QueryResponse for falconcomplete-dashboard
6161
| if .paths."/falcon-complete-dashboards/queries/alerts/v1".get.responses."200".schema."$ref" = "#/definitions/msaspec.QueryResponse" then .paths."/falcon-complete-dashboards/queries/alerts/v1".get.responses."200".schema |= {"$ref": "#/definitions/msa.QueryResponse"} else . end
6262
| if .paths."/falcon-complete-dashboards/queries/devicecount-collections/v1".get.responses."200".schema."$ref" = "#/definitions/msaspec.QueryResponse" then .paths."/falcon-complete-dashboards/queries/devicecount-collections/v1".get.responses."200".schema |= {"$ref": "#/definitions/msa.QueryResponse"} else . end
@@ -68,43 +68,43 @@
6868
| if .paths."/falcon-complete-dashboards/queries/remediations/v1".get.responses."200".schema."$ref" = "#/definitions/msaspec.QueryResponse" then .paths."/falcon-complete-dashboards/queries/remediations/v1".get.responses."200".schema |= {"$ref": "#/definitions/msa.QueryResponse"} else . end
6969

7070
# Revert changes.GetChangesResponse back to public.GetChangesResponse for filevantage
71-
| if .paths."/filevantage/entities/changes/v2".get.responses."200".schema."$ref" = "#/definitions/changes.GetChangesResponse" then
72-
.paths."/filevantage/entities/changes/v2".get.responses."200".schema = {"$ref": "#/definitions/public.GetChangesResponse"}
73-
|.definitions."public.GetChangesResponse" = .definitions."changes.GetChangesResponse"
71+
| if .paths."/filevantage/entities/changes/v2".get.responses."200".schema."$ref" = "#/definitions/changes.GetChangesResponse" then
72+
.paths."/filevantage/entities/changes/v2".get.responses."200".schema = {"$ref": "#/definitions/public.GetChangesResponse"}
73+
|.definitions."public.GetChangesResponse" = .definitions."changes.GetChangesResponse"
7474
|del(.definitions."changes.GetChangesResponse") else . end
7575

7676
# Make message-center use consistent return type
77-
| if .paths."/message-center/aggregates/cases/GET/v1".post.responses."403".schema."$ref" = "#/definitions/msa.ReplyMetaOnly" then
78-
.paths."/message-center/aggregates/cases/GET/v1".post.responses."403".schema = {"$ref": "#/definitions/msaspec.ResponseFields"}
79-
else . end
77+
| if .paths."/message-center/aggregates/cases/GET/v1".post.responses."403".schema."$ref" = "#/definitions/msa.ReplyMetaOnly" then
78+
.paths."/message-center/aggregates/cases/GET/v1".post.responses."403".schema = {"$ref": "#/definitions/msaspec.ResponseFields"}
79+
else . end
8080

8181
# Custom Storage "custom-type" rename
8282
| .definitions."CustomStorageObjectKeys" = .definitions."CustomType_1255839303"
8383
| del(.definitions."CustomType_1255839303")
84-
| if .paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects".get.responses."200".schema."$ref" = "#/definitions/CustomType_1255839303" then
85-
.paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects".get.responses."200".schema = {"$ref": "#/definitions/CustomStorageObjectKeys"} else . end
86-
| if .paths."/customobjects/v1/collections/{collection_name}/objects".get.responses."200".schema."$ref" = "#/definitions/CustomType_1255839303" then
87-
.paths."/customobjects/v1/collections/{collection_name}/objects".get.responses."200".schema = {"$ref": "#/definitions/CustomStorageObjectKeys"} else . end
84+
| if .paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects".get.responses."200".schema."$ref" = "#/definitions/CustomType_1255839303" then
85+
.paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects".get.responses."200".schema = {"$ref": "#/definitions/CustomStorageObjectKeys"} else . end
86+
| if .paths."/customobjects/v1/collections/{collection_name}/objects".get.responses."200".schema."$ref" = "#/definitions/CustomType_1255839303" then
87+
.paths."/customobjects/v1/collections/{collection_name}/objects".get.responses."200".schema = {"$ref": "#/definitions/CustomStorageObjectKeys"} else . end
8888

8989
| .definitions."CustomStorageResponse" = .definitions."CustomType_3191042536"
9090
| del(.definitions."CustomType_3191042536")
91-
| if .paths."/customobjects/v1/collections/{collection_name}/objects".post.responses."200".schema."$ref" = "#/definitions/CustomType_3191042536" then
91+
| if .paths."/customobjects/v1/collections/{collection_name}/objects".post.responses."200".schema."$ref" = "#/definitions/CustomType_3191042536" then
9292
.paths."/customobjects/v1/collections/{collection_name}/objects".post.responses."200".schema = {"$ref": "#/definitions/CustomStorageResponse"} else . end
93-
| if .paths."/customobjects/v1/collections/{collection_name}/objects/{object_key}".put.responses."200".schema."$ref" = "#/definitions/CustomType_3191042536" then
94-
.paths."/customobjects/v1/collections/{collection_name}/objects/{object_key}".put.responses."200".schema = {"$ref": "#/definitions/CustomStorageResponse"} else . end
95-
| if .paths."/customobjects/v1/collections/{collection_name}/objects/{object_key}".delete.responses."200".schema."$ref" = "#/definitions/CustomType_3191042536" then
96-
.paths."/customobjects/v1/collections/{collection_name}/objects/{object_key}".delete.responses."200".schema = {"$ref": "#/definitions/CustomStorageResponse"} else . end
97-
| if .paths."/customobjects/v1/collections/{collection_name}/objects/{object_key}/metadata".get.responses."200".schema."$ref" = "#/definitions/CustomType_3191042536" then
98-
.paths."/customobjects/v1/collections/{collection_name}/objects/{object_key}/metadata".get.responses."200".schema = {"$ref": "#/definitions/CustomStorageResponse"} else . end
99-
| if .paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects".post.responses."200".schema."$ref" = "#/definitions/CustomType_3191042536" then
100-
.paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects".post.responses."200".schema = {"$ref": "#/definitions/CustomStorageResponse"} else . end
101-
| if .paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects/{object_key}".put.responses."200".schema."$ref" = "#/definitions/CustomType_3191042536" then
102-
.paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects/{object_key}".put.responses."200".schema = {"$ref": "#/definitions/CustomStorageResponse"} else . end
103-
| if .paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects/{object_key}".delete.responses."200".schema."$ref" = "#/definitions/CustomType_3191042536" then
104-
.paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects/{object_key}".delete.responses."200".schema = {"$ref": "#/definitions/CustomStorageResponse"} else . end
105-
| if .paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects/{object_key}/metadata".get.responses."200".schema."$ref" = "#/definitions/CustomType_3191042536" then
106-
.paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects/{object_key}/metadata".get.responses."200".schema = {"$ref": "#/definitions/CustomStorageResponse"} else . end
107-
93+
| if .paths."/customobjects/v1/collections/{collection_name}/objects/{object_key}".put.responses."200".schema."$ref" = "#/definitions/CustomType_3191042536" then
94+
.paths."/customobjects/v1/collections/{collection_name}/objects/{object_key}".put.responses."200".schema = {"$ref": "#/definitions/CustomStorageResponse"} else . end
95+
| if .paths."/customobjects/v1/collections/{collection_name}/objects/{object_key}".delete.responses."200".schema."$ref" = "#/definitions/CustomType_3191042536" then
96+
.paths."/customobjects/v1/collections/{collection_name}/objects/{object_key}".delete.responses."200".schema = {"$ref": "#/definitions/CustomStorageResponse"} else . end
97+
| if .paths."/customobjects/v1/collections/{collection_name}/objects/{object_key}/metadata".get.responses."200".schema."$ref" = "#/definitions/CustomType_3191042536" then
98+
.paths."/customobjects/v1/collections/{collection_name}/objects/{object_key}/metadata".get.responses."200".schema = {"$ref": "#/definitions/CustomStorageResponse"} else . end
99+
| if .paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects".post.responses."200".schema."$ref" = "#/definitions/CustomType_3191042536" then
100+
.paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects".post.responses."200".schema = {"$ref": "#/definitions/CustomStorageResponse"} else . end
101+
| if .paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects/{object_key}".put.responses."200".schema."$ref" = "#/definitions/CustomType_3191042536" then
102+
.paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects/{object_key}".put.responses."200".schema = {"$ref": "#/definitions/CustomStorageResponse"} else . end
103+
| if .paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects/{object_key}".delete.responses."200".schema."$ref" = "#/definitions/CustomType_3191042536" then
104+
.paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects/{object_key}".delete.responses."200".schema = {"$ref": "#/definitions/CustomStorageResponse"} else . end
105+
| if .paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects/{object_key}/metadata".get.responses."200".schema."$ref" = "#/definitions/CustomType_3191042536" then
106+
.paths."/customobjects/v1/collections/{collection_name}/{collection_version}/objects/{object_key}/metadata".get.responses."200".schema = {"$ref": "#/definitions/CustomStorageResponse"} else . end
107+
108108
# Better operationId for workflows collection
109109
| .paths."/workflows/entities/execute/v1".post.operationId = "Execute"
110110
| .paths."/workflows/entities/execution-actions/v1".post.operationId = "ExecutionAction"
@@ -123,7 +123,7 @@
123123
| .paths."/loggingapi/entities/saved-searches/job-results-download/v1".get.operationId = "DownloadResults"
124124
| .paths."/loggingapi/entities/views/v1".get.operationId = "ListViews"
125125

126-
# Better operationId for custom-storage collection
126+
# Better operationId for custom-storage collection
127127
| .paths."/customobjects/v1/collections/{collection_name}/objects".get.operationId = "list"
128128
| .paths."/customobjects/v1/collections/{collection_name}/objects".post.operationId = "search"
129129
| .paths."/customobjects/v1/collections/{collection_name}/objects/{object_key}".get.operationId = "get"
@@ -546,7 +546,53 @@
546546
}
547547
}
548548

549-
# Prevent unnecessary renaming
549+
# Add new credential definitions for nested response structure
550+
| .definitions."common.Credentials" = {
551+
"type": "object",
552+
"properties": {
553+
"meta": {
554+
"$ref": "#/definitions/msa.MetaInfo"
555+
},
556+
"resources": {
557+
"type": "object",
558+
"properties": {
559+
"token": {
560+
"type": "string"
561+
}
562+
},
563+
"required": ["token"]
564+
},
565+
"errors": {
566+
"type": "array",
567+
"items": {
568+
"$ref": "#/definitions/msa.APIError"
569+
}
570+
}
571+
}
572+
}
573+
| .definitions."common.RegistryCredentialsResponse" = {
574+
"required": [
575+
"errors",
576+
"meta",
577+
"resources"
578+
],
579+
"properties": {
580+
"errors": {
581+
"type": "array",
582+
"items": {
583+
"$ref": "#/definitions/msa.APIError"
584+
}
585+
},
586+
"meta": {
587+
"$ref": "#/definitions/msa.MetaInfo"
588+
},
589+
"resources": {
590+
"$ref": "#/definitions/common.Credentials"
591+
}
592+
}
593+
}
594+
595+
# Prevent unnecessary renaming
550596
| .paths."/snapshots/entities/image-registry-credentials/v1".get.operationId = "GetCredentialsMixin0Mixin60"
551597
| .paths."/falconx/queries/submissions/v1".get.operationId = "QuerySubmissions"
552598
| .paths."/scanner/queries/scans/v1".get.operationId = "QuerySubmissionsMixin0"

0 commit comments

Comments
 (0)