Enforce API Schema
CloudGuard AppSec's Schema Validation engine validates that API input conforms to the schema provided by the admin.
The admin provides the schema (using the OpenAPI specification, or OAS in short) and enhances the ability of AppSec to detect and prevent illegal requests that do not comply.
The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic.
An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases.
- Create one from your existing API.
- Make sure to have a process where updates in the API specification of the application also recreate the YAML file and upload it to CloudGuard AppSec for each update.
Once the asset edit window opens, select the Threat Prevention tab and scroll to the Schema Validation sub-practice.
Click on the Upload button the file selection window will appear:
- Click the "Add File" icon to add a new file.
- Optionally - you can click the "Download" icon to verify an existing file's content.
- Select the file you wish to be used for schema validation.
- Click OK.
When making the first change to the default Web API Best Practice's configuration such as uploading your unique OpenAPI schema file for Schema Validation purposes, you will be prompted to change the name of the Practice to your own custom practice name.
Setting the Mode to As Top Level means inheriting the primary mode of the practice.
Otherwise you can override it only for this specific sub-practice to Detect/Prevent/Disable.
It is recommended to initially set the mode to "Detect" to verify the input schema file is correct by looking at the logs created by this capability. Afterwards, restore the mode to the desired state.
Click Enforce on the top banner of the Infinity Portal.