Project: KICS (Provisioning / Security & Compliance)
File: a19c3bbd-c056-40d7-9e1c-eeb0634e320d.md

title: Additional Properties Too Restrictive hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: a19c3bbd-c056-40d7-9e1c-eeb0634e320d Query name: Additional Properties Too Restrictive Platform: OpenAPI Severity: <span style="color:#edd57e">Low</span> Category: Insecure Configurations URL: Objects should accept 'additionalProperties' if it is allOf or an object with anyOf or oneOf<br> ```json title="Positive test num. 1 - json file" hl_lines="41" { "openapi": "3.0.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersionsv2", "summary": "List API versions", "responses": { "200": { "schema": { "allOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "additionalProperties": "true" }, { "type": "string" } ] } } } } } }, "components": { "schemas": { "MyObject": { "oneOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "additionalProperties": "false" }, { "type": "string", "additionalProperties": "false" } ] } } } } ``` ```yaml title="Positive test num. 2 - yaml file" hl_lines="25" openapi: 3.0.0 info: title: Simple API Overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions responses: '200': schema: allOf: type: object properties: id: type: string name: type: string additionalProperties: 'true' type: string components: schemas: MyObject: oneOf: type: object properties: id: type: string name: type: string additionalProperties: 'false' type: string additionalProperties: 'false' ``` ```json title="Positive test num. 3 - json file" hl_lines="15" { "openapi": "3.0.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersionsv2", "summary": "List API versions", "responses": { "200": { "schema": { "allOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "additionalProperties": "false" }, { "type": "string" } ] } } } } } }, "components": { "schemas": { "MyObject": { "oneOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "additionalProperties": "true" }, { "type": "string", "additionalProperties": "false" } ] } } } } ``` <details><summary>Positive test num. 4 - yaml file</summary> ```yaml hl_lines="13" openapi: 3.0.0 info: title: Simple API Overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions responses: '200': schema: allOf: type: object properties: id: type: string name: type: string additionalProperties: 'false' type: string components: schemas: MyObject: oneOf: type: object properties: id: type: string name: type: string additionalProperties: 'true' type: string additionalProperties: 'false' ``` </details> ```json title="Negative test num. 1 - json file" { "openapi": "3.0.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersionsv2", "summary": "List API versions", "responses": { "200": { "schema": { "allOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "additionalProperties": "true" }, { "type": "string" } ] } } } } } }, "components": { "schemas": { "MyObject": { "oneOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "additionalProperties": "true" }, { "type": "string", "additionalProperties": "false" } ] } } } } ``` ```yaml title="Negative test num. 2 - yaml file" openapi: 3.0.0 info: title: Simple API Overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions responses: '200': schema: allOf: type: object properties: id: type: string name: type: string additionalProperties: 'true' type: string components: schemas: MyObject: oneOf: type: object properties: id: type: string name: type: string additionalProperties: 'true' type: string additionalProperties: 'false' ```