Skip to content

Commit d6c5f4b

Browse files
Maffoochclaude
andauthored
docs(sensei): Sensei documentation chapter (GitHub and GitLab) (#15308)
* docs(sensei): add Sensei chapter as its own top-level tab Document DefectDojo Pro's Sensei (AI scan-and-fix) feature as a new top-level docs tab with a multi-page chapter: - content/sensei/: About, Set Up, Fixing Findings, Reference (audience: pro) plus an Open Source "Pro-only feature" explainer (OS__sensei.md). - menus.en.toml: Sensei top-level tab + sidebar_sensei section menu. - params.toml: add "sensei" to doks.sectionNav so the chapter renders a left sidebar. - custom.js: generalize the edition-aware top-nav so the Sensei tab swaps between the OS explainer and the Pro guide (mirrors "Model Your Assets"). - pro_features.md: add a Sensei entry linking to the guide. - Screenshots captured from a DefectDojo-org demo repo (no internal repos). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(sensei): document GitLab connectivity and clean prose Add the GitLab portion of the Sensei docs alongside the existing GitHub content: a "Connect GitLab" section (access-token scopes/role, base URL, webhook setup), a provider note in About, and a "GitLab specifics" reference section (merge requests, commit-status gate, self-managed). Also remove em dashes and tidy phrasing across the Sensei chapter for a consistent, plain style. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 26a73be commit d6c5f4b

27 files changed

Lines changed: 456 additions & 23 deletions

docs/assets/js/custom.js

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,34 @@ window.ddOffcanvas = Offcanvas;
2222
(() => {
2323
"use strict";
2424

25-
// Asset-modelling landing pages per edition. The top nav is otherwise
26-
// static, so a single URL can't be correct for both editions: we keep the
27-
// "Model Your Assets" nav link in sync with the selected version, and —
28-
// when the user is already viewing one of these pages — navigate to the
29-
// matching edition's page so the main content follows the toggle.
30-
const assetNavUrls = {
31-
opensource: "/asset_modelling/engagements_tests/os__assets/",
32-
pro: "/asset_modelling/pro_hierarchy/asset_hierarchy/",
25+
// Edition-specific landing pages per top-nav tab. The top nav is otherwise
26+
// static, so a single URL can't be correct for both editions: we keep these
27+
// nav links in sync with the selected version, and — when the user is
28+
// already viewing one of these pages — navigate to the matching edition's
29+
// page so the main content follows the toggle. Keyed by nav-link label.
30+
const editionNavUrls = {
31+
"Model Your Assets": {
32+
opensource: "/asset_modelling/engagements_tests/os__assets/",
33+
pro: "/asset_modelling/pro_hierarchy/asset_hierarchy/",
34+
},
35+
// Sensei is Pro-only: Open Source shows a short "Pro feature" page,
36+
// Pro shows the full guide.
37+
"Sensei": {
38+
opensource: "/sensei/os__sensei/",
39+
pro: "/sensei/about_sensei/",
40+
},
3341
};
3442

35-
const switchAssetPageForVersion = (version) => {
36-
const target = assetNavUrls[version];
37-
const other = assetNavUrls[version === "pro" ? "opensource" : "pro"];
38-
// Only redirect when currently on the *other* edition's asset page,
39-
// so this never fires on unrelated pages or loops on the target page.
40-
if (target && location.pathname === other) {
41-
location.assign(target);
42-
}
43+
const switchPageForVersion = (version) => {
44+
Object.values(editionNavUrls).forEach((urls) => {
45+
const target = urls[version];
46+
const other = urls[version === "pro" ? "opensource" : "pro"];
47+
// Only redirect when currently on the *other* edition's page, so
48+
// this never fires on unrelated pages or loops on the target page.
49+
if (target && location.pathname === other) {
50+
location.assign(target);
51+
}
52+
});
4353
};
4454

4555
const setVersion = (version) => {
@@ -58,11 +68,12 @@ window.ddOffcanvas = Offcanvas;
5868
btn.setAttribute("aria-checked", btn.dataset.versionValue === version ? "true" : "false");
5969
});
6070

61-
// Edition-aware top nav: route "Model Your Assets" to the page that
62-
// matches the selected version (see assetNavUrls above).
71+
// Edition-aware top nav: route these tabs to the page that matches the
72+
// selected version (see editionNavUrls above).
6373
document.querySelectorAll("a.nav-link").forEach(link => {
64-
if (link.textContent.trim() === "Model Your Assets") {
65-
link.setAttribute("href", assetNavUrls[version] || assetNavUrls.opensource);
74+
const urls = editionNavUrls[link.textContent.trim()];
75+
if (urls) {
76+
link.setAttribute("href", urls[version] || urls.opensource);
6677
}
6778
});
6879
};
@@ -80,8 +91,8 @@ window.ddOffcanvas = Offcanvas;
8091
if (btn) {
8192
setVersion(btn.dataset.versionValue);
8293
// Only on an explicit user toggle (not on load) follow the page to
83-
// the matching edition when viewing an asset-modelling page.
84-
switchAssetPageForVersion(btn.dataset.versionValue);
94+
// the matching edition when viewing one of the edition-specific pages.
95+
switchPageForVersion(btn.dataset.versionValue);
8596
}
8697
});
8798

docs/config/_default/menus/menus.en.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,42 @@
2323
url = "/metrics_reports/dashboards/introduction_dashboard/"
2424
weight = 14
2525

26+
[[main]]
27+
name = "Sensei"
28+
# Sensei is Pro-only. Default to the Open Source "Pro feature" page; custom.js
29+
# swaps this tab to the full guide (/sensei/about_sensei/) when Pro is selected.
30+
url = "/sensei/os__sensei/"
31+
weight = 14
32+
33+
# Left-hand section sidebar for the Sensei chapter (the chapter is flat, so the
34+
# Doks subsection-based sidebar has nothing to render without this menu).
35+
# Entries are audience-filtered by the version toggle: the opensource page shows
36+
# in the OS view, the pro pages show in the Pro view.
37+
[[sidebar_sensei]]
38+
name = "Sensei"
39+
pageRef = "/sensei/OS__sensei"
40+
weight = 0
41+
42+
[[sidebar_sensei]]
43+
name = "About Sensei"
44+
pageRef = "/sensei/about_sensei"
45+
weight = 1
46+
47+
[[sidebar_sensei]]
48+
name = "Set Up Sensei"
49+
pageRef = "/sensei/setup_sensei"
50+
weight = 2
51+
52+
[[sidebar_sensei]]
53+
name = "Fixing Findings with Sensei"
54+
pageRef = "/sensei/fixing_findings"
55+
weight = 3
56+
57+
[[sidebar_sensei]]
58+
name = "Sensei Reference"
59+
pageRef = "/sensei/sensei_reference"
60+
weight = 4
61+
2662
[[main]]
2763
name = "Admin"
2864
url = "/admin/admin_intro/intro/"

docs/config/_default/params.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ mainSections = ["docs"]
5656
"admin",
5757
"automation",
5858
"asset_modelling",
59-
"issue_tracking"] # ["docs"] (default) or list of sections (e.g. ["docs", "guides"])
59+
"issue_tracking",
60+
"sensei"] # ["docs"] (default) or list of sections (e.g. ["docs", "guides"])
6061

