webfuzzing-commons 0.10.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
@@ -0,0 +1,263 @@
1
+ #####################################################################################################################
2
+ ## We use a JSON Schema to validate JSON/YAML configuration files with auth info.
3
+ ## However, such files need to be post-processed to handle merge of keys from 'authTemplate'.
4
+ ## In the past, YAML had native support for this in the form of templates, but this is no longer the case.
5
+ ## A concrete side-effect of this issue is that we cannot use "required" constraints, as those would be applied
6
+ ## to the document as it is, before the template resolution.
7
+ ## A pragmatic compromise is to avoid "required" for fields that can be merged, and rather use "x-required".
8
+ ## The validation of x-required constraints would then be delegated to whatever is used to resolve the templates.
9
+ ##
10
+ ## An "x-required" custom entry can be either an array of strings (with same semantic of "required") or an object (with
11
+ ## fields such as "allOf" and "oneOf" to express more fine-grained constraints)
12
+ #####################################################################################################################
13
+ $schema: "https://json-schema.org/draft/2020-12/schema"
14
+ $id: "https://github.com/WebFuzzing/Commons/blob/master/src/main/resources/wfc/schemas/auth.yaml"
15
+ title: "Web Fuzzing Commons Authentication"
16
+ description: "Schema Definition for Web Fuzzing Commons Authentication"
17
+ type: object
18
+ properties:
19
+ schemaVersion:
20
+ type: string
21
+ description: "The schema version of WFC needed to use to validate and process this document."
22
+ auth:
23
+ description: "List of authentication information for different users."
24
+ type: array
25
+ items:
26
+ $ref: "#/$defs/AuthenticationInfo"
27
+ authTemplate:
28
+ description: "Optional authentication information template. This is used to avoid duplication in the auth list. \
29
+ Entries defined in the template will be applied to all elements in the auth list that do not specify them."
30
+ allOf:
31
+ - $ref: "#/$defs/AuthenticationInfo"
32
+ - type: object
33
+ configs:
34
+ description: "Optional map of configuration parameters, in the form key:value strings. \
35
+ This can be useful to provide extra custom information in the same configuration file, \
36
+ independently of the defined authentication information."
37
+ type: object
38
+ additionalProperties:
39
+ type: string
40
+ required: ["auth"]
41
+ $defs:
42
+ HttpVerb:
43
+ type: string
44
+ enum:
45
+ - POST
46
+ - GET
47
+ - PATCH
48
+ - DELETE
49
+ - PUT
50
+ Header:
51
+ description: "HTTP header information"
52
+ type: object
53
+ properties:
54
+ name:
55
+ description: "The header name, e.g., 'Authorization'."
56
+ type: string
57
+ value:
58
+ description: "The value of the header"
59
+ type: string
60
+ required: ["name","value"]
61
+ AuthenticationInfo:
62
+ type: object
63
+ properties:
64
+ name:
65
+ description: "The name given to this authentication info. \
66
+ This works as a unique id for this authentication configuration."
67
+ type: string
68
+ requireMockHandling:
69
+ description: "Specify that the authentication for this user requires setting up mock responses from an external service. \
70
+ This will be done as part of the fuzzing, although only possible for white-box testing. \
71
+ One consequence here is that, even if we provide correct auth info as input, then a request might still \
72
+ fail due to unauthorized access if the fuzzing process does not properly set up these mocked responses in the API itself."
73
+ type: boolean
74
+ fixedHeaders:
75
+ description: "The headers needed for authentication. \
76
+ This is used to represent cases in which auth info is static/fixed, e.g., \
77
+ when passing an id or username/password through a HTTP header (and not \
78
+ using for example a dynamically generated token from a login endpoint first)."
79
+ type: array
80
+ items:
81
+ $ref: "#/$defs/Header"
82
+ loginEndpointAuth:
83
+ $ref: "#/$defs/LoginEndpoint"
84
+ createUsers:
85
+ $ref: "#/$defs/CreateUsers"
86
+ x-required: ["name"]
87
+ ###
88
+ CreateUsers:
89
+ description: "For some example APIs, it might be possible to create new users with a single HTTP request. \
90
+ In these cases, instead of relying on knowledge of existing users, the fuzzer can create them on \
91
+ the fly. This can be useful when endpoints might modify data of existing users, whose auth info \
92
+ could get invalidated during the fuzzing session."
93
+ type: object
94
+ properties:
95
+ endpoint:
96
+ description: "The endpoint path (eg '/users') where to execute the create user action. \
97
+ It assumes it is on same server of API.\
98
+ If not, rather use 'externalEndpointURL'."
99
+ type: string
100
+ externalEndpointURL:
101
+ description: "If the create endpoint is on a different server, here can rather specify the full URL for it."
102
+ type: string
103
+ payloadRaw:
104
+ description: "The raw payload to send, as a string. This will need to contain the template placeholders \
105
+ defined in the generators. "
106
+ type: string
107
+ verb:
108
+ $ref: "#/$defs/HttpVerb"
109
+ contentType:
110
+ description: "Specify the format in which the payload is sent to the login endpoint. \
111
+ A common example is 'application/json'."
112
+ type: string
113
+ generators:
114
+ description: "List of generators for unique/random names to use in payload template resolution."
115
+ type: array
116
+ minLength: 1
117
+ items:
118
+ $ref: "#/$defs/Generator"
119
+ x-required:
120
+ allOf: ["verb","contentType","payloadRaw","generators"]
121
+ oneOf: ["endpoint","externalEndpointURL"]
122
+
123
+ Generator:
124
+ description: "Parametric producer of unique string values. \
125
+ This is needed for example when creating user-names dynamically in the authentication configurations."
126
+ type: object
127
+ properties:
128
+ placeHolder:
129
+ description: "Placeholder tag used to represent a value generated with this generator. \
130
+ String interpolation will be applied to the raw payloads to replace any found instance of \
131
+ this placeholder with the generated value."
132
+ type: string
133
+ minLength: 1
134
+ examples:
135
+ - "{$username}"
136
+ - "{$email}"
137
+ minLength:
138
+ description: "Minimum length of the generated string"
139
+ type: integer
140
+ min: 0
141
+ maxLength:
142
+ description: "Maximum length of the generated string"
143
+ type: integer
144
+ min: 0
145
+ prefix:
146
+ description: "Fixed prefix shared by all generated strings"
147
+ type: string
148
+ examples:
149
+ - "user_"
150
+ postfix:
151
+ description: "Fixed postfix shared by all generated strings"
152
+ type: string
153
+ examples:
154
+ - "@example.com"
155
+ x-required: ["placeHolder"]
156
+
157
+ LoginEndpoint:
158
+ description: "Used to represent the case in which a login endpoint is used to obtain the authentication credentials. \
159
+ These can be cookies, or a token extracted from the login endpoint's response. \
160
+ This token can then be added to an HTTP header in the following requests."
161
+ type: object
162
+ properties:
163
+ endpoint:
164
+ description: "The endpoint path (eg '/login') where to execute the login. \
165
+ It assumes it is on same server of API.\
166
+ If not, rather use 'externalEndpointURL'."
167
+ type: string
168
+ externalEndpointURL:
169
+ description: "If the login endpoint is on a different server, here can rather specify the full URL for it."
170
+ type: string
171
+ payloadRaw:
172
+ description: "The raw payload to send, as a string."
173
+ type: string
174
+ payloadUserPwd:
175
+ $ref: "#/$defs/PayloadUsernamePassword"
176
+ headers:
177
+ description: "HTTP headers needed when calling the login endpoint. \
178
+ Username/password could be passed by headers instead of by the body payload."
179
+ type: array
180
+ items:
181
+ $ref: "#/$defs/Header"
182
+ verb:
183
+ $ref: "#/$defs/HttpVerb"
184
+ ## FIXME: need to schema version with $ref not replacing everything
185
+ # description: "The verb used to connect to the login endpoint. \
186
+ # Most of the time, this will be a 'POST'."
187
+ # allOf:
188
+ # - $ref: "#/$defs/HttpVerb"
189
+ # - type: string
190
+ contentType:
191
+ description: "Specify the format in which the payload is sent to the login endpoint. \
192
+ A common example is 'application/json'."
193
+ type: string
194
+ token:
195
+ $ref: "#/$defs/TokenHandling"
196
+ expectCookies:
197
+ description: "Specify if we are expecting to get cookies from the login endpoint. \
198
+ If so, a fuzzer can use those as auth info in following requests, instead of trying to extract \
199
+ an auth token from the response payload."
200
+ type: boolean
201
+ x-required:
202
+ allOf: ["verb"]
203
+ oneOf: ["endpoint","externalEndpointURL"]
204
+ ###
205
+ TokenHandling:
206
+ description: "Specify how to extract the token from the HTTP response, and how to use it for auth in following requests. \
207
+ Not needed if rather expect to get back a cookie."
208
+ type: object
209
+ properties:
210
+ extractFrom:
211
+ description: "Specify from where the token should be extracted in the HTTP response."
212
+ type: string
213
+ enum: ["body", "header"]
214
+ extractSelector:
215
+ description: "How to extract the token from the HTTP response. \
216
+ This depends on where the token is located. \
217
+ For a 'body' location, the returned body payload like a JSON could have few fields, possibly nested. \
218
+ In this case, this selector is expressed as a JSON Pointer (RFC 6901). \
219
+ For a 'header' location, this selector would represent the name of the HTTP header (e.g., 'X-Auth-Token')."
220
+ type: string
221
+ sendIn:
222
+ description: "The obtained auth token could be send for authentication in following requests in different ways. \
223
+ For example, in a HTTP header (e.g., 'Authorization') or a query parameter."
224
+ type: string
225
+ enum: ["header", "query"]
226
+ sendName:
227
+ description: "Header or query name where the token should be put in the authenticated requests. \
228
+ Typically, for a header, this would be 'Authorization'."
229
+ type: string
230
+ examples:
231
+ - "Authorization"
232
+ sendTemplate:
233
+ description: "Template with {token} placeholder. \
234
+ The placeholder will be interpolated with the actual token value. \
235
+ When sending out the obtained token in an HTTP request, specify if there should be any other \
236
+ text information around it. \
237
+ For example, when sending the token in an 'Authorization' header, possible \
238
+ values could be 'Bearer {token}' and 'JWT {token}'."
239
+ type: string
240
+ default: "{token}"
241
+ examples:
242
+ - "Bearer {token}"
243
+ - "JWT {token}"
244
+ x-required: ["extractFrom", "extractSelector", "sendIn", "sendName"]
245
+ ###
246
+ PayloadUsernamePassword:
247
+ description: "Payload with username and password information. \
248
+ It will be automatically formatted in a proper payload based on content type."
249
+ type: object
250
+ properties:
251
+ username:
252
+ description: "The id of the user."
253
+ type: string
254
+ password:
255
+ description: "The password of the user, in plain-text. This must NOT be hashed."
256
+ type: string
257
+ usernameField:
258
+ description: "The name of the field in the body payload containing the username."
259
+ type: string
260
+ passwordField:
261
+ description: "The name of the field in the body payload containing the password"
262
+ type: string
263
+ x-required: ["username","usernameField","password","passwordField"]
@@ -0,0 +1,353 @@
1
+ [ {
2
+ "code" : 100,
3
+ "descriptiveName" : "HTTP Status 500",
4
+ "fullDescription" : "The HTTP status code 500 represents a 'Server Error'. Typically, when there is crash in the business logic of the tested backend, like for example due to a null-pointer exception, the server would not crash, but rather return a response with status code 500. Therefore, the presence of such a response 'might' indicate the presence of a fault in the backend. However, such code might also be used for other cases that have nothing to do with software faults. For example, if a request cannot be handled due to issue with the environment, e.g., databases and communications with other APIs, a status code 500 could be sent. As such, although there is high chances that a 500 status code might point to the presence of a software fault in the tested application, they still need to be manually checked due to possible 'false-positive'.",
5
+ "group" : "G_1XX",
6
+ "id" : "HTTP_STATUS_500",
7
+ "label" : "F100:HTTP Status 500",
8
+ "testCaseLabel" : "causes500_internalServerError"
9
+ }, {
10
+ "code" : 101,
11
+ "descriptiveName" : "HTTP Violation: no-non-standard-codes",
12
+ "fullDescription" : "HTTP status codes outside the range 100-599 are not valid.",
13
+ "group" : "G_1XX",
14
+ "id" : "HTTP_STATUS_NO_NON_STANDARD_CODES",
15
+ "label" : "F101:HTTP Violation: no-non-standard-codes",
16
+ "testCaseLabel" : "invalidStatusCode"
17
+ }, {
18
+ "code" : 102,
19
+ "descriptiveName" : "HTTP Violation: no-201-if-delete",
20
+ "fullDescription" : "A DELETE operation is meant to remove a resource, and so it should not states to 201 create one.",
21
+ "group" : "G_1XX",
22
+ "id" : "HTTP_STATUS_NO_201_IF_DELETE",
23
+ "label" : "F102:HTTP Violation: no-201-if-delete",
24
+ "testCaseLabel" : "201OnDelete"
25
+ }, {
26
+ "code" : 103,
27
+ "descriptiveName" : "HTTP Violation: no-201-if-get",
28
+ "fullDescription" : "A GET operation is meant to retrieve a resource, and so it should not states to 201 create one.",
29
+ "group" : "G_1XX",
30
+ "id" : "HTTP_STATUS_NO_201_IF_GET",
31
+ "label" : "F103:HTTP Violation: no-201-if-get",
32
+ "testCaseLabel" : "201OnGet"
33
+ }, {
34
+ "code" : 104,
35
+ "descriptiveName" : "HTTP Violation: no-201-if-patch",
36
+ "fullDescription" : "A PATCH operation is meant to modify a resource, and so it should not states to 201 create one.",
37
+ "group" : "G_1XX",
38
+ "id" : "HTTP_STATUS_NO_201_IF_PATCH",
39
+ "label" : "F104:HTTP Violation: no-201-if-patch",
40
+ "testCaseLabel" : "201OnPatch"
41
+ }, {
42
+ "code" : 105,
43
+ "descriptiveName" : "HTTP Violation: no-204-if-content",
44
+ "fullDescription" : "If a response contains a payload, it should not state it 204 contains none.",
45
+ "group" : "G_1XX",
46
+ "id" : "HTTP_STATUS_NO_204_IF_CONTENT",
47
+ "label" : "F105:HTTP Violation: no-204-if-content",
48
+ "testCaseLabel" : "204WhenContent"
49
+ }, {
50
+ "code" : 106,
51
+ "descriptiveName" : "HTTP Violation: no-413-if-no-payload",
52
+ "fullDescription" : "Cannot state a payload is too large if there is no payload.",
53
+ "group" : "G_1XX",
54
+ "id" : "HTTP_STATUS_NO_413_IF_NO_PAYLOAD",
55
+ "label" : "F106:HTTP Violation: no-413-if-no-payload",
56
+ "testCaseLabel" : "413WhenNoPayload"
57
+ }, {
58
+ "code" : 107,
59
+ "descriptiveName" : "HTTP Violation: no-415-if-no-payload",
60
+ "fullDescription" : "Cannot state a payload is of the wrong type if there is no payload.",
61
+ "group" : "G_1XX",
62
+ "id" : "HTTP_STATUS_NO_415_IF_NO_PAYLOAD",
63
+ "label" : "F107:HTTP Violation: no-415-if-no-payload",
64
+ "testCaseLabel" : "415WhenNoPayload"
65
+ }, {
66
+ "code" : 108,
67
+ "descriptiveName" : "HTTP Violation: no-304-if-no-get-or-head",
68
+ "fullDescription" : "A 304 response is not valid if the request was not either a GET or a HEAD.",
69
+ "group" : "G_1XX",
70
+ "id" : "HTTP_STATUS_NO_304_IF_NO_GET_OR_HEAD",
71
+ "label" : "F108:HTTP Violation: no-304-if-no-get-or-head",
72
+ "testCaseLabel" : "304OnWrongVerb"
73
+ }, {
74
+ "code" : 109,
75
+ "descriptiveName" : "HTTP Violation: no-401-if-no-authenticate",
76
+ "fullDescription" : "If an API responds with a 401 non-authenticated error, such response MUST contain a www-authenticate header, with the needed information. In HTTP, this is not optional.",
77
+ "group" : "G_1XX",
78
+ "id" : "HTTP_STATUS_NO_401_IF_NO_WWW_AUTHENTICATE",
79
+ "label" : "F109:HTTP Violation: no-401-if-no-authenticate",
80
+ "testCaseLabel" : "401MissingWwwAuthenticate"
81
+ }, {
82
+ "code" : 110,
83
+ "descriptiveName" : "HTTP Violation: no-405-if-no-allow",
84
+ "fullDescription" : "A 405 Not Allowed response must contain an Allow header specifying what is allowed.",
85
+ "group" : "G_1XX",
86
+ "id" : "HTTP_STATUS_NO_405_IF_NO_ALLOW",
87
+ "label" : "F110:HTTP Violation: no-405-if-no-allow",
88
+ "testCaseLabel" : "405MissingAllow"
89
+ }, {
90
+ "code" : 111,
91
+ "descriptiveName" : "HTTP Violation: no-205-if-content",
92
+ "fullDescription" : "If a response contains a payload, it should not return a 205, as that requires no payload.",
93
+ "group" : "G_1XX",
94
+ "id" : "HTTP_STATUS_NO_205_IF_CONTENT",
95
+ "label" : "F111:HTTP Violation: no-205-if-content",
96
+ "testCaseLabel" : "205WhenContent"
97
+ }, {
98
+ "code" : 112,
99
+ "descriptiveName" : "HTTP Violation: no-426-if-no-upgrade",
100
+ "fullDescription" : "A 426 response must contain an Upgrade header with the needed information.",
101
+ "group" : "G_1XX",
102
+ "id" : "HTTP_STATUS_NO_426_IF_NO_UPGRADE",
103
+ "label" : "F112:HTTP Violation: no-426-if-no-upgrade",
104
+ "testCaseLabel" : "426MissingUpgrade"
105
+ }, {
106
+ "code" : 113,
107
+ "descriptiveName" : "HTTP Violation: Resource Still Accessible After Successful DELETE",
108
+ "fullDescription" : "If a resource is deleted, and the API responds that such request was successful, then such resource should no longer being available. New requests to access it should fail. Otherwise, if it is still possible to access the resource, then it was not really deleted. Then, as such, it means that the delete operation is faulty.",
109
+ "group" : "G_1XX",
110
+ "id" : "HTTP_NONWORKING_DELETE",
111
+ "label" : "F113:HTTP Violation: Resource Still Accessible After Successful DELETE",
112
+ "testCaseLabel" : "deleteDoesNotWork"
113
+ }, {
114
+ "code" : 114,
115
+ "descriptiveName" : "HTTP Violation: A Failed PUT or PATCH Must Not Change The Resource",
116
+ "fullDescription" : "Write operations that fail due to user errors should not leave side effects on the system. There should not be partial updates: either all are applied, or none.",
117
+ "group" : "G_1XX",
118
+ "id" : "HTTP_SIDE_EFFECTS_FAILED_MODIFICATION",
119
+ "label" : "F114:HTTP Violation: A Failed PUT or PATCH Must Not Change The Resource",
120
+ "testCaseLabel" : "sideEffectsFailedModification"
121
+ }, {
122
+ "code" : 115,
123
+ "descriptiveName" : "HTTP Violation: Repeated PUT Creates Resource With 201 Instead of Updating",
124
+ "fullDescription" : "A PUT operation can either update (e.g., 200 or 204) or create (201) a resource. If a resource is 201 created with a PUT, a second PUT should update the resource, and not be marked as recreated.",
125
+ "group" : "G_1XX",
126
+ "id" : "HTTP_REPEATED_CREATE_PUT",
127
+ "label" : "F115:HTTP Violation: Repeated PUT Creates Resource With 201 Instead of Updating",
128
+ "testCaseLabel" : "repeatedCreatePut"
129
+ }, {
130
+ "code" : 116,
131
+ "descriptiveName" : "HTTP Violation: Misleading PUT 201 Creates When Resource Already Exists",
132
+ "fullDescription" : "A PUT operation can either update (e.g., 200 or 204) or create (201) a resource. If a resource already exists, than a PUT operation on it would update it, and not create it.",
133
+ "group" : "G_1XX",
134
+ "id" : "HTTP_MISLEADING_CREATE_PUT",
135
+ "label" : "F116:HTTP Violation: Misleading PUT 201 Creates When Resource Already Exists",
136
+ "testCaseLabel" : "misleadingCreatePut"
137
+ }, {
138
+ "code" : 117,
139
+ "descriptiveName" : "HTTP Violation: The Verb PUT Must Make a Full Replacement",
140
+ "fullDescription" : "A PUT operation is used to make a full replacement of a resource",
141
+ "group" : "G_1XX",
142
+ "id" : "HTTP_PARTIAL_UPDATE_PUT",
143
+ "label" : "F117:HTTP Violation: The Verb PUT Must Make a Full Replacement",
144
+ "testCaseLabel" : "partialUpdatePut"
145
+ }, {
146
+ "code" : 118,
147
+ "descriptiveName" : "HTTP Violation: PUT Implementation Must be Idempotent",
148
+ "fullDescription" : "A PUT operation is treated as idempotent. A write operation with a PUT that is not implemented as idempotent might have severe repercussions, as such operation could be automatically repeated any entity involved in the HTTP connection without any warning to the user.",
149
+ "group" : "G_1XX",
150
+ "id" : "HTTP_NON_IDEMPOTENT_PUT",
151
+ "label" : "F118:HTTP Violation: PUT Implementation Must be Idempotent",
152
+ "testCaseLabel" : "nonIdempotentPut"
153
+ }, {
154
+ "code" : 119,
155
+ "descriptiveName" : "HTTP Violation: Invalid JSON Merge Patch",
156
+ "fullDescription" : "A JSON Merge Path has a specific semantics, defining how values are modified based on the input payloads. Modifying entries not specified in the payload would be a clear implementation fault.",
157
+ "group" : "G_1XX",
158
+ "id" : "HTTP_INVALID_MERGE_PATCH",
159
+ "label" : "F119:HTTP Violation: Invalid JSON Merge Patch",
160
+ "testCaseLabel" : "invalidMergePatch"
161
+ }, {
162
+ "code" : 120,
163
+ "descriptiveName" : "HTTP Violation: Invalid Location HTTP Header",
164
+ "fullDescription" : "Even outside of 3xx redirections, the Location header can be used to specify for example where newly created resources can be accessed. However, if a Location value point to a path for which there is no valid operation (not necessarily a GET) in the API, then such value might be likely wrong.",
165
+ "group" : "G_1XX",
166
+ "id" : "HTTP_INVALID_LOCATION",
167
+ "label" : "F120:HTTP Violation: Invalid Location HTTP Header",
168
+ "testCaseLabel" : "returnsInvalidLocationHeader"
169
+ }, {
170
+ "code" : 121,
171
+ "descriptiveName" : "HTTP Status 5xx Other Than 500 And 501",
172
+ "fullDescription" : "Status codes in the 5xx range represent server-side errors. Apart from 500 and 501, any other 5xx code (e.g., 502, 503 and 504) might indicate faults in the tested application, or in how it deals with the services it depends on. Like 500, these codes need a manual check: the environment can cause them (e.g., a temporarily unavailable database).",
173
+ "group" : "G_1XX",
174
+ "id" : "HTTP_OTHER_STATUS_5XX",
175
+ "label" : "F121:HTTP Status 5xx Other Than 500 And 501",
176
+ "testCaseLabel" : "causes5xx_serverError"
177
+ }, {
178
+ "code" : 122,
179
+ "descriptiveName" : "HTTP Violation: Resource Not Found Right After Successful Creation",
180
+ "fullDescription" : "If a resource is successfully created (e.g., with a POST), then it should be possible to access it right after. If a request on the new resource (e.g., using the identifier returned in the creation response) gives a 404, and nobody deleted it, then either the resource was not created, or the API returns wrong information about how to access it.",
181
+ "group" : "G_1XX",
182
+ "id" : "HTTP_CREATED_RESOURCE_NOT_FOUND",
183
+ "label" : "F122:HTTP Violation: Resource Not Found Right After Successful Creation",
184
+ "testCaseLabel" : "createdResourceNotFound"
185
+ }, {
186
+ "code" : 200,
187
+ "descriptiveName" : "Schema Violation: Received A Response From API With A Structure/Data That Is Not Matching Its Schema",
188
+ "fullDescription" : "A schema, like for example OpenAPI for REST, defines the structures not only of the inputs but also the outputs of the API. If what returned by an API is not conforming to its schema, then it is a clear fault. However, whether the fault is in the API (i.e., it does not conform to the schema) or in the schema itself (i.e., it is underspecified, or having mistakes) is something that cannot be known for sure without debugging the issue.",
189
+ "group" : "G_2XX",
190
+ "id" : "SCHEMA_INVALID_RESPONSE",
191
+ "label" : "F200:Schema Violation: Received A Response From API With A Structure/Data That Is Not Matching Its Schema",
192
+ "testCaseLabel" : "returnsMismatchResponseWithSchema"
193
+ }, {
194
+ "code" : 201,
195
+ "descriptiveName" : "Schema Violation: Invalid Allow HTTP Header",
196
+ "fullDescription" : "A returned Allow header specifies what operations (e.g., GET and PATCH) are available on a resource. For consistency, this needs to match what actually defined in the schema of the API, apart from special cases such as HEAD and OPTIONS.",
197
+ "group" : "G_2XX",
198
+ "id" : "SCHEMA_INVALID_ALLOW",
199
+ "label" : "F201:Schema Violation: Invalid Allow HTTP Header",
200
+ "testCaseLabel" : "invalidAllow"
201
+ }, {
202
+ "code" : 202,
203
+ "descriptiveName" : "Schema Violation: no-401-if-no-auth",
204
+ "fullDescription" : "Should not return a 401 non-authenticated if there is no authentication in the definition of the API (or conversely, authentication definition is wrongly missing).",
205
+ "group" : "G_2XX",
206
+ "id" : "SCHEMA_STATUS_NO_401_IF_NO_AUTH",
207
+ "label" : "F202:Schema Violation: no-401-if-no-auth",
208
+ "testCaseLabel" : "401WhenNoAuth"
209
+ }, {
210
+ "code" : 203,
211
+ "descriptiveName" : "Schema Violation: no-403-if-no-401",
212
+ "fullDescription" : "Should not return a 403 non-authorized if there is no 401 non-authenticated in the definition of the API (or conversely, such definition is wrongly missing).",
213
+ "group" : "G_2XX",
214
+ "id" : "SCHEMA_STATUS_NO_403_IF_NO_401",
215
+ "label" : "F203:Schema Violation: no-403-if-no-401",
216
+ "testCaseLabel" : "403WhenNo401"
217
+ }, {
218
+ "code" : 204,
219
+ "descriptiveName" : "Schema Violation: has-406-if-accept",
220
+ "fullDescription" : "If a valid payload is sent based on what declared in the schema, it should not happen that the API responds with a 406 non-valid payload type.",
221
+ "group" : "G_2XX",
222
+ "id" : "SCHEMA_STATUS_HAS_406_IF_ACCEPT",
223
+ "label" : "F204:Schema Violation: has-406-if-accept",
224
+ "testCaseLabel" : "406WhenValid"
225
+ }, {
226
+ "code" : 205,
227
+ "descriptiveName" : "Schema Violation: no-501-if-implemented",
228
+ "fullDescription" : "If a schema defines an endpoint, then a call on it should not return a 501 Non-Implemented.",
229
+ "group" : "G_2XX",
230
+ "id" : "SCHEMA_STATUS_NO_501_IF_IMPLEMENTED",
231
+ "label" : "F205:Schema Violation: no-501-if-implemented",
232
+ "testCaseLabel" : "501OnDeclaredEndpoint"
233
+ }, {
234
+ "code" : 206,
235
+ "descriptiveName" : "Received Success Response When Sending Wrong Data",
236
+ "fullDescription" : "API inputs might have constraints (e.g., integers in a specific range, and strings matching a given regular expression). Also, they need be to of specific types (e.g., integers, booleans, strings, dates, arrays and objects). If some input data does not satisfy the type on constraints defined in the schema, then the API should mark the request as 'user error'. However, if for any reason the request is processed successfully, then it is a fault. Either the schema is incorrect, or the API is not properly discarding invalid data.",
237
+ "group" : "G_2XX",
238
+ "id" : "SCHEMA_VALIDATION_BYPASS",
239
+ "label" : "F206:Received Success Response When Sending Wrong Data",
240
+ "testCaseLabel" : "successOnInvalidInputs"
241
+ }, {
242
+ "code" : 207,
243
+ "descriptiveName" : "Received User Error Response When Sending Valid Data",
244
+ "fullDescription" : "The converse of 'Received Success Response When Sending Wrong Data'. If all input data satisfies the types and constraints defined in the schema, then the API should not mark the request as 'user error' (e.g., with a 400 or 422 in REST). Status codes that do not depend on data validity, like 401, 403, 404, 409 and 429, are not considered here. Either the schema is incorrect (e.g., it is missing some constraints), or the API rejects valid data. As OpenAPI is not able to express all possible types of input constraints (e.g., inter-parameter dependencies), depending on the API this oracle might lead to some false positives.",
245
+ "group" : "G_2XX",
246
+ "id" : "SCHEMA_VALID_INPUT_REJECTED",
247
+ "label" : "F207:Received User Error Response When Sending Valid Data",
248
+ "testCaseLabel" : "rejectedValidInputs"
249
+ }, {
250
+ "code" : 300,
251
+ "descriptiveName" : "SQL Injection (SQLi)",
252
+ "fullDescription" : "Input data was not properly sanitized. Its use in SQL commands led to execute arbitrary commands on the database. See OWASP Top 10 for more information.",
253
+ "group" : "G_3XX",
254
+ "id" : "SECURITY_SQL_INJECTION",
255
+ "label" : "F300:SQL Injection (SQLi)",
256
+ "testCaseLabel" : "vulnerableToSQLInjection"
257
+ }, {
258
+ "code" : 301,
259
+ "descriptiveName" : "Cross-Site Scripting (XSS)",
260
+ "fullDescription" : "XSS is an attack in which it is possible to inject malicious scripts into web pages viewed users. This works as well in APIs, if the malicious payload is stored as it is, and then read afterwards by a frontend web application. See OWASP Top 10 for more information.",
261
+ "group" : "G_3XX",
262
+ "id" : "SECURITY_XSS_INJECTION",
263
+ "label" : "F301:Cross-Site Scripting (XSS)",
264
+ "testCaseLabel" : "vulnerableToXSS"
265
+ }, {
266
+ "code" : 302,
267
+ "descriptiveName" : "Server-Side Request Forgery (SSRF)",
268
+ "fullDescription" : "Some inputs might be URLs, which are then used by the API to retrieve data from external services. However, if the hostnames of these URLs are not verified, the API could be tricked into making requests towards servers it should not to, like for example the 'localhost'. See OWASP Top 10 for more information.",
269
+ "group" : "G_3XX",
270
+ "id" : "SECURITY_SSRF",
271
+ "label" : "F302:Server-Side Request Forgery (SSRF)",
272
+ "testCaseLabel" : "vulnerableToSSRF"
273
+ }, {
274
+ "code" : 303,
275
+ "descriptiveName" : "Mass Assignment",
276
+ "fullDescription" : "This vulnerability exploits possible active record pattern misconfigurations to modify fields of a record that should not be accessible via the API. See OWASP Top 10 for more information.",
277
+ "group" : "G_3XX",
278
+ "id" : "SECURITY_MASS_ASSIGNMENT",
279
+ "label" : "F303:Mass Assignment",
280
+ "testCaseLabel" : "vulnerableToMassAssignment"
281
+ }, {
282
+ "code" : 304,
283
+ "descriptiveName" : "Leakage Information Existence of Protected Resource",
284
+ "fullDescription" : "When accessing a protected resource, could get as a response a 403 not-authorized status code. If the resource does not exist, then returning a 404 would be a security leak, as now the client would know if resources, they have no access to, do exist or not. In these cases, to avoid unauthorized information leakage, a server should consistently either always return 403 or 404 for protected resources, regardless of whether they exist or not.",
285
+ "group" : "G_3XX",
286
+ "id" : "SECURITY_EXISTENCE_LEAKAGE",
287
+ "label" : "F304:Leakage Information Existence of Protected Resource",
288
+ "testCaseLabel" : "allowsUnauthorizedAccessToProtectedResource"
289
+ }, {
290
+ "code" : 305,
291
+ "descriptiveName" : "Wrongly Not Recognized as Authenticated",
292
+ "fullDescription" : "If the user is providing valid credentials, and if they try to access a protected resource, they should get a status code 403 (not authorized), and not 401 (not authenticated). With a 401, the user might wrongly think there is a problem with their credentials, and not that they have no right to access to that resource. However, to avoid false positives related to misconfigured credentials, these credentials should be first successfully validated on some other resources before flagging a returned 401 as a server fault.",
293
+ "group" : "G_3XX",
294
+ "id" : "SECURITY_NOT_RECOGNIZED_AUTHENTICATED",
295
+ "label" : "F305:Wrongly Not Recognized as Authenticated",
296
+ "testCaseLabel" : "authenticatedButWronglyToldNot"
297
+ }, {
298
+ "code" : 306,
299
+ "descriptiveName" : "Allowed To Modify Resource That Likely Should Had Been Protected",
300
+ "fullDescription" : "BOLA and BFLA are major security vulnerabilities. To avoid users accessing protected resources, authorization mechanisms are usually put in place. However, it can happen that, on some endpoints, these authorization mechanisms are missing or misconfigured by mistake. This can have disastrous consequences, e.g., a regular user deleting all data from all other users. However, access policies could be arbitrarily complex, where some users might validly interact with some resources of other users. A common example is 'administrator' users. Without a formal specification describing in details the access policies in place, it is hard to say automatically if we are in the case of a BOLA/BFLA vulnerability. Still, some heuristics could be used to flag highly suspicious cases. For example, if a user is blocked with a 403 to do a PUT and a PATCH on a resource, it would be quite suspicious if a DELETE would work just fine on that resource.",
301
+ "group" : "G_3XX",
302
+ "id" : "SECURITY_INCONSISTENT_WRITE_AUTHORIZATION",
303
+ "label" : "F306:Allowed To Modify Resource That Likely Should Had Been Protected",
304
+ "testCaseLabel" : "missedAuthorizationCheck"
305
+ }, {
306
+ "code" : 307,
307
+ "descriptiveName" : "A Protected Resource Is Accessible Without Providing Any Authentication",
308
+ "fullDescription" : "Protected resources would return a 403 status code when a user that has no rights to them tries to access them. Without providing a formal specification, it might not be possible to know which users have rights or not on a resource. However, being able to access it with no authentication, while some authenticated users are blocked, would be a major security vulnerability. Blocked users could simply drop their authentication credentials to access those protected resources.",
309
+ "group" : "G_3XX",
310
+ "id" : "SECURITY_IGNORE_ANONYMOUS",
311
+ "label" : "F307:A Protected Resource Is Accessible Without Providing Any Authentication",
312
+ "testCaseLabel" : "ignoreAnonymous"
313
+ }, {
314
+ "code" : 308,
315
+ "descriptiveName" : "Anonymous Modifications",
316
+ "fullDescription" : "Not all systems require authentication when reading data, or creating new ones. Without a formal specification, a fuzzer cannot know if a resource is expected to be public or not. However, 'modifying' data (e.g., with DELETE, PUT and PATCH) with no credentials is problematic. A user could delete all existing data, or change any new data as soon as it is created by others.",
317
+ "group" : "G_3XX",
318
+ "id" : "SECURITY_ANONYMOUS_MODIFICATIONS",
319
+ "label" : "F308:Anonymous Modifications",
320
+ "testCaseLabel" : "anonymousModifications"
321
+ }, {
322
+ "code" : 309,
323
+ "descriptiveName" : "Leaked Stack Trace",
324
+ "fullDescription" : "In case of bugs, the internal business logic of the tested application could throw exceptions. For debugging reasons, the responses from the HTTP server could contain the stack-trace of those thrown exceptions. Albeit useful for debugging, those stack-traces could reveal internal details of the system. This would be a security leak if those debugging settings are left in production.",
325
+ "group" : "G_3XX",
326
+ "id" : "SECURITY_LEAKED_STACK_TRACES",
327
+ "label" : "F309:Leaked Stack Trace",
328
+ "testCaseLabel" : "leakedStackTrace"
329
+ }, {
330
+ "code" : 310,
331
+ "descriptiveName" : "Hidden Accessible Endpoint",
332
+ "fullDescription" : "To test an API, there is the need of a schema that specifies what endpoints can be called. Being able to call endpoints that are not declared in the schema is a potential risk, as those might be either forgotten endpoints, work-in-progress, admin-only endpoints, etc., whose security protections might not be fully tested or in place. Either the call should fail for auth reasons (e.g., 401 and 403 in REST APIs), or the system should respond that the endpoint does not exist (e.g., 405 and 501).",
333
+ "group" : "G_3XX",
334
+ "id" : "SECURITY_HIDDEN_ACCESSIBLE_ENDPOINT",
335
+ "label" : "F310:Hidden Accessible Endpoint",
336
+ "testCaseLabel" : "hiddenAccessible"
337
+ }, {
338
+ "code" : 311,
339
+ "descriptiveName" : "Declared Authentication Is Not Enforced",
340
+ "fullDescription" : "A schema can declare that an operation requires authentication (e.g., with security requirements in OpenAPI). If a request with valid credentials succeeds, then the same request with no credentials, or with invalid ones, should be rejected (e.g., with a 401 or 403 in REST). Otherwise, either the schema declares authentication by mistake, or the API does not enforce it. Modifications (e.g., DELETE, PUT and PATCH) accepted with no credentials are handled in 'Anonymous Modifications'; this code covers all other cases, including reads and invalid credentials.",
341
+ "group" : "G_3XX",
342
+ "id" : "SECURITY_DECLARED_AUTH_NOT_ENFORCED",
343
+ "label" : "F311:Declared Authentication Is Not Enforced",
344
+ "testCaseLabel" : "declaredAuthNotEnforced"
345
+ }, {
346
+ "code" : 312,
347
+ "descriptiveName" : "Call Timeout",
348
+ "fullDescription" : "A call that does not get a response within a given time limit, or never gets one, might point to a denial-of-service vulnerability: specific inputs make the API spend excessive time (or resources) handling the request. An attacker could send such requests repeatedly to make the API unavailable to other users. The environment can also cause slow responses (e.g., an overloaded server or a slow database), so these calls need a manual check. The time limit should match the expected performance of the API.",
349
+ "group" : "G_3XX",
350
+ "id" : "SECURITY_CALL_TIMEOUT",
351
+ "label" : "F312:Call Timeout",
352
+ "testCaseLabel" : "callTimeout"
353
+ } ]