Skip to content

Commit 72f592e

Browse files
committed
Add: get scan preference to scanner API specification
1 parent fc30c99 commit 72f592e

File tree

2 files changed

+143
-24
lines changed

2 files changed

+143
-24
lines changed

rust/doc/openapi.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,23 @@ paths:
195195
"400":
196196
description: "Bad Request body"
197197

198+
/scans/preferences:
199+
get:
200+
description: "Get all preferences available for a scan. These can be set, when creating a scan via scan_preferences."
201+
operationId: "get_preferences"
202+
tags:
203+
- "scan"
204+
responses:
205+
"200":
206+
description: "Get Preferences"
207+
content:
208+
application/json:
209+
schema:
210+
$ref: "#/components/schemas/Preferences"
211+
examples:
212+
preferences:
213+
$ref: "#/components/examples/preferences"
214+
198215
/scans/{id}:
199216
get:
200217
description: "Get a scan from the scan manager."
@@ -869,6 +886,30 @@ components:
869886
required:
870887
- "action"
871888

889+
Preferences:
890+
description: "List of preferences available"
891+
type: "array"
892+
items:
893+
type: "object"
894+
properties:
895+
id:
896+
description: "ID of the preference"
897+
type: "string"
898+
type:
899+
description: "Type of the preference"
900+
name:
901+
description: "Display name for the preference"
902+
type: "string"
903+
description:
904+
description: "Description of the preference"
905+
type: "string"
906+
default:
907+
description: "Default value for scans"
908+
type: "string"
909+
values:
910+
description: "Allowed values"
911+
type: "string"
912+
872913
examples:
873914
scan_simple:
874915
description: "A simple example for creating a scan."
@@ -1249,3 +1290,21 @@ components:
12491290
],
12501291
},
12511292
]
1293+
1294+
preferences:
1295+
description: "A example with a list of preferences"
1296+
value:
1297+
[
1298+
{
1299+
"id": "optimize_test",
1300+
"name": "Optimize Test",
1301+
"default": true,
1302+
"description": "By default, optimize_test is enabled which means openvas does trust the remote host banners and is only launching plugins against the services they have been designed to check. For example it will check a web server claiming to be IIS only for IIS related flaws but will skip plugins testing for Apache flaws, and so on. This default behavior is used to optimize the scanning performance and to avoid false positives. If you are not sure that the banners of the remote host have been tampered with, you can disable this option.",
1303+
},
1304+
{
1305+
"id": "plugins_timeout",
1306+
"name": "Plugins Timeout",
1307+
"default": 5,
1308+
"description": "This is the maximum lifetime, in seconds of a plugin. It may happen that some plugins are slow because of the way they are written or the way the remote server behaves. This option allows you to make sure your scan is never caught in an endless loop because of a non-finishing plugin. Doesn't affect ACT_SCANNER plugins, use 'ACT_SCANNER plugins timeout' for them instead.",
1309+
},
1310+
]

rust/doc/reverse-sensor-openapi.yml

Lines changed: 84 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,27 @@ paths:
8989
get_actions:
9090
$ref: "#/components/examples/scan_actions"
9191