6162
toTopButton = true # scroll-to-top button
6263
breadcrumbTrail = true # breadcrumb navigation on doc pages

docs/content/get_started/pro/pro_features.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ See our [Rules Engine Guide](/automation/rules_engine/about) for more info.
3939

4040
![image](images/rules_engine_4.png)
4141

42+
### Sensei
43+
44+
DefectDojo Pro's **Sensei** (BETA) is an AI-powered scan-and-fix capability: connect a repository through a GitHub App and Sensei scans it, imports the findings, and opens pull requests that remediate them — with a preview-first workflow, so nothing runs (and no LLM cost is incurred) until you approve.
45+
46+
See our [Sensei Guide](/sensei/about_sensei/) for more info.
47+
4248
### Pro Dashboards and Reporting
4349

4450
Generate [instant reports and metrics](/get_started/about/ui_pro_vs_os/#new-dashboards) to share the security posture of your apps and repos, evaluate your security tools and analyze your team's performance in addressing security issues.

docs/content/sensei/OS__sensei.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: "Sensei"
3+
description: "Sensei is a DefectDojo Pro feature"
4+
draft: false
5+
audience: opensource
6+
weight: 1
7+
---
8+
<span style="background-color:rgba(242, 86, 29, 0.3)">Note: Sensei is a DefectDojo Pro-only feature.</span>
9+
10+
**Sensei**, DefectDojo's AI-powered **scan-and-fix** for source code repositories, is available only in **DefectDojo Pro**. It is not part of the open-source edition.
11+
12+
With Sensei, DefectDojo Pro can:
13+
14+
- Scan your GitHub repositories and import the results as findings.
15+
- Open pull requests that **remediate** those findings with a large language model, using a preview-first approval workflow (nothing runs until you approve).
16+
- Start a fix from the findings table, from staged auto-fix candidates, or with a `/fix` comment on a pull request.
17+
18+
## See the full Sensei documentation
19+
20+
The complete Sensei guide is part of the **Pro** documentation. Switch the documentation version toggle (top of the left navigation) to **Pro** to read it:
21+
22+
- **About Sensei:** what it is and how hosted scan-and-fix works
23+
- **Set Up Sensei:** connect a GitHub App and onboard a repository
24+
- **Fixing Findings with Sensei:** scan, triage candidates, and open fix PRs
25+
- **Sensei Reference:** statuses, quotas, and troubleshooting
26+
27+
To learn more about DefectDojo Pro, visit [defectdojo.com](https://www.defectdojo.com/) or contact your DefectDojo account team.

docs/content/sensei/_index.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: "Sensei"
3+
description: "AI-powered scan-and-fix for your source code repositories"
4+
summary: ""
5+
date: 2023-09-07T16:06:50+02:00
6+
lastmod: 2023-09-07T16:06:50+02:00
7+
draft: false
8+
weight: 5
9+
chapter: true
10+
sidebar:
11+
collapsed: true
12+
seo:
13+
title: "" # custom title (optional)
14+
description: "" # custom description (recommended)
15+
canonical: "" # custom canonical URL (optional)
16+
robots: "" # custom robot tags (optional)
17+
audience: pro
18+
exclude_search: true
19+
---
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
title: "About Sensei"
3+
description: "What Sensei is and how DefectDojo-hosted scan-and-fix works"
4+
draft: false
5+
audience: pro
6+
weight: 1
7+
---
8+
<span style="background-color:rgba(242, 86, 29, 0.3)">Note: Sensei is a DefectDojo Pro-only feature and is currently in BETA.</span>
9+
10+
**Sensei** is DefectDojo's AI-powered **scan-and-fix** capability for source code repositories. Connect a repository (through a **GitHub App** or a **GitLab** access token) and Sensei scans it, imports the results as DefectDojo findings, and then uses a large language model to **remediate those findings by opening pull/merge requests**, all without leaving DefectDojo.
11+
12+
> **🔀 GitHub and GitLab:** Sensei supports both providers with the same scan-and-fix flow. On GitLab (gitlab.com or self-managed), a *pull request* is a **merge request** and the PR *status check* is a **commit status**. Connection differs by provider (see [Set up Sensei](/sensei/setup_sensei/)); everything after onboarding is identical.
13+
14+
- **Scan-and-fix in one place:** repositories are scanned and remediated from the Sensei page and from your findings, using the same normalized, deduplicated finding data as the rest of DefectDojo.
15+
- **Preview-first:** Sensei stages fix *candidates* for review. Nothing is sent to an LLM and no pull request is opened until you approve, so there is no surprise cost or unexpected PR.
16+
- **Short-lived credentials:** Sensei runs entirely through a GitHub App and uses short-lived installation tokens. There is nothing to paste and nothing to rotate.
17+
- **Metered and license-gated:** Sensei is a Pro feature with per-instance quotas for fixes and onboarded repositories.
18+
19+
> **🔎 BETA:** Sensei is under active development and is labeled **BETA** throughout the UI. Behavior and screens may change between releases.
20+
21+
> **📍 Where to find it:** open **Sensei** from the left-hand navigation.
22+
23+
![Sensei hub](images/hub_overview.png)
24+
25+
## How DefectDojo-hosted scanning works
26+
27+
DefectDojo-hosted scanning is the recommended way to run Sensei. Scans run **inside DefectDojo**, and nothing is added to your repository:
28+
29+
1. **Connect a GitHub App** and install it on the organization (or account) that owns your repositories.
30+
2. **Onboard a repository** for hosted scanning and choose how findings are reported and (optionally) auto-fixed.
31+
3. **Sensei scans the repository** (on demand, or automatically when a pull request is opened) and imports the results into an engagement named after the branch.
32+
4. **Sensei remediates findings** by generating a fix and opening a pull request against the repository's default branch.
33+
34+
Each onboarded repository is linked to a DefectDojo **asset** (product), so its findings, engagements, and fixes live alongside the rest of your data.
35+
36+
## The three ways a fix gets started
37+
38+
Sensei can remediate a finding in three ways:
39+
40+
- **The Fix button on a finding:** trigger a one-off fix directly from the findings table or a finding's detail page. See [Fixing findings with Sensei](/sensei/fixing_findings/).
41+
- **Auto-fix candidates:** after each scan, Sensei stages the findings that match your criteria as candidates. You review them and approve the ones to fix (or let Sensei remediate them automatically). See [Auto-fix candidates](/sensei/fixing_findings/#auto-fix-candidate-triage).
42+
- **A `/fix` comment on a pull request:** comment `/fix` on a pull request and Sensei pushes a remediation to that PR.
43+
44+
## Requirements
45+
46+
- A **DefectDojo Pro** license that includes the **Sensei** feature.
47+
- A connected source-control provider (see [Set up Sensei](/sensei/setup_sensei/)): either a **GitHub App** installed on the organization/account that owns the repositories, or a **GitLab** project/group access token (gitlab.com or self-managed).
48+
- To **configure** Sensei (connect apps, onboard repositories): a global **Maintainer** or **Owner** role.
49+
- To **trigger a fix** on a finding: at least **Writer** access to that finding's product.
50+
51+
## Quotas
52+
53+
Sensei is metered against your license. The Sensei hub shows two usage meters at the top of the page:
54+
55+
- **Fixes:** the number of remediations applied against your prepaid limit. Approving a candidate or triggering a fix consumes from this quota.
56+
- **Onboarded Repositories:** the number of repositories onboarded against your repository limit.
57+
58+
When a quota is reached, Sensei blocks further fixes (or onboarding) until it is raised. See [Reference](/sensei/sensei_reference/#quotas-and-metering) for details.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: "Fixing Findings with Sensei"
3+
description: "Scan, triage auto-fix candidates, and open fix pull requests"
4+
draft: false
5+
audience: pro
6+
weight: 3
7+
---
8+
<span style="background-color:rgba(242, 86, 29, 0.3)">Note: Sensei is a DefectDojo Pro-only feature and is currently in BETA.</span>
9+
10+
Once a repository is onboarded, Sensei surfaces directly on your findings and on the Sensei hub. This page covers scanning a repository, triaging auto-fix candidates, and remediating individual findings. You need at least **Writer** access to a finding's product to trigger a fix.
11+
12+
## Scan a repository
13+
14+
Scans import findings into an engagement named after the branch. You can trigger a scan on demand from the Sensei hub: open a repository's row actions and choose **Scan now**.
15+
16+
![Scan with Sensei dialog](images/scan_dialog.png)
17+
18+
Pick the branch to scan (it defaults to the repository's default branch) and choose **Start scan**. In DefectDojo-hosted mode, scans also run automatically when a pull request is opened.
19+
20+
## The Sensei column on findings
21+
22+
Onboarded repositories add a **Sensei** column to the findings table. Each finding shows a **Fix** button (or its current fix status), so you can remediate without leaving your triage view.
23+
24+
![Sensei column on the findings table](images/findings_sensei_column.png)
25+
26+
The button has two states:
27+
28+
- **Fix:** the finding's product is onboarded to Sensei. Clicking it starts a remediation.
29+
- **Configure Product:** the finding's product is **not** onboarded yet. Clicking it takes you to Sensei to onboard a repository for that product; once onboarded, the button becomes **Fix**.
30+
31+
## Fix a single finding
32+
33+
Clicking **Fix** (on the findings table or in a finding's detail header) opens the **Fix with Sensei** dialog. Choose the base branch the fix pull request should target, then click **Fix**.
34+
35+
![Fix with Sensei dialog](images/fix_with_sensei_dialog.png)
36+
37+
Sensei generates a remediation and opens a pull request. The finding's fix status is shown as a badge that moves through *in progress**PR open* (or *failed*). Once the pull request is open, the badge links straight to it.
38+
39+
![Finding detail with fix status badge](images/finding_detail_fix.png)
40+
41+
> **💡 One fix, one PR:** each approved fix consumes one fix from your quota and opens one pull request. Review and merge the PR in GitHub as you would any other.
42+
43+
## Auto-fix candidate triage
44+
45+
When a repository has automated fixes enabled, each scan stages matching findings as **candidates** on the **Auto-fix Candidates** tab of the Sensei hub. This is Sensei's preview-first model: findings are staged, but **nothing runs (no LLM cost) until you approve**. Approving opens fix pull requests and consumes fixes.
46+
47+
![Auto-fix candidate triage](images/auto_fix_candidates.png)
48+
49+
Each candidate shows the finding, its status, severity, risk, priority, target repository, and PR branch. To remediate:
50+
51+
- **Approve one:** click **Approve** on a row to open the branch picker and start that fix.
52+
- **Approve several:** select multiple rows and use the bulk approve action.
53+
54+
Approved findings stay listed as **In Progress** (or **Failed**) until their pull request is attached, so an in-flight or failed fix never disappears before it produces a PR.
55+
56+
> **🔎 Hands-off remediation:** if you enabled *Automatically remediate candidates* on the repository, a background check opens fix PRs for staged candidates automatically, up to your fix quota, without manual approval.
57+
58+
## Track scans and impact
59+
60+
Two places on the Sensei hub help you follow what Sensei has done:
61+
62+
- **Scan Activity:** a ledger of every scan and fix run, with its mode (Branch Scan, PR Scan, Fix (Finding)), trigger (Manual, Webhook, Auto Remediated), status, execution time, and links to the engagement or the pull request it produced.
63+
64+
![Scan Activity ledger](images/scan_activity.png)
65+
66+
- **Fix Impact:** a summary of fixes applied, with the assets fixed most often, at the top of the hub.
67+
68+
![Fix Impact panel](images/fix_impact.png)
69+
70+
Use the **Scan now**, **Scan history**, **Configure**, and **Re-stage candidates** row actions to manage each onboarded repository over time (see [Reference](/sensei/sensei_reference/#repository-row-actions)).
166 KB
Loading
52.1 KB
Loading

0 commit comments

Comments
 (0)