-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(query): openapi pattern undefined fp enum and format sanitizers (#…
…7323) * OpenAPI general query pattern_undefined updated to also consider format and enum as sanitizers * Update so that format is only considered a sanitizer when it's value is date or date-time * Expected and acutal key values uneeded changes reverted * Comments correction * Auxiliar function renamed to a more current language * Vulnerable github.com/moby/buildkit package updated --------- Co-authored-by: Artur Ribeiro <[email protected]>
- Loading branch information
1 parent
2e3a47b
commit 4d0afd1
Showing
7 changed files
with
251 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
assets/queries/openAPI/general/pattern_undefined/test/negative10.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
swagger: "2.0" | ||
info: | ||
title: Simple API Overview | ||
version: 1.0.0 | ||
paths: | ||
"/": | ||
get: | ||
operationId: listVersionsv2 | ||
summary: List API versions | ||
responses: | ||
"200": | ||
description: 200 response | ||
schema: | ||
type: object | ||
discriminator: petType | ||
additionalProperties: false | ||
properties: | ||
code: | ||
type: string | ||
maxLength: 15 | ||
enum: | ||
- brown | ||
- grey | ||
- black | ||
- white | ||
message: | ||
type: string | ||
format: date | ||
extra: | ||
type: string | ||
format: date-time |
95 changes: 95 additions & 0 deletions
95
assets/queries/openAPI/general/pattern_undefined/test/negative7.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
{ | ||
"openapi": "3.0.0", | ||
"info": { | ||
"title": "Simple API Overview", | ||
"version": "1.0.0", | ||
"contact": { | ||
"name": "contact", | ||
"url": "https://www.google.com/", | ||
"email": "[email protected]" | ||
} | ||
}, | ||
"paths": { | ||
"/": { | ||
"get": { | ||
"operationId": "listVersionsv2", | ||
"summary": "List API versions", | ||
"responses": { | ||
"200": { | ||
"description": "200 response", | ||
"content": { | ||
"application/json": { | ||
"examples": { | ||
"foo": { | ||
"value": { | ||
"versions": [ | ||
{ | ||
"status": "CURRENT", | ||
"updated": "2011-01-21T11:33:21Z", | ||
"id": "v2.0", | ||
"links": [ | ||
{ | ||
"href": "http://127.0.0.1:8774/v2/", | ||
"rel": "self" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"GeneralError": { | ||
"type": "object", | ||
"discriminator": { | ||
"propertyName": "petType" | ||
}, | ||
"additionalProperties": false, | ||
"properties": { | ||
"code": { | ||
"type": "string", | ||
"maxLength": 15, | ||
"enum": [ | ||
"brown", | ||
"grey", | ||
"black", | ||
"white" | ||
] | ||
}, | ||
"message": { | ||
"type": "string", | ||
"format": "date" | ||
}, | ||
"extra": { | ||
"type": "string", | ||
"format": "date-time" | ||
} | ||
}, | ||
"required": [ | ||
"petType" | ||
] | ||
} | ||
}, | ||
"requestBodies": { | ||
"NewItem": { | ||
"description": "A JSON object containing item data", | ||
"required": true, | ||
"content": { | ||
"multipart/form-data": { | ||
"schema": { | ||
"$ref": "#/components/schemas/GeneralError" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
assets/queries/openAPI/general/pattern_undefined/test/negative8.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: Simple API Overview | ||
version: 1.0.0 | ||
paths: | ||
"/": | ||
get: | ||
operationId: listVersionsv2 | ||
summary: List API versions | ||
responses: | ||
"200": | ||
description: 200 response | ||
content: | ||
application/json: | ||
examples: | ||
foo: | ||
value: | ||
versions: | ||
- status: CURRENT | ||
updated: "2011-01-21T11:33:21Z" | ||
id: v2.0 | ||
links: | ||
- href: http://127.0.0.1:8774/v2/ | ||
rel: self | ||
components: | ||
schemas: | ||
GeneralError: | ||
type: object | ||
discriminator: | ||
propertyName: petType | ||
additionalProperties: false | ||
properties: | ||
code: | ||
type: string | ||
maxLength: 15 | ||
enum: | ||
- brown | ||
- grey | ||
- black | ||
- white | ||
message: | ||
type: string | ||
format: date | ||
extra: | ||
type: string | ||
format: date-time | ||
required: | ||
- petType | ||
requestBodies: | ||
NewItem: | ||
description: A JSON object containing item data | ||
required: true | ||
content: | ||
multipart/form-data: | ||
schema: | ||
$ref: "#/components/schemas/GeneralError" |
51 changes: 51 additions & 0 deletions
51
assets/queries/openAPI/general/pattern_undefined/test/negative9.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"title": "Simple API Overview", | ||
"version": "1.0.0", | ||
"contact": { | ||
"name": "contact", | ||
"url": "https://www.google.com/", | ||
"email": "[email protected]" | ||
} | ||
}, | ||
"paths": { | ||
"/": { | ||
"get": { | ||
"responses": { | ||
"200": { | ||
"description": "200 response", | ||
"schema": { | ||
"discriminator": "petType", | ||
"additionalProperties": false, | ||
"properties": { | ||
"code": { | ||
"type": "string", | ||
"maxLength": 15, | ||
"enum": [ | ||
"brown", | ||
"grey", | ||
"black", | ||
"white" | ||
] | ||
}, | ||
"message": { | ||
"type": "string", | ||
"format": "date" | ||
}, | ||
"extra": { | ||
"type": "string", | ||
"format": "date-time" | ||
} | ||
}, | ||
"required": [ | ||
"petType" | ||
], | ||
"type": "object" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters