Skip to content

Commit bede51c

Browse files
claudiacodacyjoanasteodoroafsmeira
authored
feat: document DAST api scanning TAROT-3391 (#2411)
* feat: add info on API scanning * feat: API definition docs * clean: slight fixes in api request table * clean: formating and ponctuation * Apply suggestions from code review Co-authored-by: Joana Teodoro <joana.teodoro@codacy.com> * Apply suggestions from code review Co-authored-by: André Meira <6381457+afsmeira@users.noreply.github.com> * Update docs/organizations/managing-security-and-risk.md --------- Co-authored-by: Joana Teodoro <joana.teodoro@codacy.com> Co-authored-by: André Meira <6381457+afsmeira@users.noreply.github.com>
1 parent e00c24c commit bede51c

2 files changed

Lines changed: 70 additions & 33 deletions

File tree

docs/codacy-api/examples/triggering-dast-scans.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,45 @@ Thanks to the new app scanning capabilities available on the Security and risk m
1414

1515
## Creating targets
1616

17-
Before the automation process itself, you need to create a target. Targets are single units that contain all the configurations of your scan, in this case the URL (and later on other configurations, like authentication details and OpenAPI definition).
18-
Targets only need to be defined once. The target's URL is immutable, so, if you need to change it, you'll need to delete the target and create a new one.
17+
Before the automation process itself, you need to create a target. Targets are individual configurations that define what Codacy will scan, including the target URL, its type (API or web application), and other type-dependent fields like OpenAPI specification and optional authentication details for API targets.
1918

20-
To create a target:
19+
Targets only need to be created once. Note that **targets are immutable** — if you need to change the URL, definition, or authentication, you'll need to delete the target and create a new one.
20+
21+
To create a target, use the following API request:
2122

2223
```bash
2324
curl -X POST https://app.codacy.com/api/v3/organizations/{GIT_PROVIDER}/{ORGANIZATION}/dast/targets \
2425
-H "Content-Type: application/json" \
2526
-H "Accept: application/json" \
2627
-H "api-token: {API_KEY}" \
27-
-d '{"url": "https://api.domain.com/v1"}'
28+
-d '{
29+
"url": {TARGET_URL},
30+
"targetType": {TARGET_TYPE},
31+
"apiDefinitionUrl": {API_DEFINITION_URL},
32+
"apiAuthHeaders": {
33+
"{HEADER_NAME}": "{HEADER_VALUE}"
34+
}
35+
}'
2836
```
2937

3038
Replace the placeholders with your own values:
3139

32-
- **API_KEY:** [Account API token](../api-tokens.md#account-api-tokens) used to authenticate on the Codacy API.
33-
- **GIT_PROVIDER:** Git provider hosting of the organization, using one of the values in the table below. For example, `gh` for GitHub Cloud.
34-
35-
| Value | Git provider |
36-
|-------|-------------------|
37-
| `gh` | GitHub Cloud |
38-
| `ghe` | GitHub Enterprise |
39-
| `gl` | GitLab Cloud |
40-
| `gle` | GitLab Enterprise |
41-
| `bb` | Bitbucket Cloud |
42-
| `bbe` | Bitbucket Server |
43-
44-
- **ORGANIZATION:** Name of the organization on the Git provider. For example, `codacy`. You must have admin permissions over the organization on the Git provider.
40+
| Field | Required | Description |
41+
|-------|----------|-------------|
42+
| **API_KEY** | true | [Account API token](../api-tokens.md#account-api-tokens) used to authenticate on the Codacy API |
43+
| **GIT_PROVIDER** | true | Git provider hosting of the organization, using one of the values in the table below. <br/>**Options:** `gh` (GitHub Cloud), `ghe`(GitHub Enterprise), `gl` (Gitlab Cloud), `gle` (Gitlab Enterprise), `bb` (Bitbucket Cloud), `bbe` (Bitbucket Server) |
44+
| **ORGANIZATION** | true | Name of the organization on the Git provider. You must have admin permissions over the organization on the Git provider.<br/>For example, `codacy` |
45+
| **TARGET_URL** | true | URL of the Web app or API that will be scanned. <br/>Must start with `http://` or `https://`<br/>For example, `https://api.codacy.com/v1`|
46+
| **TARGET_TYPE** | false | Type of target to be scanned <br/> **Options:** `webapp` (default), `openapi` or `graphql`|
47+
| **API_DEFINITION_URL** | false * | The URL to a publicly accessible OpenAPI specification.<br/>*** Required for OpenAPI targets**|
48+
| **HEADER_NAME** | false | Name of the authentication header. <br/>For example, `Authentication`|
49+
| **HEADER_VALUE** | false | Value of the authentication header. <br/>For example, a token or API key|
4550

4651
Once you create the target you'll get the target `id` as a response. You will use it to trigger DAST scans in the next section.
4752

53+
!!! important
54+
Currently we only support one authentication header. If you need more, please let us know via support or your account representative.
55+
4856
## Trigger DAST analysis scans
4957

5058
Once your targets are created you can trigger an analysis by calling the '[Analyze DAST target](https://api.codacy.com/api/api-docs#analyzedasttarget)' endpoint.

docs/organizations/managing-security-and-risk.md

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -562,46 +562,75 @@ You're also able to click any dependency to find out more information about it.
562562
!!! important
563563
App scanning is a business feature. If you are a Codacy Pro customer, contact our customer success team to access a short trial.
564564

565-
The **Security and risk management app scanning** page allows organizations to scan APIs and Web Applications for security vulnerabilities. This is part of our DAST (Dynamic Application Security Testing) capabilities, powered by ZAP.
565+
The **Security and risk management > App scanning** page allows organizations to scan Web Applications and APIs for security vulnerabilities. This feature is part of Codacy's Dynamic Application Security Testing (DAST) capabilities, powered by ZAP.
566566

567-
To access the app scanning page, access the [overview page](#dashboard) and click the **App scanning** tab.
567+
To access the App scanning page, go to the [Overview page](#dashboard) and click the **App scanning** tab.
568568

569569
![Security and risk management app scanning page](images/security-risk-management-app-scanning.png)
570570

571-
App scanning tests applications in real-world scenarios, making it possible to find configuration and authentication issues or other runtime vulnerabilities that may impact your application’s functionality and security. It’s also a good method for preventing regressions and doesn’t depend on a specific programming language. As long as the application can be accessed through a browser, a DAST tool can typically scan it for vulnerabilities.
571+
App scanning analyzes applications in production or production-like environments to help identify vulnerabilities such as misconfigurations, insecure authentication, or other security issues that occur in real-world usage. Because it doesn't rely on access to source code, it’s language-agnostic and useful for validating security across your entire stack.
572572

573-
In concrete, when you start a scan, Codacy runs a baseline scan using ZAP. This is a non-intrusive scan that identifies common security issues without actively attacking your application.
574-
It’s safe to run for production applications and helps detect problems like missing security headers, information disclosure through HTTP response headers, insecure cookie configurations, and others.
573+
Codacy supports two types of scanning:
574+
575+
- **Web application scans** perform baseline, non-intrusive analysis. These scans are safe for production environments and detect surface-level issues such as:
576+
- Missing security headers
577+
- Insecure cookie configurations
578+
- Information disclosure through HTTP response headers
579+
- Exposure of sensitive or misconfigured files
580+
581+
- **API scans** simulate real-world attacks against your API endpoints. These are more aggressive and best suited for **non-production environments**, such as staging or development. API scans provide deeper insights into runtime behavior and potential vulnerabilities, such as:
582+
- Broken authentication or authorization controls
583+
- Injection vulnerabilities (SQL or command injection)
584+
- Exposure of sensitive data in API responses
585+
- Insecure CORS or HTTP method configurations
575586

576587
!!! note
577588
Already using ZAP? [Upload your results via the API.](../codacy-api/examples/uploading-dast-results.md)
578589

579-
### How to scan a target
580-
To scan a target, you can either go to the Security and risk management dashboard and access the App Scanning tab, or set it up for automation using our API.
590+
## Creating an App Scanning target
591+
592+
When creating a scan target, you'll be able to choose between a Web App or an API. Configuring a Web App will only require a target URL, while APIs will have other requirements:
593+
594+
- **REST APIs**, which require a publicly accessible OpenAPI specification URL.
595+
- **GraphQL APIs**, where the schema is inferred from the default path `{targetUrl}/graphql`.
596+
597+
API targets optionally support **header-based authentication**. As you create a target, keep in mind you may not be able to view or change certain fields later (to change your configurations you may need to delete and create a new target).
598+
599+
!!! important
600+
Avoid running API scans on production enviroments as our API scanners may cause potential downtime.
581601

582602
!!! important
583-
Only [admins and organization managers](../organizations/roles-and-permissions-for-organizations.md) will be able to create new targets and run scans (both in-app and via the API).
603+
If exposing your API specification isn't feasible for your team, let us know via support or your account representative.
604+
605+
606+
### How to scan a target
584607

608+
You can initiate scans in two ways:
609+
- From the **App scanning** tab in the Security and risk management dashboard
610+
- By automating scans using [Codacy's API](../codacy-api/examples/triggering-dast-scans.md)
611+
612+
!!! important
613+
Only [admins and organization managers](../organizations/roles-and-permissions-for-organizations.md) can create targets and start scans, both in-app and via the API.
585614

586615
<div>
587616
<iframe width="100%" height="472" src="https://www.youtube.com/embed/qPwHlIGJYXs?autoplay=1&mute=1&showinfo=0&loop=1" title="DAST targets" frameborder="0"
588617
allowfullscreen>
589618
</iframe>
590619
</div>
591620

621+
Each organization can have up to **6 active scan targets**. If you need additional capacity, contact your customer success representative.
622+
623+
Scans are triggered manually through the UI and are queued before execution. You can queue one single scan per target — it will run sequentially. There is no limit to the number of scans you can run on a target, in order to support your deployment needs.
592624

593-
From within the tab, you're able to configure a new target by inputting the URL of the app you'd like to scan. You can configure up to 6 targets within your organization (if you need more, talk to your customer success representative).
594-
Scans can be triggered manually via Codacy's UI. As you click to start a scan, it will be first added to a queue and eventually executed. You can also queue a scan for a target that is already being scanned, and it will eventually execute after the current scan finishes. There are no limits to how many scans an organization can run per target, so this should accommodate all your deployment needs.
595-
Once a scan is complete, its findings will be added to the findings tab, where you can review them using the filter **Scan types > DAST/App scanning**.
625+
Once a scan completes, results will be available under the **Findings** tab. Use the **Scan types > DAST/App scanning** filter to view relevant findings.
596626

597627
!!! important
598-
Depending on the application being scanned, a DAST analysis can take a very long time to complete.
599-
To guarantee the stability of Codacy's platform and fair access to analysis slots, DAST analysis can timeout when running for too long.
628+
Depending on the complexity of the target, DAST scans can take a significant amount of time to complete. Codacy may enforce timeouts to ensure platform stability and fair resource distribution.
600629

601630
!!! important
602-
Failed analysis are retried a number of times according to their failure reason. A retry will re-enqueue the analysis, to be executed as soon as possible, while respecting the available analysis slots.
631+
Failed scans are retried based on the failure reason. Retries are added back to the queue automatically and processed when capacity allows.
603632

604633
!!! note
605-
Currently, DAST issues are only visible to admin and organization admin roles.
634+
Currently, DAST findings are only visible to admin and organization admin roles.
606635

607-
Follow our [roadmap](https://roadmap.codacy.com) for the upcoming updates on this feature.
636+
Follow our [roadmap](https://roadmap.codacy.com) for updates on this feature.

0 commit comments

Comments
 (0)