From 393b44dcd20415312faffcdbdbf9853000a98186 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sat, 2 Jul 2016 11:32:25 +0800 Subject: [PATCH] remove security test from petstore-with-fake-endpoints-models-for-testing --- ...ith-fake-endpoints-models-for-testing.yaml | 20 -------------- .../lumen/app/Http/controllers/FakeApi.php | 27 ++++++++++++++++++- .../lumen/app/Http/controllers/PetApi.php | 2 +- .../lumen/app/Http/controllers/StoreApi.php | 2 +- .../lumen/app/Http/controllers/UserApi.php | 2 +- .../server/petstore/lumen/app/Http/routes.php | 9 ++++++- 6 files changed, 37 insertions(+), 25 deletions(-) diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml index 00fb358d9e..d3d8287d91 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -561,26 +561,6 @@ paths: description: User not found /fake: - put: - tags: - - fake - summary: To test code injection */ =end - descriptions: To test code injection */ =end - operationId: testCodeInject */ =end - consumes: - - application/json - - "*/ =end'));(phpinfo('" - produces: - - application/json - - '*/ end' - parameters: - - name: test code inject */ =end - type: string - in: formData - description: To test code injection */ =end - responses: - '400': - description: To test code injection */ =end get: tags: - fake diff --git a/samples/server/petstore/lumen/app/Http/controllers/FakeApi.php b/samples/server/petstore/lumen/app/Http/controllers/FakeApi.php index 3cf90593ed..11c9e2dc4c 100644 --- a/samples/server/petstore/lumen/app/Http/controllers/FakeApi.php +++ b/samples/server/petstore/lumen/app/Http/controllers/FakeApi.php @@ -2,7 +2,7 @@ /** * Swagger Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io @@ -129,4 +129,29 @@ class FakeApi extends Controller return response('How about implementing testEndpointParameters as a POST method ?'); } + /** + * Operation testEnumQueryParameters + * + * To test enum query parameters. + * + * + * @return Http response + */ + public function testEnumQueryParameters() + { + $input = Request::all(); + + //path params validation + + + //not path params validation + $enumQueryString = $input['enumQueryString']; + + $enumQueryInteger = $input['enumQueryInteger']; + + $enumQueryDouble = $input['enumQueryDouble']; + + + return response('How about implementing testEnumQueryParameters as a GET method ?'); + } } diff --git a/samples/server/petstore/lumen/app/Http/controllers/PetApi.php b/samples/server/petstore/lumen/app/Http/controllers/PetApi.php index 4d67bc06d1..bd06e75fa6 100644 --- a/samples/server/petstore/lumen/app/Http/controllers/PetApi.php +++ b/samples/server/petstore/lumen/app/Http/controllers/PetApi.php @@ -2,7 +2,7 @@ /** * Swagger Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io diff --git a/samples/server/petstore/lumen/app/Http/controllers/StoreApi.php b/samples/server/petstore/lumen/app/Http/controllers/StoreApi.php index f98782b520..4eae1e17c9 100644 --- a/samples/server/petstore/lumen/app/Http/controllers/StoreApi.php +++ b/samples/server/petstore/lumen/app/Http/controllers/StoreApi.php @@ -2,7 +2,7 @@ /** * Swagger Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io diff --git a/samples/server/petstore/lumen/app/Http/controllers/UserApi.php b/samples/server/petstore/lumen/app/Http/controllers/UserApi.php index 710c9e2995..331c90525e 100644 --- a/samples/server/petstore/lumen/app/Http/controllers/UserApi.php +++ b/samples/server/petstore/lumen/app/Http/controllers/UserApi.php @@ -2,7 +2,7 @@ /** * Swagger Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io diff --git a/samples/server/petstore/lumen/app/Http/routes.php b/samples/server/petstore/lumen/app/Http/routes.php index d07792b9d0..c61d6d3c4d 100644 --- a/samples/server/petstore/lumen/app/Http/routes.php +++ b/samples/server/petstore/lumen/app/Http/routes.php @@ -2,7 +2,7 @@ /** * Swagger Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io @@ -40,6 +40,13 @@ $app->get('/', function () use ($app) { * Output-Formats: [application/xml; charset=utf-8, application/json; charset=utf-8] */ $app->POST('/fake', 'FakeApi@testEndpointParameters'); +/** + * GET testEnumQueryParameters + * Summary: To test enum query parameters + * Notes: + * Output-Formats: [application/json] + */ +$app->GET('/fake', 'FakeApi@testEnumQueryParameters'); /** * POST addPet * Summary: Add a new pet to the store