-
Notifications
You must be signed in to change notification settings - Fork 10.1k
[API Shield] JSON POST body formats #22112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ pcx_content_type: how-to | |
| type: overview | ||
| title: API Routing | ||
| sidebar: | ||
| order: 3 | ||
| order: 4 | ||
|
|
||
| --- | ||
|
|
||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ pcx_content_type: how-to | |
| type: overview | ||
| title: Build developer portals | ||
| sidebar: | ||
| order: 4 | ||
| order: 5 | ||
|
|
||
| --- | ||
|
|
||
|
|
||
This file contains hidden or 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
138 changes: 138 additions & 0 deletions
138
...content/docs/api-shield/management-and-monitoring/endpoint-management/index.mdx
This file contains hidden or 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,138 @@ | ||
| --- | ||
| pcx_content_type: concept | ||
| type: overview | ||
| title: Endpoint Management | ||
| sidebar: | ||
| order: 1 | ||
|
|
||
| --- | ||
|
|
||
| import { GlossaryTooltip, Plan } from "~/components" | ||
|
|
||
| <Plan type="all" /> | ||
|
|
||
| Monitor the health of your <GlossaryTooltip term="API endpoint">API endpoints</GlossaryTooltip> by saving, updating, and monitoring performance metrics using API Shield’s Endpoint Management. | ||
|
|
||
| **Add endpoints** allows customers to save endpoints directly from [API Discovery](/api-shield/security/api-discovery/) or manually by method, path, and host. | ||
|
|
||
| This will add the specified endpoints to your list of managed endpoints. You can view your list of saved endpoints in the **Endpoint Management** page. | ||
|
|
||
| Cloudflare will start collecting [performance data](/api-shield/management-and-monitoring/#endpoint-analysis) on your endpoint when you save an endpoint. | ||
|
|
||
| :::note | ||
|
|
||
| When an endpoint is using [Cloudflare Workers](/workers/), the metrics data will not be populated. | ||
| ::: | ||
|
|
||
| ## Access | ||
|
|
||
| 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login) and select your account and domain. | ||
| 2. Select **Security** > **API Shield**. | ||
| 3. Add your endpoints [manually](#add-endpoints-manually), from [Schema validation](#add-endpoints-from-schema-validation), or from [API Discovery](#add-endpoints-from-api-discovery). | ||
|
|
||
| ## Add endpoints from API Discovery | ||
|
|
||
| There are two ways to add API endpoints from Discovery. | ||
|
|
||
| ### Add from the Endpoint Management Tab | ||
|
|
||
| 1. From Endpoint Management, select **Add endpoints** > **Select from Discovery** tab. | ||
| 2. Select the discovered endpoints you would like to add. | ||
| 3. Select **Add endpoints**. | ||
|
|
||
| ### Add from the Discovery Tab | ||
|
|
||
| 1. From Endpoint Management, select the **Discovery** tab. | ||
| 2. Select the discovered endpoints you would like to add. | ||
| 3. Select **Save selected endpoints**. | ||
|
|
||
| ## Add endpoints from Schema validation | ||
|
|
||
| 1. Add a schema by [configuring Schema validation](/api-shield/security/schema-validation/). | ||
| 2. On **Review schema endpoints**, save new endpoints to endpoint management by checking the box. | ||
| 3. Select **Save as draft** or **Save and Deploy**. Endpoints will be saved regardless of whether the Schema is saved as a draft or published. | ||
|
|
||
| API Shield will look for duplicate endpoints that have the same host, method, and path. Duplicate endpoints will not be saved to endpoint management. | ||
|
|
||
| :::note | ||
|
|
||
| If you deselect **Save new endpoints to endpoint management**, the endpoints will not be added. | ||
| ::: | ||
|
|
||
| ## Add endpoints manually | ||
|
|
||
| 1. From Endpoint Management, select **Add endpoints** > **Manually add**. | ||
| 2. Choose the method from the dropdown menu and add the path and hostname for the endpoint. | ||
| 3. Select **Add endpoints**. | ||
|
|
||
| :::note | ||
|
|
||
| By selecting multiple checkboxes, you can add several endpoints from Discovery at once instead of individually. | ||
| ::: | ||
|
|
||
| When adding an endpoint manually, you can specify variable fields in the path or host by enclosing them in braces, `/api/user/{var1}/details` or `{hostVar1}.example.com`. | ||
|
|
||
| Cloudflare supports hostname variables in the following formats: | ||
|
|
||
| ```txt | ||
| {hostVar1}.example.com | ||
| foo.{hostVar1}.example.com | ||
| {hostVar2}.{hostVar1}.example.com | ||
| ``` | ||
|
|
||
| Hostname variables must comprise the entire domain field and must not be used with other text in the field. | ||
|
|
||
| The following format is not supported: | ||
|
|
||
| ```txt | ||
| foo-{hostVar1}.example.com | ||
| ``` | ||
|
|
||
| For more information on how Cloudflare uses variables in API Shield, refer to the examples from [API Discovery](/api-shield/security/api-discovery/). | ||
|
|
||
| ## Delete endpoints manually | ||
|
|
||
| You can delete endpoints one at a time or in bulk. | ||
|
|
||
| 1. From Endpoint Management, select the checkboxes for the endpoints that you want to delete. | ||
| 2. Select **Delete endpoints**. | ||
|
|
||
| ## Endpoint Analysis | ||
|
|
||
| For each saved endpoint, customers can view: | ||
|
|
||
| - **Request count**: The total number of requests to the endpoint over time. | ||
| - **Rate limiting recommendation**: per 10 minutes. This is guided by the request count. | ||
| - **Latency**: The average origin response time in milliseconds (ms). This metric shows how long it takes from the moment a visitor makes a request to the moment the visitor gets a response back from the origin. | ||
| - **Error rate** vs. overall traffic: grouped by 4xx, 5xx, and their sum. | ||
| - **Response size**: The average size of the response (in bytes) returned to the request. | ||
| - **Labels**: The current [labels](/api-shield/management-and-monitoring/endpoint-labels/) assigned to the endpoint. | ||
| - **Authentication status**: The breakdown of which [session identifiers](/api-shield/get-started/#session-identifiers) were seen on successful requests to this endpoint. | ||
| - **Sequences**: The number of [Sequence Analytics](/api-shield/security/sequence-analytics/) sequences the endpoint was found in. | ||
|
|
||
| :::note | ||
|
|
||
| Customers viewing analytics have the ability to toggle detailed metrics view between the last 24 hours and 7 days. | ||
| ::: | ||
|
|
||
| ## Using the Cloudflare API | ||
|
|
||
| You can interact with Endpoint Management through the Cloudflare API. Refer to [Endpoint Management’s API documentation](/api/resources/api_gateway/subresources/discovery/subresources/operations/methods/list/) for more information. | ||
|
|
||
| ## Sensitive Data Detection | ||
|
|
||
| Sensitive data comprises various personally identifiable information and financial data. Cloudflare created this ruleset to address common data loss threats, and the WAF can search for this data in HTTP response bodies from your origin. | ||
|
|
||
| API Shield will alert users to the presence of sensitive data in the response body of API endpoints listed in Endpoint Management if the zone is also subscribed to the [Sensitive Data Detection managed ruleset](/waf/managed-rules/reference/sensitive-data-detection/). | ||
|
|
||
| Sensitive Data Detection is available to Enterprise customers on our Advanced application security plan. | ||
|
|
||
| Once Sensitive Data Detection is enabled for your zone, API Shield queries firewall events from the WAF for the last seven days and places a notification icon on the Endpoint Management table row if there are any matched sensitive responses for your endpoint. | ||
|
|
||
| API Shield displays the types of sensitive data found if you expand the Endpoint Management table row to view further details. Select **Explore Events** to view the matched events in Security Events. | ||
|
|
||
| After Sensitive Data Detection is enabled for your zone, you can [browse the Sensitive Data Detection ruleset](https://dash.cloudflare.com/?to=/:account/:zone/security/data/ruleset/e22d83c647c64a3eae91b71b499d988e/rules). The link will not work if Sensitive Data Detection is not enabled. |
47 changes: 47 additions & 0 deletions
47
...cs/api-shield/management-and-monitoring/endpoint-management/schema-learning.mdx
This file contains hidden or 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,47 @@ | ||
| --- | ||
| pcx_content_type: concept | ||
| type: overview | ||
| title: Schema learning | ||
| sidebar: | ||
| order: 2 | ||
| --- | ||
|
|
||
| Cloudflare learns schema parameters via traffic inspection. For all endpoints saved to Endpoint Management, you can export the learned schema in OpenAPI `v3.0.0` format by hostname. | ||
|
|
||
| To protect your API with a learned schema, refer to [Schema validation](/api-shield/security/schema-validation/#add-validation-by-applying-a-learned-schema-to-an-entire-hostname). | ||
|
|
||
| ## Export a schema | ||
|
|
||
| 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/) and select your account and domain. | ||
| 2. Select **Security** > **API Shield**. | ||
| 3. Navigate to **Endpoint Management**. | ||
| 4. Select **Export schema** and choose a hostname to export. | ||
| 5. Select whether to include [learned parameters](/api-shield/management-and-monitoring/#learned-schemas-will-always-include) and [rate limit recommendations](/api-shield/security/volumetric-abuse-detection/) | ||
| 6. Select **Export schema** and choose a location to save the file. | ||
|
|
||
| :::note | ||
| The schema is saved as a JSON file in OpenAPI `v3.0.0` format. | ||
| ::: | ||
|
|
||
| Learned schemas will always include: | ||
|
|
||
| - The listed hostname in the servers section | ||
| - All endpoints by host, method, and path | ||
|
|
||
| For endpoints that receive sufficient traffic, learned schemas will also include: | ||
|
|
||
| - Detected path variables and formats | ||
| - Detected query parameters and formats | ||
| - Detected `POST`, `PUT`, and `PATCH` body variable names and formats for `application/json` content types | ||
|
|
||
| Learned schemas can optionally include: | ||
|
|
||
| - API Shield's rate limit threshold recommendations | ||
|
|
||
| ## Limitations | ||
|
|
||
| Endpoints must be added for at least 24 hours before schema learning begins. Schema learning is a continuous process that inspects the last 72 hours of traffic to an endpoint. | ||
|
|
||
| Schema learning only learns from requests with `2xx` response codes. | ||
|
|
||
| Schema learning works best with high volumes of traffic. You may see less confident learned schemas for endpoints with less than 10,000 requests in the last 72 hours. | ||
167 changes: 3 additions & 164 deletions
167
src/content/docs/api-shield/management-and-monitoring/index.mdx
This file contains hidden or 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 |
|---|---|---|
| @@ -1,170 +1,9 @@ | ||
| --- | ||
| pcx_content_type: concept | ||
| type: overview | ||
| pcx_content_type: reference | ||
| title: Management and Monitoring | ||
| sidebar: | ||
| order: 6 | ||
| label: Endpoint Management | ||
| group: | ||
| hideIndex: true | ||
|
|
||
| --- | ||
|
|
||
| import { GlossaryTooltip, Plan } from "~/components" | ||
|
|
||
| <Plan type="all" /> | ||
|
|
||
| Monitor the health of your <GlossaryTooltip term="API endpoint">API endpoints</GlossaryTooltip> by saving, updating, and monitoring performance metrics using API Shield’s Endpoint Management. | ||
|
|
||
| **Add endpoints** allows customers to save endpoints directly from [API Discovery](/api-shield/security/api-discovery/) or manually by method, path, and host. | ||
|
|
||
| This will add the specified endpoints to your list of managed endpoints. You can view your list of saved endpoints in the **Endpoint Management** page. | ||
|
|
||
| Cloudflare will start collecting [performance data](/api-shield/management-and-monitoring/#endpoint-analysis) on your endpoint when you save an endpoint. | ||
|
|
||
| :::note | ||
|
|
||
| When an endpoint is using [Cloudflare Workers](/workers/), the metrics data will not be populated. | ||
| ::: | ||
|
|
||
| ## Access | ||
|
|
||
| 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login) and select your account and domain. | ||
| 2. Select **Security** > **API Shield**. | ||
| 3. Add your endpoints [manually](#add-endpoints-manually), from [Schema validation](#add-endpoints-from-schema-validation), or from [API Discovery](#add-endpoints-from-api-discovery). | ||
|
|
||
| ## Add endpoints from API Discovery | ||
|
|
||
| There are two ways to add API endpoints from Discovery. | ||
|
|
||
| ### Add from the Endpoint Management Tab | ||
|
|
||
| 1. From Endpoint Management, select **Add endpoints** > **Select from Discovery** tab. | ||
| 2. Select the discovered endpoints you would like to add. | ||
| 3. Select **Add endpoints**. | ||
|
|
||
| ### Add from the Discovery Tab | ||
|
|
||
| 1. From Endpoint Management, select the **Discovery** tab. | ||
| 2. Select the discovered endpoints you would like to add. | ||
| 3. Select **Save selected endpoints**. | ||
|
|
||
| ## Add endpoints from Schema validation | ||
|
|
||
| 1. Add a schema by [configuring Schema validation](/api-shield/security/schema-validation/). | ||
| 2. On **Review schema endpoints**, save new endpoints to endpoint management by checking the box. | ||
| 3. Select **Save as draft** or **Save and Deploy**. Endpoints will be saved regardless of whether the Schema is saved as a draft or published. | ||
|
|
||
| API Shield will look for duplicate endpoints that have the same host, method, and path. Duplicate endpoints will not be saved to endpoint management. | ||
|
|
||
| :::note | ||
|
|
||
| If you deselect **Save new endpoints to endpoint management**, the endpoints will not be added. | ||
| ::: | ||
|
|
||
| ## Add endpoints manually | ||
|
|
||
| 1. From Endpoint Management, select **Add endpoints** > **Manually add**. | ||
| 2. Choose the method from the dropdown menu and add the path and hostname for the endpoint. | ||
| 3. Select **Add endpoints**. | ||
|
|
||
| :::note | ||
|
|
||
| By selecting multiple checkboxes, you can add several endpoints from Discovery at once instead of individually. | ||
| ::: | ||
|
|
||
| When adding an endpoint manually, you can specify variable fields in the path or host by enclosing them in braces, `/api/user/{var1}/details` or `{hostVar1}.example.com`. | ||
|
|
||
| Cloudflare supports hostname variables in the following formats: | ||
|
|
||
| ```txt | ||
| {hostVar1}.example.com | ||
| foo.{hostVar1}.example.com | ||
| {hostVar2}.{hostVar1}.example.com | ||
| ``` | ||
|
|
||
| Hostname variables must comprise the entire domain field and must not be used with other text in the field. | ||
|
|
||
| The following format is not supported: | ||
|
|
||
| ```txt | ||
| foo-{hostVar1}.example.com | ||
| ``` | ||
|
|
||
| For more information on how Cloudflare uses variables in API Shield, refer to the examples from [API Discovery](/api-shield/security/api-discovery/). | ||
|
|
||
| ## Delete endpoints manually | ||
|
|
||
| You can delete endpoints one at a time or in bulk. | ||
|
|
||
| 1. From Endpoint Management, select the checkboxes for the endpoints that you want to delete. | ||
| 2. Select **Delete endpoints**. | ||
|
|
||
| ## Endpoint schema learning | ||
|
|
||
| Cloudflare learns schema parameters via traffic inspection. For all endpoints saved to Endpoint Management, you can export OpenAPI schemas in `v3.0.0` format by hostname. You can also include learned schema parameters. | ||
|
|
||
| To protect your API with a learned schema, refer to [Schema validation](/api-shield/security/schema-validation/#add-validation-by-applying-a-learned-schema-to-an-entire-hostname). | ||
|
|
||
| ### Export a schema | ||
|
|
||
| 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/) and select your account and domain. | ||
| 2. Select **Security** > **API Shield**. | ||
| 3. Navigate to **Endpoint Management**. | ||
| 4. Select **Export schema** and choose a hostname to export. | ||
| 5. Select whether to include [learned parameters](/api-shield/management-and-monitoring/#learned-schemas-will-always-include) and [rate limit recommendations](/api-shield/security/volumetric-abuse-detection/) | ||
| 6. Select **Export schema** and choose a location to save the file. | ||
|
|
||
| :::note | ||
|
|
||
| The schema is saved as a JSON file in OpenAPI `v3.0.0` format. | ||
| ::: | ||
|
|
||
| #### Learned schemas will always include: | ||
|
|
||
| - The listed hostname in the servers section | ||
| - All endpoints by host, method, and path | ||
| - Detected path variables | ||
|
|
||
| #### Learned schemas can optionally include: | ||
|
|
||
| - Detected query parameters and its format | ||
| - API Shield’s rate limit threshold recommendations | ||
|
|
||
| ## Endpoint Analysis | ||
|
|
||
| For each saved endpoint, customers can view: | ||
|
|
||
| - **Request count**: The total number of requests to the endpoint over time. | ||
| - **Rate limiting recommendation**: per 10 minutes. This is guided by the request count. | ||
| - **Latency**: The average origin response time in milliseconds (ms). This metric shows how long it takes from the moment a visitor makes a request to the moment the visitor gets a response back from the origin. | ||
| - **Error rate** vs. overall traffic: grouped by 4xx, 5xx, and their sum. | ||
| - **Response size**: The average size of the response (in bytes) returned to the request. | ||
| - **Labels**: The current [labels](/api-shield/management-and-monitoring/endpoint-labels/) assigned to the endpoint. | ||
| - **Authentication status**: The breakdown of which [session identifiers](/api-shield/get-started/#session-identifiers) were seen on successful requests to this endpoint. | ||
| - **Sequences**: The number of [Sequence Analytics](/api-shield/security/sequence-analytics/) sequences the endpoint was found in. | ||
|
|
||
| :::note | ||
|
|
||
| Customers viewing analytics have the ability to toggle detailed metrics view between the last 24 hours and 7 days. | ||
| ::: | ||
|
|
||
| ## Using the Cloudflare API | ||
|
|
||
| You can interact with Endpoint Management through the Cloudflare API. Refer to [Endpoint Management’s API documentation](/api/resources/api_gateway/subresources/discovery/subresources/operations/methods/list/) for more information. | ||
|
|
||
| ## Sensitive Data Detection | ||
|
|
||
| Sensitive data comprises various personally identifiable information and financial data. Cloudflare created this ruleset to address common data loss threats, and the WAF can search for this data in HTTP response bodies from your origin. | ||
|
|
||
| API Shield will alert users to the presence of sensitive data in the response body of API endpoints listed in Endpoint Management if the zone is also subscribed to the [Sensitive Data Detection managed ruleset](/waf/managed-rules/reference/sensitive-data-detection/). | ||
|
|
||
| Sensitive Data Detection is available to Enterprise customers on our Advanced application security plan. | ||
|
|
||
| Once Sensitive Data Detection is enabled for your zone, API Shield queries firewall events from the WAF for the last seven days and places a notification icon on the Endpoint Management table row if there are any matched sensitive responses for your endpoint. | ||
|
|
||
| API Shield displays the types of sensitive data found if you expand the Endpoint Management table row to view further details. Select **Explore Events** to view the matched events in Security Events. | ||
|
|
||
| After Sensitive Data Detection is enabled for your zone, you can [browse the Sensitive Data Detection ruleset](https://dash.cloudflare.com/?to=/:account/:zone/security/data/ruleset/e22d83c647c64a3eae91b71b499d988e/rules). The link will not work if Sensitive Data Detection is not enabled. |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ pcx_content_type: how-to | |
| type: overview | ||
| title: Session identifiers | ||
| sidebar: | ||
| order: 2 | ||
| order: 3 | ||
|
|
||
| --- | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 26-47 of this page is new content