92+
/scans/preferences:
93+
get:
94+
description: "Get all preferences available for a scan. These can be set, when creating a scan via scan_preferences."
95+
operationId: "get_preferences"
96+
tags:
97+
- "scan"
98+
requestBody:
99+
description: "Get Preferences"
100+
content:
101+
application/json:
102+
schema:
103+
$ref: "#/components/schemas/Preferences"
104+
examples:
105+
preferences:
106+
$ref: "#/components/examples/preferences"
107+
responses:
108+
"204":
109+
description: "Scan Preferences received"
110+
"400":
111+
description: "Bad request"
112+
92113
/scans/{id}:
93114
get:
94115
description: "Get a scan from the scan manager."
@@ -152,22 +173,22 @@ paths:
152173
parameters:
153174
- $ref: "#/components/parameters/ScanID"
154175
requestBody:
155-
description: "The new status"
156-
content:
157-
application/json:
176+
description: "The new status"
177+
content:
178+
application/json:
179+
schema:
180+
$ref: "#/components/schemas/Status"
181+
examples:
158182
schema:
159-
$ref: "#/components/schemas/Status"
160-
examples:
161-
schema:
162-
description: "Schema of a status response."
163-
status of a stored scan:
164-
$ref: "#/components/examples/scan_status_stored"
165-
status of a running scan:
166-
$ref: "#/components/examples/scan_status_running"
167-
status of a succeeded scan:
168-
$ref: "#/components/examples/scan_status_success"
169-
status of a failed scan:
170-
$ref: "#/components/examples/scan_status_fail"
183+
description: "Schema of a status response."
184+
status of a stored scan:
185+
$ref: "#/components/examples/scan_status_stored"
186+
status of a running scan:
187+
$ref: "#/components/examples/scan_status_running"
188+
status of a succeeded scan:
189+
$ref: "#/components/examples/scan_status_success"
190+
status of a failed scan:
191+
$ref: "#/components/examples/scan_status_fail"
171192
responses:
172193
"204":
173194
description: "Status received"
@@ -573,14 +594,34 @@ components:
573594
items:
574595
$ref: "#/components/schemas/ScanAction"
575596

597+
Preferences:
598+
description: "List of preferences available"
599+
type: "array"
600+
items:
601+
type: "object"
602+
properties:
603+
id:
604+
description: "ID of the preference"
605+
type: "string"
606+
type:
607+
description: "Type of the preference"
608+
name:
609+
description: "Display name for the preference"
610+
type: "string"
611+
description:
612+
description: "Description of the preference"
613+
type: "string"
614+
default:
615+
description: "Default value for scans"
616+
type: "string"
617+
values:
618+
description: "Allowed values"
619+
type: "string"
576620

577621
examples:
578622
sensor_simple:
579623
description: "A simple example for sensor."
580-
value:
581-
{
582-
"sensor_id": "6c591f83-8f7b-452a-8c78-ba35779e682f"
583-
}
624+
value: { "sensor_id": "6c591f83-8f7b-452a-8c78-ba35779e682f" }
584625
scan_simple:
585626
description: "A simple example for creating a scan."
586627
value:
@@ -677,19 +718,20 @@ components:
677718
value: "6c591f83-8f7b-452a-8c78-ba35779e682f"
678719
scan_actions:
679720
description: "Actions to perform"
680-
value: [
721+
value:
722+
[
681723
{
682724
"scan_id": "6c591f83-8f7b-452a-8c78-ba35779e682f",
683-
"action": "start"
725+
"action": "start",
684726
},
685727
{
686728
"scan_id": "24591f83-8f7b-452a-8c78-ba35779e6816",
687-
"action": "stop"
729+
"action": "stop",
688730
},
689731
{
690732
"scan_id": "13591f83-8f74-45da-8c7d-ba35779e682a",
691-
"action": "delete"
692-
}
733+
"action": "delete",
734+
},
693735
]
694736

695737
scan_results:
@@ -825,3 +867,21 @@ components:
825867
"1.3.6.1.4.1.25623.1.0.10441",
826868
"1.3.6.1.4.1.25623.1.0.100313",
827869
]
870+
871+
preferences:
872+
description: "A example with a list of preferences"
873+
value:
874+
[
875+
{
876+
"id": "optimize_test",
877+
"name": "Optimize Test",
878+
"default": true,
879+
"description": "By default, optimize_test is enabled which means openvas does trust the remote host banners and is only launching plugins against the services they have been designed to check. For example it will check a web server claiming to be IIS only for IIS related flaws but will skip plugins testing for Apache flaws, and so on. This default behavior is used to optimize the scanning performance and to avoid false positives. If you are not sure that the banners of the remote host have been tampered with, you can disable this option.",
880+
},
881+
{
882+
"id": "plugins_timeout",
883+
"name": "Plugins Timeout",
884+
"default": 5,
885+
"description": "This is the maximum lifetime, in seconds of a plugin. It may happen that some plugins are slow because of the way they are written or the way the remote server behaves. This option allows you to make sure your scan is never caught in an endless loop because of a non-finishing plugin. Doesn't affect ACT_SCANNER plugins, use 'ACT_SCANNER plugins timeout' for them instead.",
886+
},
887+
]

0 commit comments

Comments
 (0)