The crate versions had stayed at 0.4.6 since the first releases; the
running version comes from the release tag. Bumping them to the release
also changes Cargo.toml and Cargo.lock, so the main build after merging
rebuilds the agent, dashboard and MCP images together for v0.4.15.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On prod, DOCS_URL is the customer docs site, which keeps a page at the
same path under each language root and has no "-en" pages: the English
link to guide/managed-git-en would 404 there. Both languages now link
guide/managed-git.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decided 2026-11-12: PSIRT and DEVELOPMENT get full access (they triage
findings and run scans); QUALITY, PURCHASING and AUDITOR read only;
PRIVACY and EXTERNAL none, as before. Each parses to its own OrgRole.
Admin-only actions (manual findings, git source, licence decisions) stay
with IT_ADMIN and OWNER; confirming a licence follows full access, so
PSIRT and DEVELOPMENT may confirm.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The "Prüfobjekt bearbeiten" dialog was taller than a laptop window and
could not scroll, so its title and Save were out of reach; at 480px its
add-reference row squeezed five controls into one line.
Dialogs now stop at the window height and scroll, with the actions
pinned at the bottom. The target editor is 680px wide and split into
sections (artefacts, add a file, exclusions, projects); adding a
reference puts kind and reference on one line and branch, token and the
button on the next; the upload's archive password gets its own line;
the project picker reads as a section inside a dialog.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Source code without a manifest or lockfile gave an empty SBOM with no
explanation, which reads as "no libraries". Two findings of a new
sbom-coverage check now say why:
- sbom-no-manifest (Medium): code in a language with a package manager
(Python, JS/TS, Rust, Go, Java/Kotlin, C#, PHP, Ruby, Dart) and no
manifest or lockfile for it outside vendor directories, one per
ecosystem. Never for C/C++, Yocto layers, or a tree whose components
come from its sources (library headers, firmware, CODESYS).
- sbom-dependencies-unresolved (Low): a manifest whose dependencies were
not resolved, one per manifest the SBOM stage already lists under
sbom_dependencies; legacy build systems keep their own finding.
Each finding names a concrete way to add the missing file, maps to the
SBOM requirement (cra-ai-23, also bound in the control map) and closes at
the next scan that no longer reports it, as the check completes on every
code scan. Dart is now detected as a source language.
The SBOM page shows an explanation instead of an empty table: where the
SBOM comes from, the target's open findings with their examples and a
link, or a general example. The findings API takes a scanner filter.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The finding page gets an "Als Ticket-Text kopieren" button that copies
the finding as Markdown (title, severity, status, location, description,
the AI assessment, CRA-Themen and a link back to Prüfwerk), confirmed
with "Kopiert". The Markdown is built in Rust; JavaScript only writes it
to the clipboard.
Where the target opens no tickets on its own and the finding has none, a
hint says "Mit Breakpilot Git werden Tickets automatisch angelegt" and
links to connecting a tracker and to the Managed Git guide. The target's
CRA view now says whether a tracker is connected: one with a type is
configured, or the target came from a managed git source.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OrgRole::parse knew only IT_ADMIN, CXO, FINANCE, LEGAL and USER, so an
OWNER got no access at all. OWNER now parses to its own role with full
access, and what only an administrator may do (manual findings, the git
source, licence decisions) asks OrgRole::is_admin (IT_ADMIN or OWNER).
The other new RBAC bundles still get no access.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The scan phase "CRA-Anforderungen zuordnen" could read as legal advice.
It is now "Bezug zu CRA-Themen ermitteln (technischer Hinweis)"; the
finding detail says "CRA-Themen, auf die dieser Befund hinweist" and
"CRA-Themen (Anhang I)"; the CRA status page and the CRA tiles say
"Technische Hinweise, keine rechtliche Bewertung". The docs use the
same wording.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Before a stage replaces its part of a target's SBOM (the code SBOM, the
CODESYS libraries, the firmware components), the entries it replaces are
compared with the new ones and the changes are added to the scan run
(`component_changes`, at most 5000; `None` on runs from before). A
component is its package manager and name; one version before and one
after is an update, otherwise each new version an addition and each gone
one a removal.
The Verlauf API joins them with the scan's CVEs: a new CVE goes with the
component now at its version, a gone one with the component that was at
its version, and what no change explains is an advisory row. The scan's
drill-down shows the mockup's table (neu / aktualisiert / entfernt / neue
Advisory, version before → after, CVEs +n −m) above the CVE list; scans
from before say the components were not recorded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The two views the repo tabs still showed as placeholders, as in the mockup:
- CRA Annex I: the 40 requirements as tiles, ten to a row, coloured by state
and marked with a sign (! ? ~ OK –) so the state is never told by colour
alone, with a legend and counts. A tile opens the requirement (in the
URL, ?control=cra-ai-3) with its state, findings and reason, reusing the
CRA page's row.
- Verlauf: per scan the CVE alerts found new above the line and those found
gone below it, with the run's status, and a table view. A scan opens what
it changed (?scan=<run id>): each CVE with component, version and
severity. New: GET /api/v1/targets/{id}/scan-changes and
compliance_core::scan_changes. A completed scan's window runs from the end
of the completed scan before it; the first is the baseline; scans that did
not complete change nothing. Which components a scan added, updated or
removed is not stored, and the view says so.
Docs: the target's page and its views in the targets guide; the overview's
repo cards with their Heute buckets.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The back-sync of #960 only listened to the managed git source's
organisation webhook, which most targets do not have: repositories with a
Gitea issue tracker get no webhook at all. Every GIT_SOURCE_SYNC_MINUTES
(30 by default) the agent now lists the issues of each target that has
Prüfwerk issues, one listing per repository, and compares their state with
its records. For an issue whose state differs it reads the timeline to see
who closed or reopened it; a person's change is carried back exactly as a
webhook delivery is (same rules: an undecided finding is resolved as
"closed in the ticket", a decision already made stays, a CVE issue only
records the close). Changes by the bot user that opened the issue are left
alone. Targets are polled one after the other, so a small Gitea sees one
listing at a time; tenants go through the same entitlement check as the
webhook. Where the webhook delivered a change already, the records match
and the poll does nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checked against the mockup in a local run: the tab strip scrolls on its
own on a narrow screen instead of widening the page and no longer shows a
stray scrollbar; the CRA tab counts the requirements checked without a
finding (not those outside the code); the licence tab says why it is empty;
the repo cards' bucket labels wrap as in the mockup.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A new landing page "Heute" (the overview moves to /overview and stays in
the sidebar): the Erstbewertung, target chips, the four bucket tiles and
the cards of the chosen bucket with their decisions, "Später" with one
week, one month or a date, "Details", an undo strip after each decision,
and the keys j/k/f/a/s on this page only. The sidebar's "Heute" entry
shows the workspace's "Heute handeln" count.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Describe the new overview figures, the 30-day chart, the targets by
project and the target page's "Wo handeln" table in the guide. Key the
overview's project groups by the project's id, so two projects with the
same name stay apart.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Tickets page was a paged table only. GET /api/v1/issues now takes
q (title word or ticket number: 913, #913, PROJ-913), status (open
takes in_progress, closed takes resolved) and repo_id, tenant-scoped as
before. A ticket stores no target: the target filter takes the ids of
the target's findings with a ticket plus its CVE tickets
(finding_id cve:{target}:...).
Each row links to its finding, or for a CVE ticket to the target's
components and CVEs (SBOM page), next to the tracker link. Texts are
German and English, the status is a readable badge. The CVE key prefix
and the closed check move to compliance-core so the agent and the
dashboard read them the same way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The managed Git source's org webhook now handles `issues` events. A
person closing an issue Prüfwerk opened resolves the undecided finding,
recorded as "closed in the ticket" with the Gitea login; reopening it
makes the finding open again. A decision already made in Prüfwerk is
kept. Events whose sender is the issue's author (Prüfwerk's bot user,
which opened it) are ignored, and the back-sync never calls Gitea, so
nothing loops; the issue record is updated first, so the outbound sync
has nothing left to comment or close.
CVE issues closed in Gitea only record the close and who did it, no VEX
status. The scan leaves such an issue closed while the CVE is still
found, and forgets the close once a complete scan no longer finds it, so
a CVE that comes back reopens the issue as before.
The platform API names the events the webhook needs (`webhook_events`);
Prüfwerk cannot change the webhook itself, so existing webhooks need
the Issues event added in Gitea. The finding history shows
"Im Ticket geschlossen von <login>".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Undecided findings are grouped on read, by target, tool, rule and file,
and by directory when a rule fires in three or more files of one
directory. A stored #464 group stays a group of its own. Nothing about
groups is stored.
- compliance-core: models::finding_group with the pure group_findings
and members_of, for the findings list and later the Heute inbox.
- GET /api/v1/finding-groups[?target=] lists the groups;
POST /api/v1/finding-groups/decide gives every undecided member the
same status through the bulk path (status history, issue sync), so
VEX and the evidence pack see ordinary per-finding changes.
- Findings list: Gruppiert / Einzeln toggle (default grouped) with group
cards, the AI's reason, the places, and Fehlalarm / Risiko akzeptiert
for all places of a group.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The findings page of one target (/findings?target=...) now opens with two
charts of its open findings: a bar per finding type stacked by severity
(one red scale, every segment a button), and a tree map of the folders
they are in (area = open findings, colour = the most severe). A click
opens the list narrowed to that type and severity, or to that folder; the
filter goes into the URL, a breadcrumb names it and leads back to the
charts. A "Tabelle" toggle shows the same numbers as tables.
- core: finding_breakdown (the shared DTO and the pure counting function;
open = Open, Triaged, NeedsReview as for tracker issues)
- agent: GET /api/v1/targets/{id}/finding-breakdown; the findings list
takes an anchored literal `path` folder filter and `status=undecided`
- dashboard: FindingsPage takes scan_type, severity and path from the
query (Route::findings(target) builds the plain list link)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The target's "Schwachstellen und VEX" card now opens with a grid of
severity rows against VEX-status columns (offen, in Pruefung, betroffen,
nicht betroffen, behoben), each count shaded on one blue scale and a
button into the CVE list narrowed to that cell. The choice sits in the
URL (?cve_severity=high&cve_vex=open), with a breadcrumb and a way back;
a table toggle shows the same numbers, and a tile counts the CVEs nobody
has assessed yet.
The agent counts the still-reported alerts in
GET /api/v1/targets/{id}/cve-matrix; the bucketing lives in
compliance-core so the dashboard narrows the list the same way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The SBOM page's component tab opens, for one target, with two bar charts
(one hue, no legend; "Tabelle" shows the same numbers as tables):
- "Welches Update entfernt die meisten CVEs": per CVE group of #949 with
a fix, "openssl 3.0.11 -> 3.0.15" and "-3 CVEs", ranked by the CVEs the
update fixes, then by the worst severity; top 10, then "Alle anzeigen".
A bar opens that component's group card in place (breadcrumb
"Komponenten > openssl 3.0.11", "Zurueck zum Diagramm"). The card is
#949's own; only its visibility changes.
- "Komponenten nach Oekosystem": per package manager the components and
how many have a known vulnerability. A bar filters the component table
below to it and puts it in the URL: the new additive route
/sbom/ecosystem/:ecosystem?target=<id> renders the same page. The
package-manager select now shows the active filter.
Agent: GET /api/v1/targets/{id}/sbom-ecosystems counts the target's SBOM
components per package manager in one aggregation (tenant database, org
role gate as every route). The ranking and the filterable managers live
in compliance-core (sbom_ecosystems), shared with /sbom/filters.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The target's open CVE alerts are grouped by component (package, version,
purl) in compliance-core: the highest fixed version the advisories name
above the component's own, how many CVEs that update fixes, the CVEs per
severity (a CVE in several alerts counts once), KEV and the highest EPSS.
Agent:
- GET /api/v1/targets/{id}/cve-groups lists the groups, most severe first.
- PATCH /api/v1/targets/{id}/cve-groups/vex states one VEX status on every
open alert of a component: one statement per alert with the validation,
author and time of PATCH /api/v1/cves/{id}/vex, so the exports and the
CVE issue auto-close treat them as single decisions. Settled alerts keep
their statements; 404 when the component has no open alert.
Dashboard: the target's VEX section opens grouped ("Gruppiert") with one
card per component ("vite 5.4.21 -> 8.3.3 behebt 9 CVEs (1 hoch, ...)"),
"Nicht betroffen (alle N)" opening the same statement editor as
"Bewerten", and the rows on demand; "Einzeln" keeps the full list. The
severity badge of a row now uses the same rating as the group counts
(GitHub's MODERATE reads as medium, a CVSS-only alert gets its badge).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The only link to the MCP tokens was the overview's MCP-Server card, which a
source-only deployment (prod) hides with the runtime sections. The MCP
endpoint serves such a deployment all the same, so there a token could only
be created by typing /mcp-tokens. The sidebar now has an MCP-Tokens entry
that source-only mode leaves enabled; the overview card is unchanged.
The docs name the entry instead of the bare URL.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"Zu prüfen" now says which of the two cases put it there: the LLM triage
dismissed the finding as a likely false alarm ("KI: wohl Fehlalarm"), or it
confirmed it with too little confidence ("KI: unsicher"). The reason is read
from the verdict already stored on the finding (triage_action, confidence),
so findings from before this change get it too; the wire status stays
needs_review.
- core: ReviewReason, ReviewReason::of_verdict and Finding::review_reason;
the triage's confidence threshold and its action markers move to core.
- agent: apply_action decides through ReviewReason::of_verdict, so the
triage and the label cannot drift apart.
- dashboard: the list and the finding page show the reason instead of the
bare status, the list with the AI's rationale on hover; the finding page
confirms ("Fehlalarm bestätigen", false positive with the rationale as
reason) or rejects ("Doch prüfen", triaged) the AI's guess in one click,
for roles that may change a status.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The MCP endpoint accepts only MCP tokens (mcpt_…) from the MCP-Tokens page,
which a signed-in person creates; the docs said to use the MCP server
entry's access token, which the endpoint refuses, and gave a wrong URL.
Portal API keys neither work at the endpoint nor can create MCP tokens.
- Step by step: create the token at /mcp-tokens (also reachable in
source-only deployments, where the overview card is hidden), add the
server with the real endpoint (/mcp/mcp) to Claude Code or a JSON-configured
client, check /mcp/health, and read the three 401 answers.
- API-Schlüssel: a note that keys are not for MCP.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The "Open in Prüfwerk" link in a finding's issue went to the target's
whole finding list. It now opens the finding's own page
(/findings/{id}), where its status is set; a group (#464) links to its
own page. The link stays https-only and is left out for a finding
without an id. CVE issues and the new-findings notification keep their
links.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
First part of t72, Prüfwerk metering (LB §2 Abs. 4–5, §7). This PR records what a scan is metered by. Nothing is counted or enforced yet; counters, the 6-per-day limit and the Prüftag cap come in the next PR.
## What changes
- **Included vs extra targets.** Each target stores `billing: included | extra`.
- The oldest active targets by `created_at` are included, up to the plan's `limits.included_targets` from the registry entitlement. The rest are extra.
- The split is refreshed before each scan and when a target is created. Archiving an included target moves the oldest extra one up.
- A plan without that key includes every target, which is every plan until the registry sends the limits. So this PR changes nothing for existing tenants.
- **Run attribution.** Each run records an `attribution`:
- `request`: the customer started it (dashboard or API).
- `support`: staff started it.
- `change`: something the customer changed, i.e. new commits, other uploads, or a live URL.
- `rescan`: only the Prüfwerk build changed.
For scheduled and webhook scans it's set where change detection decides, so our rescan after an update is no longer counted as a customer change. `uploads_changed` / `content_changed` don't depend on `UPLOAD_CHANGE_SKIP`.
- **`chargeable`.** Says whether the run counts once it completes:
- a request always counts;
- a change counts only on an extra target;
- rescans and support scans never count.
`scan.completed` now carries `attribution` and `counted` as properties.
- **Dashboard.** The targets list shows a "Zusätzliches Prüfobjekt" badge on an extra target.
## Tests
- **Core:** the included/extra split, attribution, and the contract table of what counts.
- **Agent:** `content_changed`/`uploads_changed`, the `included_targets` limit, reading a stored target's billing, and a Mongo integration test (`tests/target_billing.rs`): the oldest are included, and an extra target moves up on archive.
Not built locally, per the CI-only rule; CI is the compiler here.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com>
Reviewed-on: #927
vuln-watch flags PyJWT 2.13.0 in compliance-agent (CVE-2026-102268, critical, fixed in 2.14.0). semgrep 1.177.0 pins pyjwt~=2.13.0; 1.179.0 is the first release that allows >=2.15.0. Tested in debian:bookworm-slim: semgrep 1.179.0 + ruff 0.16.8 install, PyJWT 2.15.1, mobsfscan still installs with --no-deps (its semgrep==1.172.0 mismatch already existed), a sample rule still finds its match. All four image builds now use `--pull`.
Note: a semgrep minor bump can shift findings; watch the nightly baseline run after merge. Prod stays on its pinned digest until it is promoted.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com>
Reviewed-on: #580
webpki-roots 1.0.10 and rustls-webpki 0.103.16 drop emSign ECC Root CA - G3 from the compiled-in roots (Mozilla bug 2083449); agent, dashboard and MCP final stages fail the build if Debian's store still ships it. zip extract() advisories RUSTSEC-2026-0367/0368/0369 ignored with reason (we never call extract()); zip 9.x follow-up.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Audit entries for API-key writes recorded the agent's container address (172.17.0.6 on stage), because the registry stores the peer of its own request. With this change they carry the caller's address.
- The API host's proxy puts the caller's address in `X-BP-Client-IP`, overwriting anything the client sent. That proxy change is a separate orca-platform PR on `pruefwerk-stage/api-proxy.conf`.
- `audit_delegated_writes` reads the header for **API-key requests only** and keeps it only if it parses as an IP address, because the registry stores it as Postgres `inet` and garbage would sink the whole entry.
- `AuditEntry.source_ip` is sent as `source_ip` and skipped when empty.
- The registry ignores the field until tenant-registry accepts it (separate PR), so the deploy order doesn't matter.
- The address is informational: nothing decides on it.
- Support writes via the dashboard still show the dashboard's address.
Tests: unit test for the header parse (v4, v6, a list, junk, missing); `tests/api_key_access.rs` checks `source_ip` in the posted audit entry. Not run locally (RAM); CI runs them.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com>
Reviewed-on: #567
Blessed by the nightly run 8514 (workflow_dispatch, bless) on the image of
34e3f6c: the vendored gitlab-/0xdea- rules in fw-c-sensor-node, the Python
targets, archive-order-intake and git-cra-vuln-demo, and new baselines for
the .NET targets dotnet-framework48 and dotnet-legacy-sample (DevSkim, the
C# semgrep rules and the .NET config checks). py-uv also records the
malware stage as skipped and one more PYSEC id, as the current image
reports them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Legacy .NET Framework code often cannot be built outside the customer's
Windows toolchain, so no Roslyn analyser applies. DevSkim (MIT, Microsoft)
matches its rules on the source text and now runs as the sast_dotnet stage
on every tree with C# or VB.NET code: .cs, .vb, Razor/ASP.NET pages and
.config files, skipping bin/, obj/, packages/ and vendor directories
(anchored at the tree root).
- Only DevSkim's own rules at Critical/Important/Moderate (its ManualReview
and BestPractice hints are not findings); DS205000 (NuGet feed mapping),
DS184626 (controller base class) and DS440000 (generic twin of DS440020)
are left out, and two that flood real C# (OpenRA, eShopOnWeb): DS148264
matches any method named Random (71 hits in OpenRA), DS126858 the bare
words md5/sha1, identifiers included (35). DS168931 and our own semgrep
rules still cover broken hashes and System.Random. What remains: 3 hits
in OpenRA (test vectors), 14 Low http:// hits in eShopOnWeb seed data;
each run took about 2 s.
- SARIF is read with import::sarif::parse; findings are normalised like the
other scanners (relative path, whole source line as snippet, one finding
per rule/file/line), severity from DevSkim's own Critical/Important/
Moderate (its SARIF level says "error" for both of the first two).
- DevSkim's SARIF names no CWE, so pipeline/devskim.rs gives each rule one;
the control map binds the devskim tool by CWE to cra-ai-1, 8, 10, 13, 14,
15, 16 and 20 for csharp and vb. A test checks every mapped rule reaches a
control. A failed run is a sast_dotnet skip, so those controls read "not
assessed" instead of clean.
- languages.rs now records VB.NET (vb).
Image: the CLI is published as a .NET tool on nuget.org only (no release
binaries). Dockerfile.agent pins the 1.0.100 nupkg by sha256 and the .NET
10.0.12 runtime (no SDK) by sha512, keeps only the linux-x64 natives, and
runs it through docker/devskim.sh with invariant globalisation (no ICU).
The tools stage grows from 1.525 GB to 1.623 GB (+98.5 MB: runtime 80 MB,
DevSkim 16 MB). Checked in that image as the unprivileged user with an empty
environment and --network none: it runs offline. tool-versions.json lists
devskim and dotnet-runtime.
Fixtures: fixtures/dotnet/legacy-sample, a small vulnerable C#/VB.NET
library with a Web.config (SSL 3, certificate validation off, DES, XXE,
BinaryFormatter in VB.NET, tracing, cookies without Secure), and nightly
targets for it and for framework48; their baselines need a bless run after
deploy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
At the end of every completed scan the target's CycloneDX SBOM (the same
document as the evidence pack's sbom.cdx.json) is scored by sbomqs against
BSI TR-03183-2 v2.1 and the NTIA minimum elements (2021).
- Dockerfile.agent pins sbomqs 2.1.2 (Apache-2.0) with the sha256 from the
release's checksums.txt and lists it in tool-versions.json.
- Profiles by explicit name (bsi-v2.1, ntia-2021): in 2.1.2 `bsi` and
`ntia` float to the newest BSI and CISA 2026 profiles.
- pipeline/sbom_quality.rs runs it offline through tool_cmd (empty
environment, 120 s), keeps per profile the score, grade and the checks
not fully met; stored on the scan run as sbom_quality. Without sbomqs the
run records the skipped stage sbom_quality.
- Supporting evidence, not findings: attached to cra-ai-23 in the CRA
status without changing its state, sbom-quality.json in the evidence
pack, GET /api/v1/sbom/quality for the SBOM page.
- Dashboard: SBOM-Qualität card on the SBOM page, a supporting-evidence line
on cra-ai-23 on the CRA page.
- Docs: tools.md, SBOM and target guides, staging check 20.
Our export (CycloneDX 1.5, no creator, timestamp, supplier or hashes)
grades F against BSI; the failed checks list what it needs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Our ~35 own rules left whole languages without SAST findings. Three
permissively licensed community packs now run next to them, on the same
semgrep invocation (--metrics=off, local files only):
- GitLab sast-rules v2.10.1 (53bf5cf6): 148 rules for C#, Java,
JavaScript/TypeScript, Python and one Go rule; only files whose header says
"License: MIT (c) GitLab Inc.". Not vendored: c/ (every file GPL-2.0,
generated from flawfinder), go/ apart from one file (Apache-2.0 gosec
ports), scala/, rules/lgpl, rules/lgpl-cc (Commons Clause), rules/gitlab (EE).
- 0xdea semgrep-rules (dae50da6, MIT): 35 C/C++ rules.
- elttam semgrep-rules (24426856, MIT; its LICENSE carries the Semgrep
template's copyright line): 34 rules for Java, Go and Struts/Spring XML.
Each pack lives in compliance-agent/rules/vendor/<source>/ with LICENSE,
NOTICE (provenance, what was left out and why) and UPSTREAM (pinned commit):
upstream/ holds the selected files unchanged with their tests, pack.yaml the
rules the agent runs, ids prefixed per source (gitlab-, 0xdea-, elttam-),
rules.json an index for the tests. scripts/vendor-semgrep-rules.py
regenerates all of it deterministically.
Provenance: every candidate rule was compared with the Semgrep registry
(semgrep/semgrep-rules, read only for the comparison). Eight GitLab Python/JS
rules with the same message or the same patterns are not vendored, nor are
elttam's Kubernetes rules (registry-derived). Also left out: elttam's
entrypoint enumerators, its ORM-leak hints, three files whose upstream
tests fail on semgrep 1.177 and a join-mode rule.
Noise budget: run over the nightly fixtures, the public samples and
FreeRTOS-Kernel, lwIP, OpenRA, eShopOnWeb, requests, express and
spring-petclinic. 15 rules that flood real code (0xdea missing-return 1514
hits, typos 989, interesting-api-calls 718, signed-unsigned-conversion 221,
suspicious-assert 176, format-string-bugs 61 ...; GitLab assert-used) are
dropped from the pack, each listed with its reason in NOTICE. CPU time of
the semgrep run roughly doubles on C-heavy trees (FreeRTOS-Kernel 70 s ->
136 s, lwIP 18 s -> 68 s), well inside the 10-minute stage timeout.
Ids stay bare (#473 logic covers the vendored ids, fingerprint() unchanged).
The control map gets one vendored semgrep binding per control, by CWE (by
rule id for the few elttam rules without one), with exactly the languages of
the rules behind it; a test checks every vendored rule maps to a control
that claims its languages.
Guard: semgrep_args() builds the one invocation; a test fails if any
--config is not a staged local pack, or is auto, p/, r/ or a URL, and
another scans the agent source, scripts, docker/, CI and Dockerfile.agent for
a registry config.
Nightly baselines with C, Python, C# or JS code change and need a bless run
after the image is deployed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
On top of the committed-binary inventory (#465), natively in Rust:
- PE: ASLR (DYNAMICBASE, relocations), high-entropy ASLR, DEP, CFG,
SafeSEH, /GS, Authenticode present; IL-only .NET assemblies skip the
native-only checks
- ELF (dynamically linked only): RELRO, NX stack, PIE, stack protector,
FORTIFY; static and bare-metal ELF are not assessed
- .NET: AssemblyRefs from the CLI metadata tables (own ECMA-335 reader)
- native PE: CPE/purl candidates from the version resource, low confidence
- Intel HEX: record checksums, address ranges, size, start address
Evidence goes on the inventory finding; each gap is its own Low/Info
finding per rule (grouped by #477). ASLR/NX/RELRO gaps bind to cra-ai-1 and
a damaged HEX image to cra-ai-6 through attach-only control-map bindings,
which never make a control count as checked.
PE/ELF headers are read with the object crate, already in the build via
firmwerk-sbom: no new crate, no Python helper, no image change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Every CVE alert, and the SBOM's reference to the same advisory, now says
whether the CVE is exploited: its entry in CISA's KEV catalog (date added,
known ransomware use), FIRST's EPSS score and percentile, and the SSVC
exploitation decision of CISA's Vulnrichment.
- pipeline/cve_enrichment.rs reads KEV (one JSON, at most daily), EPSS
(FIRST API, 50 CVE ids per request) and Vulnrichment (per-CVE record on
raw.githubusercontent.com, a 404 is an answer) through guarded_net. Only
CVE ids leave the agent. Bounded: 500 uncached CVEs, 8 at once, 2 min.
- Answers are cached a day for all tenants in <prefix>__admin
(cve_exploitation per CVE, cisa_kev for the catalog), TTL index like the
NuGet licence cache. A failed source stays unknown, is not cached and
never fails the scan. CVE_EXPLOIT_LOOKUP=false turns it off.
- Runs in the scan (after the CVE stage), the PLC control-app path and the
hourly CVE monitor (which now refreshes an existing alert's exploitation).
- CVE issues (#452): a KEV CVE always opens an issue, rated at least high;
an EPSS percentile at or above CVE_ISSUE_EPSS_PERCENTILE (default 0.95)
rates it one step higher. The body names KEV, EPSS (with FIRST's credit)
and SSVC.
- LLM triage: a finding that names a CVE gets its exploitation in the
prompt. No scanner sets Finding.cve today, so this is a hook for now.
- Dashboard: "Aktiv ausgenutzt (KEV)" and "EPSS … · P…" badges on the SBOM
page's CVE cards, a KEV marker on the row, SSVC line, EPSS attribution.
- Docs: tools.md section and egress rows, SBOM and issues guides, staging
check 18. Tests run on trimmed real fixtures and a loopback stand-in.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
The CVE scanner asked api.osv.dev (querybatch, vulns/{id}) and NVD (per
CVE, per CPE product) with the agent's plain HTTP client. Every other
outbound call to an address the agent does not fully control is already
guarded, and since #468 the nuget.org license lookup is too.
New pipeline/public_http.rs (PublicHttp), the nuget_license pattern:
a guarded_client_builder client (approved addresses only, redirects
re-checked, no proxy), NetGuard::check_url before every request, 10 s
per request, 5 s connect, bodies capped at 16 MiB. CveScanner and
nvd_cpe::product_cves use it. NVD requests keep 30 s, as on the old
shared client (a product query returns up to 2,000 CVEs). A URL the
guard refuses is not retried.
CveScanner::new takes the agent's NetGuard instead of a client. The
dead search_context (SearXNG) is removed: it was never called, and an
internal SearXNG would be refused by the guard anyway. The orchestrator's
http field had no other user and is gone.
Audited every other reqwest client in compliance-agent. The LLM gateway,
tenant registry, OSCAL backend, GitLab/Jira trackers, identity providers
(pentest cleanup) and headless Chrome are operator-configured and often
internal, so they stay on plain clients. docs/reference/tools.md now
lists all egress in one place.
Tests: the OSV stand-in on loopback is refused with a public-only guard
(no request reaches it) and answers with allow_private. An NVD product
query to loopback is refused and not retried. check_url refuses
loopback, RFC 1918, link-local and metadata addresses, and a name that
resolves to loopback is refused when connecting.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Syft names a DLL without a .deps.json by its version resource: product
name and file version. As a purl that is no NuGet package, so OSV
matched nothing: pkg:nuget/DotNetZip%20Library@1.9.1.5 has no advisory,
pkg:nuget/DotNetZip@1.9.1.5 has GHSA-7378-6268-4278.
Syft's dotnet-portable-executable-entry components are now mapped, in
this order:
- a DLL inside packages/<Id>.<Version>/ is that package
- a curated alias table, by assembly name (file name) and then product
name (DotNetZip Library -> DotNetZip, Json.NET -> Newtonsoft.Json,
Apache log4net -> log4net, Xceed Toolkit for WPF ->
Extended.Wpf.Toolkit, empira MigraDoc -> PDFsharp-MigraDoc), with how
the package's file versions relate to its versions (Newtonsoft.Json:
first three parts; EntityFramework: unrelated, so the DLL only
confirms a manifest entry)
- the assembly name, when it is a valid NuGet id and not one of the
tree's own projects (project name or <AssemblyName>), whose names are
not sent to OSV or nuget.org
- otherwise no purl, and the scan records the assembly as not matched
against OSV
Alias before file name: DotNetZip ships Ionic.Zip.dll, and Ionic.Zip is
a different package. Versions go through nuget_license's
normalise_version (4.1.0.0 -> 4.1.0, +build dropped); a non-zero fourth
part stays (1.9.1.5 is a real NuGet version).
One package found in several DLLs, or in a DLL and a manifest, is one
entry: SbomEntry gains `evidence` (the manifests and DLLs it was read
from), and merge_nuget compares normalised versions and merges the
evidence instead of dropping it. Native pe-binary components are left
as they are.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
The per-id retries of #472 ask about a finding up to three times, the
critical/high ones on their own. A model that accepts requests and never
answers would hold each call for the client's 300 s timeout: up to 720
calls instead of 60. When every call in flight fails at once, the model
is taken as down; what it answered so far is kept, the rest is recorded
as "skipped: no answer". An unreadable answer still counts as an answer
and is asked about again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
The LLM triage of the first pilot scans left 74 of 75 findings without a
triage_action. Three causes:
- Partial answers: 30 findings per call with a 4096-token budget that a
reasoning model spends on thinking and the answer together. The answer
was cut off after a few verdicts; #457 only retries an empty answer.
Verdicts were also matched by position and the echoed id was ignored,
so a finding the model left out shifted every later verdict.
- Not persisted: write_back stored triage fields only on rows this run
inserted. A rescan (or a scan restarted after stages 1-4 had saved its
findings) triaged them, then dropped the result.
- Unanswered findings were marked "triaged" and counted as "passed".
Now:
- 10 findings per call with a 12k budget (below #457's retry budget);
verdicts matched by id (the finding's number in the chunk, or its
fingerprint), by position only when the answer carries no ids
- findings without a verdict are asked again by id in chunks half the
size, then each critical/high one on its own
- one call per fingerprint: copies (gitleaks reports a secret once per
commit) share the verdict
- low/info findings are not sent; recorded as triage_action "skipped",
rationale "skipped: low"; likewise "skipped: over cap" and "skipped:
no answer". Skipped findings keep their status (open).
- write_back stores triage on rows an earlier run stored while nobody
has decided about them (open/triaged/needs_review); a skip never
replaces an earlier verdict; status still only onto open rows
- one summary line per scan replaces "N findings passed confidence
threshold": triaged by outcome, skipped by reason, LLM calls
- dismissed and low-confidence findings stay as needs_review (#367):
nothing is dropped
Tests drive the triage with a fake model: partial answer then retry by
id, malformed chunks, model down, threshold, lows and copies, and the
stored updates for new and earlier rows.
Closes#462
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
GET /api/v1/platform/version reported the crate version (0.4.4) and no
commit, so the portal's staff dashboard showed Prüfwerk without one. The
agent now reads PRUEFWERK_VERSION and PRUEFWERK_COMMIT at compile time;
the deploy-agent job passes the latest v* tag (without its v) and the
commit as Docker build args, like the tenant-registry's GET /version.
Locally, or with empty args, it falls back to the crate version and
"unknown".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
NuGet SBOM entries carried no license: none of the files they come from
names one. Fill it in after the NuGet components are merged (#467):
- local first: the .nuspec of a restored package; <license
type="expression"> as SPDX, type="file" as LicenseRef-file, an old
<licenseUrl> mapped to SPDX for well-known license pages, else kept
- then nuget.org: registration leaf (gzip) -> catalogEntry (inline or
linked on api.nuget.org) -> licenseExpression / licenseFile / licenseUrl
- only real ids at exact versions (no ranges, no DLL-metadata names);
versions normalised as nuget.org files them (6.2.0.0 -> 6.2.0, 2.0 ->
2.0.0)
- ids a nuget.config maps to another feed are never sent; a tree whose
nuget.config lists another feed without a mapping is not looked up
- through guarded_net, 8 at once, 10 s per request, 60 s and 300
uncached packages per scan; failures stay empty, one warning per scan
- cached across tenants in the admin database (nuget_licenses, TTL: a
year for a license, a week for none)
- NUGET_LICENSE_LOOKUP=false turns the nuget.org step off
Closes#467
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Minimal .NET/C# support for epic #445 (N1-N5): detection of solutions/projects and target frameworks, NuGet SBOM without build or restore (pkg:nuget purls for OSV, unresolved-dependency warning, end-of-support frameworks), own C# semgrep rule pack, .NET configuration and key-file checks, .NET build output and restored packages not counted as own code. Fixture fixtures/dotnet/framework48, docs .NET-Projekte (DE/EN).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Every member of a tenant could use Prüfwerk fully, whatever their org
role: nothing but manual findings checked org_roles. A FINANCE user
could create and delete targets, start scans and triage findings.
Now, as decided on 30.09.2026:
- IT_ADMIN, USER: read and write.
- CXO, LEGAL: read only. GET/HEAD/OPTIONS plus the POSTs that only
read (OSCAL assess, pentest report export, code chat, help chat).
- FINANCE or no role: no access.
- Agent: one middleware (api::role_gate) right after the JWT one
refuses with 403 {"error":"forbidden_role","access":...}. It is
classified by route template, so ids do not matter. Support sessions
(TenantContext.staff) and requests without a tenant context
(platform service API, Werkbank runner and admin APIs, health) are
unchanged. Manual findings stay IT_ADMIN-only.
- Core: ProductAccess and TenantContext::product_access.
- Dashboard: a role without access sees a "no access" page (DE/EN)
with a link back to the portal, and no server function runs for it.
Read-only roles get a read-only note, and write actions (add target,
scan, edit, delete, triage, tokens, MCP servers, pentest control,
graph/embedding builds, notification dismiss) are hidden. The direct
MCP server functions check the role, and access tokens are withheld
from read-only roles.
- MCP server: unchanged. Its tokens are tenant-bound and carry no
roles, its tools only read, and creating a token now needs write
access.
- Docs: the roles table in Getting Started.
- The crates are at version 0.4.4.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
The dashboard, the docs site and the pentest report no longer load
Google Fonts, so no visitor's IP goes to Google (platform/portal#65,
privacy release gate 4).
- Dashboard: Geist and Geist Mono (variable woff2, SIL OFL 1.1) are
embedded and served at /fonts/geist.woff2 and /fonts/geist-mono.woff2;
main.css declares them with @font-face under the same family names.
- Docs: the same woff2 files are bundled by Vite from the theme; the
Google Fonts links in config.mts are gone.
- Pentest report: preconnects and the Google Fonts stylesheet removed;
a system font stack instead, with a test that the report references
no external resource.
- The crates are at version 0.4.3.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Demonstration plan, phase D3 (dashboard side). Pairs with #251, which adds the agent endpoints and the `source_only` feature flag.
**Add demo targets.** The Targets page (empty state) and the onboarding wizard now offer a button that lists what the agent would create, seeds it, and reports per target `created` / `already there` / `failed` with the error inline. That replaces "onboard something by hand before you can see anything" for a trial user; the curl script stays for ops.
**MCP status.** The card never turned *running* on staging: the health URL was built by appending `/health` to an endpoint that already ends in `/mcp`, and the ingress routes `/mcp/*` to a server that serves `/health` at its own root. The probe now tries `…/mcp/health` and then `…/health`, and `MCP_HEALTH_URL` overrides it outright for the seeded cards (staging: `https://pruefwerk-stage.breakpilot.com/mcp/health`). Unit-tested through `mcp_health_url_candidates`.
**Source-only mode.** The dashboard reads the agent's `features` list from the public version handshake (cached, and an older agent without the key degrades to "everything enabled"). With `source_only` it hides dynamic application testing, pentest, the ICS probe and the PLC runtime behind one short note rather than offering actions that fail at the tool, and a stage the pipeline reports as skipped for that reason renders neutral instead of red.
**Control column.** The findings table shows the control-mapping column only when at least one finding in view carries `control_refs`, so an environment without a control catalog does not show a column of em dashes.
Docs: getting-started gains the demo-target entry point and a section on static-analysis-only environments; the MCP feature page documents the status probe and `MCP_HEALTH_URL`, which is also in `.env.example`.
Verified locally: `cargo fmt --all --check`, `cargo clippy -p compliance-dashboard --features server --no-default-features`, both dashboard test suites (`server` and `web` features) green.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com>
Reviewed-on: #252
Demonstration plan, phase D3 (agent side). Two things blocked a self-serve demo: a fresh trial tenant landed on an empty targets page, and staging tried to run DAST, pentest, the ICS probe and the soft-PLC runtime that are not deployed there, so those stages surfaced as tool errors.
## Seeding
| Request | Meaning |
|---|---|
| `GET /api/v1/targets/demo-seed` | what would be created: `key`, display `name`, `kind`, `description`, `source_only` |
| `POST /api/v1/targets/demo-seed` | body `{"names":[…],"rescan":false}`, empty `names` seeds all; `202` with one row per target, `status` = `queued` \| `exists` \| `failed` |
| `POST /api/v1/platform/tenants/demo/reset` | now takes `{"seed": true}` and reseeds with a service token, for the nightly sales-demo reset |
Seeding runs through a new shared target lifecycle (`compliance-agent/src/targets.rs`: create → store upload → attach → detect), which the onboarding handlers now call as well — so a seeded target is an ordinary target with the same records and the same `target.added` usage events, and there is no HTTP self-call. It is idempotent by display name: the seeder owns the `Demo · ` prefix, so a second call finds its own targets. `scan_id` is always `null` in the response because the scan run is created inside the background pipeline.
## Source-only set
The manifest is now source-only: `plc-pump-station`, `plc-conveyor-line`, `git-cra-vuln-demo`, `firmware-zephyr-example`. The Juice Shop target needed a running instance for DAST and pentest and is removed, along with `DEMO_WEB_URL`. Everything ships inside the agent binary (manifest plus the PLC upload fixtures), so a deployed agent seeds without the repo.
## `PW_FEATURES=source_only`
A static-analysis-only deployment: DAST, the ICS probe and the ephemeral PLC runtime record a `skipped_stages` entry on the scan run (`{stage, status:"skipped", reason:"feature disabled"}`) instead of failing; starting a DAST run or a pentest session answers `409`; the flag list is published on the public `/api/v1/platform/version` handshake so the dashboard reads the set the agent enforces rather than its own copy of the env. Unknown flags are kept and reported, so a dashboard-only flag needs no agent release.
Docs and the ops script are updated: `scripts/seed-demo-targets.sh --api` hands the job to the agent, the client-side path stays for `--reset` and for agents older than the checkout.
Verified locally: `cargo fmt --all --check`, `cargo clippy -p compliance-agent -- -D warnings`, `cargo clippy -p compliance-core -- -D warnings`, `cargo test -p compliance-core -p compliance-agent -p werkbank-exec -p control-map --lib` (414 tests). `compliance-agent/tests/demo_seed.rs` needs Mongo and runs outside CI like the other integration tests.
Pairs with the dashboard's "Add demo targets" button and with orca-platform setting `PW_FEATURES=source_only` on the staging agent.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com>
Reviewed-on: #251
Demonstration plan, phase D3: on staging `BREAKPILOT_BASE_URL` points at `api-dev.breakpilot.ai`, which answers 401 until the dsms migration (M-MIG-9, parked). Control mapping was gated on that URL, so demo scans produce findings with **no control references** — the one thing a CRA prospect looks for.
The catalog loader already snapshotted the bytes it fetched and fell back to them when the backend was down. This promotes the snapshot to a real source:
- `OscalControlsProvider` takes `Option<String>` for the base URL; with `None` it serves snapshots only, and `has_snapshots()` decides whether control triage runs at all.
- The agent image ships `compliance-agent/controls/snapshot/oscal-catalog-cra.json` — CRA Annex I, 8 groups / 40 controls, generated by breakpilot-compliance's own `build_cra_catalog()`, so it is byte-identical to what `?framework=cra` serves. The entrypoint copies it into `BREAKPILOT_SNAPSHOT_DIR` only if that file is absent, so a snapshot fetched from a live backend (or a mounted volume) always wins.
- `scripts/refresh-oscal-snapshot.sh` regenerates the committed snapshots from a backend when one is reachable.
- A test asserts the shipped file parses and still carries 40 controls, so a bad refresh cannot silently disable mapping.
`master-controls` is DB-derived (~3k controls) and is not shipped, so the semantic pass stays a no-op offline; staging should set `BREAKPILOT_SEMANTIC_MAPPING=false` and drop `BREAKPILOT_BASE_URL` (separate orca-platform change). Deterministic LUT triage and the grounded surface checks then run against the CRA catalog and findings carry `control_refs`.
Verified locally: `cargo fmt --all --check`, `cargo clippy -p compliance-agent -- -D warnings`, `cargo test -p compliance-agent --lib` (314 passed).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com>
Reviewed-on: #250
The PR `check` job authenticates the private tramiton-core git fetch, but the main-branch **`deploy-agent`** job builds `Dockerfile.agent` where cargo also fetches tramiton-core — inside the image build, with no credentials — so **agent image builds on main fail**.
Fix: inject the PAT as a **BuildKit secret** (never baked into an image layer).
- `Dockerfile.agent`: `RUN --mount=type=secret,id=tramiton_token …` applies the same `https`-insteadOf rewrite + `CARGO_NET_GIT_FETCH_WITH_CLI=true` before `cargo build`.
- `deploy-agent`: `DOCKER_BUILDKIT=1 docker build --secret id=tramiton_token,env=TRAMITON_FETCH_TOKEN …`, reusing the existing `TRAMITON_FETCH_TOKEN` secret.
Only the agent image depends on tramiton-core (dashboard/mcp/docs unaffected). **Self-tests on merge** — changing `Dockerfile.agent` makes `detect-changes` run `deploy-agent`.
Note: couldn't fully run the image build locally (no PAT value on hand + no `.dockerignore` so the context is large), but this mirrors the working PR-stage auth and uses standard BuildKit secret injection. Assumes the deploy runner's Docker daemon supports BuildKit (docker:27-cli → yes).
---------
Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com>
Reviewed-on: https://gitea.meghsakha.com/sharang/compliance-scanner-agent/pulls/143
Adds /mcp-tokens page so a logged-in user can mint, list, and revoke bearer tokens for the MCP server without curl. Pairs with #92's tenant-scoped MCP middleware — copy a token from the dashboard straight into an LLM client config.
Replaces M7.2-C static SCHEDULER_TENANT_IDS with a live query to the tenant-registry at every tick. New tenants picked up without an agent restart; env stays as fallback so a registry outage never silences the scheduler. Resolution order: registry -> SCHEDULER_TENANT_IDS env -> DEFAULT_SCHEDULER_TENANT_ID. Logs the active source on startup.
RUSTSEC-2026-0185 (quinn-proto 0.11.14): patch-bump to 0.11.15. RUSTSEC-2026-0189 (rmcp 0.16 DNS rebinding): added to ignore with public-hostname + bearer-auth threat-model justification; rmcp 0.16->2.x migration tracked as a separate multi-hour PR.
MCP server validates per-tenant bearer tokens on incoming calls and routes each tool to the caller's tenant DB. Closes the cross-tenant data leak in the MCP path identified in M7.3.
GET /api/admin/tenants lists tenant DBs; DELETE /api/admin/tenants/{tenant_id} drops them (GDPR). Behind a separate auth path that rejects customer realm tokens.
Webhook routes live on the separate webhook server (port 3002). M7.2-C URL form is /webhook/{tenant_id}/{platform}/{repo_id}; mounting unscoped variants on the API router would mismatch handler signatures.
## Summary
- **Scan produces no results in Orca** — semgrep (`--config=auto`, unbounded memory) and syft (remote license network calls) were getting OOM-killed or hanging in resource-constrained Orca containers. Scan would "complete" with 0 findings/SBOMs silently because each scanner failure is caught and logged as a warning.
- **Dashboard Script error spam** — `document::Script` in Dioxus 0.7 needs a single text node child for inline scripts; `dangerous_inner_html` was invalid and spammed the error log on every unauthenticated page load.
## Changes
| File | Change |
|------|--------|
| `semgrep.rs` | Add `--max-memory 500 --jobs 1`; 10-minute timeout |
| `syft.rs` | Remove remote license lookup env vars; 5-minute timeout |
| `gitleaks.rs` | 5-minute timeout |
| `app_shell.rs` | Fix `dangerous_inner_html` → text child in `document::Script` |
## Test plan
- [ ] Trigger a scan on a repo in Orca — findings and SBOM entries should now appear
- [ ] Agent logs should show timeout/error warnings rather than silent empty results when tools are killed
- [ ] Navigate to dashboard unauthenticated — Script error gone from logs
- [ ] Verify scans work end-to-end with `docker compose up`
---------
Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com>
Reviewed-on: https://gitea.meghsakha.com/sharang/compliance-scanner-agent/pulls/78
Each deploy job now builds the per-service image, pushes to the
private registry as :latest and :sha, then triggers an HMAC-signed
orca redeploy webhook. Coolify webhooks are no longer used.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Stage 2: Deploy (only on main, after checks pass)
# Each service only deploys when its relevant files changed.
@@ -111,8 +296,11 @@ jobs:
echo "Changed files:"
echo "$CHANGED"
# Agent: core libs, agent code, agent Dockerfile
if echo "$CHANGED" | grep -qE '^(compliance-core/|compliance-agent/|compliance-graph/|compliance-dast/|Dockerfile\.agent|Cargo\.(toml|lock))'; then
# Agent: core libs and the crates the agent links (werkbank-exec,
# control-map), agent code, agent Dockerfile and the helper scripts
# it copies from docker/, and the docs and README the help assistant
# answers from (baked into the image)
if echo "$CHANGED" | grep -qE '^(compliance-core/|compliance-agent/|compliance-graph/|compliance-dast/|werkbank-exec/|control-map/|docker/|Dockerfile\.agent|Cargo\.(toml|lock)|docs/|README\.md)'; then
echo "agent=true" >> "$GITHUB_OUTPUT"
else
echo "agent=false" >> "$GITHUB_OUTPUT"
@@ -144,53 +332,144 @@ jobs:
runs-on:docker
needs:[detect-changes]
if:needs.detect-changes.outputs.agent == 'true'
# One agent deploy at a time, in merge order. A queued one may be replaced
# by a newer one, which builds from a later main and so includes it.
concurrency:
group:deploy-agent
cancel-in-progress:false
container:
image:alpine:latest
image:docker:27-cli
steps:
- name:Trigger Coolify deploy
- name:Build, push and trigger orca redeploy
env:
# PAT for fetching the private firmwerk git dependency during the
# image build (injected as a BuildKit secret, never baked into a layer).
This starts MongoDB, SearXNG, the agent (port 3001), and the dashboard (port 8080).
### Nightly scan regression
Every night CI scans the fixture corpus with the agent image built from `main`
and compares the results with the baselines in `fixtures/nightly/baselines/`
(`.gitea/workflows/nightly.yml`). The corpus is the demo targets
(`fixtures/demo-targets/targets.json`, seeded by the agent itself) plus the
nightly-only fixtures (`fixtures/nightly/targets.json`: CODESYS archives, a
ladder diagram, a live PLC endpoint, a corrupt archive), which the harness
onboards through the API. The real CODESYS sample is not committed; point
`NIGHTLY_CODESYS_SAMPLE` at it or its target is skipped. To run it against any
agent in dev mode (use a fresh database: a rescan of an unchanged repo skips
most stages, so it records less than a first scan):
```bash
NIGHTLY_AGENT_URL=http://localhost:3001 \
cargo test -p compliance-agent --test nightly -- --nocapture
```
After an intended change to scan results, re-bless with `NIGHTLY_BLESS=1` (or
run the workflow by hand with "bless" ticked) and commit the baseline diff with
the change. The report lands in `target/nightly/report.md`.
## REST API
The agent exposes a REST API on port 3001:
@@ -154,43 +176,57 @@ The agent exposes a REST API on port 3001:
|--------|----------|-------------|
| `GET` | `/api/v1/health` | Health check |
| `GET` | `/api/v1/stats/overview` | Summary statistics and trends |
| `GET` | `/api/v1/repositories` | List tracked repositories |
| `POST` | `/api/v1/repositories` | Add a repository to track |
| `POST` | `/api/v1/repositories/:id/scan` | Trigger a manual scan |
| `GET` | `/api/v1/cve-history?days=30[&target=][&project=][&per_target=true]` | Open CVEs with a fixed version per day (UTC) by severity, for the tenant, a target or a project, with the open critical/high findings |
| `GET` | `/api/v1/targets/{id}/top-updates` | The package updates that close the most of a target's open CVEs with a fix |
| `GET` | `/api/v1/targets` | List targets (Prüfobjekte), each with its newest scan run |
"source":"https://learn.microsoft.com/lifecycle/products/microsoft-net-framework and https://dotnet.microsoft.com/platform/support/policy/dotnet-core",
"endoflife_products":[
"dotnet",
"dotnetfx"
],
"checked_on":"2026-10-05",
"notes":"Microsoft's end of support per target framework moniker. Monikers not listed are supported (.NET Framework 4.7 to 4.8.1 follow the Windows they ship with).",
"notes":"Below this API level no Android release receives security updates."
},
"ios":{
"oldest_patched":"15.0",
"endoflife_product":"ios",
"notes":"The oldest iOS release that still receives security updates: iOS 15 got 15.8.8 in May 2026, while iOS 14 was last updated in October 2021 and the older iOS 12 line in January 2026, both now end of life (endoflife.date). Judged conservatively: below it is certainly unpatched."
"notes":"Codename, version, LTS and support status from the Yocto Project releases wiki (page last updated 2026-09-10). The wiki gives months only; the exact release and end-of-life days are endoflife.date's, which agree with the wiki's months except Walnascar (wiki: EOL since November 2025, endoflife.date: 2025-12-07). For Thud and older, which endoflife.date does not list, the end of life is the last day of the month of the release's last point release (wiki), and the release day the first of its month. Releases are added once they are released. Oldest first.",
# --- cra-ai-14: Speicher-Schutz / Data at Rest (weak cipher) -----------------
- id:cra-ai-14-python-weak-cipher
languages:[python]
severity:ERROR
message:Data-at-rest encrypted with a broken cipher/mode (ECB, DES, 3DES) — provides no real confidentiality.
metadata:
cwe:["CWE-327: Use of a Broken or Risky Cryptographic Algorithm"]
control:cra-ai-14
patterns:
- pattern-either:
- pattern:'AES.new($K, AES.MODE_ECB, ...)'
- pattern:'DES.new(...)'
- pattern:'DES3.new(...)'
- id:cra-ai-14-node-weak-cipher
languages:[javascript, typescript]
severity:ERROR
message:Data-at-rest encrypted with a broken cipher (DES / deprecated createCipher) — provides no real confidentiality.
metadata:
cwe:["CWE-327: Use of a Broken or Risky Cryptographic Algorithm"]
control:cra-ai-14
patterns:
- pattern-either:
- pattern:'crypto.createCipheriv("des-ecb", ...)'
- pattern:'crypto.createCipheriv("des", ...)'
- pattern:'crypto.createCipher(...)'
# --- Python and JavaScript/TypeScript: injection, credentials, transport -------
# A constant string never matches; the reflected-input rule follows Express
# request input (`req.query`, `req.params`, `req.body`) into the response.
# Annotated cases: cra_semgrep.py / cra_semgrep.js, run with
# `semgrep --test compliance-agent/rules`.
- id:cra-ai-20-python-shell-command
languages:[python]
severity:ERROR
message:A shell command is built from a variable, so whoever controls it can run any command (CWE-78). Pass an argument list without shell=True, or validate the value against an allowlist.
metadata:
cwe:["CWE-78: Improper Neutralization of Special Elements used in an OS Command"]
message:An SQL statement is assembled from a variable, so its value can change the query (SQL injection, CWE-89). Pass values as query parameters (cursor.execute(sql, params)).
metadata:
cwe:["CWE-89: Improper Neutralization of Special Elements used in an SQL Command"]
control:cra-ai-20
patterns:
- pattern-either:
- pattern:$CUR.execute("..." + $X, ...)
- pattern:$CUR.execute("..." % $X, ...)
- pattern:$CUR.execute(f"...", ...)
- pattern:$CUR.execute("...".format(...), ...)
- pattern:$CUR.executemany("..." + $X, ...)
- pattern-not:$CUR.execute(f"{$C}", ...)
- id:cra-ai-20-python-unsafe-deserialization
languages:[python]
severity:ERROR
message:Data is deserialised with a loader that can build arbitrary objects, so crafted input runs code (CWE-502). Use yaml.safe_load, or JSON for data from outside.
metadata:
cwe:["CWE-502: Deserialization of Untrusted Data"]
message:A shell command is built from a variable, so whoever controls it can run any command (CWE-78). Use execFile/spawn with an argument list, or validate the value against an allowlist.
metadata:
cwe:["CWE-78: Improper Neutralization of Special Elements used in an OS Command"]
control:cra-ai-20
patterns:
- pattern-either:
- pattern:exec($CMD, ...)
- pattern:execSync($CMD, ...)
- pattern:$CP.exec($CMD, ...)
- pattern:$CP.execSync($CMD, ...)
- pattern-not:exec("...", ...)
- pattern-not:execSync("...", ...)
- pattern-not:$CP.exec("...", ...)
- pattern-not:$CP.execSync("...", ...)
- pattern-not:$CP.exec(`...`, ...)
- pattern-inside:|
$REQ = require("child_process")
...
- pattern-not:$RE.exec($X)
- id:cra-ai-20-node-reflected-input
languages:[javascript, typescript]
severity:WARNING
message:Request input is written into the response without encoding, so a crafted link runs script in the user's browser (reflected XSS, CWE-79). Encode it, or use a template engine that escapes by default.
metadata:
cwe:["CWE-79: Improper Neutralization of Input During Web Page Generation"]
control:cra-ai-20
mode:taint
pattern-sources:
- pattern-either:
- pattern:$REQ.query
- pattern:$REQ.params
- pattern:$REQ.body
pattern-sinks:
- pattern-either:
- pattern:$RES.send(...)
- pattern:$RES.write(...)
pattern-sanitizers:
- pattern-either:
- pattern:encodeURIComponent(...)
- pattern:escape(...)
- pattern:escapeHtml(...)
- pattern:parseInt(...)
- pattern:Number(...)
- id:cra-ai-8-python-hardcoded-credential
languages:[python]
severity:ERROR
message:$NAME holds a credential written into the code, so every installation ships the same secret (CWE-798). Read it from the environment or a secret store.
# C and C++ sources alike (`languages: [c, cpp]`), with the `std::` spellings.
# Microcontroller code: unbounded string handling, non-literal format strings,
# credentials compiled into every device, broken crypto and predictable
# randomness. Memory-safety defects that need data flow (out-of-bounds
# writes, uninitialised reads) come from cppcheck, not from these patterns.
- id:cra-ai-20-c-unbounded-string-function
languages:[c, cpp]
severity:ERROR
message:$FN() writes without a bound on the destination — input longer than the buffer overflows it (CWE-120). Use a bounded call (snprintf, strncpy/strlcpy with the buffer size).
metadata:
cwe:["CWE-120: Buffer Copy without Checking Size of Input"]
message:A "%s" conversion without a field width reads unbounded input into a fixed buffer (CWE-120). Give the conversion a width, e.g. "%15s".
metadata:
cwe:["CWE-120: Buffer Copy without Checking Size of Input"]
control:cra-ai-20
patterns:
- pattern-either:
- pattern:scanf($FMT, ...)
- pattern:sscanf($SRC, $FMT, ...)
- pattern:fscanf($FILE, $FMT, ...)
- metavariable-regex:
metavariable:$FMT
regex:^".*%s.*"$
- id:cra-ai-20-c-non-literal-format-string
languages:[c, cpp]
severity:WARNING
message:The format string is not a literal — text an attacker controls can read or write memory through format specifiers (CWE-134). Print it with a literal format, e.g. printf("%s", text).
metadata:
cwe:["CWE-134: Use of Externally-Controlled Format String"]
control:cra-ai-20
patterns:
- pattern-either:
- pattern:printf($FMT, ...)
- pattern:vprintf($FMT, ...)
- pattern:fprintf($F, $FMT, ...)
- pattern:sprintf($B, $FMT, ...)
- pattern:snprintf($B, $N, $FMT, ...)
- pattern:syslog($P, $FMT, ...)
# C++ reaches the same functions through std::.
- pattern:std::printf($FMT, ...)
- pattern:std::fprintf($F, $FMT, ...)
- pattern:std::sprintf($B, $FMT, ...)
- pattern:std::snprintf($B, $N, $FMT, ...)
# Not a literal, and not an upper-case macro (`#define GET_REQUEST
# "GET / HTTP/1.1"`): a macro like that expands to a literal.
- metavariable-regex:
metavariable:$FMT
regex:^(?![A-Z][A-Z0-9_]*$)[^"]
- id:cra-ai-8-c-hardcoded-credential
languages:[c, cpp]
severity:ERROR
message:A credential ($NAME) is written into the firmware source — every device ships the same secret, and it can be read out of the image (CWE-798). Provision it per device at production or first boot.
metadata:
cwe:["CWE-798: Use of Hard-coded Credentials"]
control:cra-ai-8
patterns:
- pattern-either:
- pattern:$TYPE $NAME = "$VALUE";
- pattern:$TYPE *$NAME = "$VALUE";
- pattern:$TYPE $NAME[] = "$VALUE";
- pattern:$TYPE $NAME[$N] = "$VALUE";
# The usual embedded style: a macro in a config header
# (`#define WIFI_PASS "..."`), which semgrep's C patterns do not see.
message:$FN uses a broken algorithm (MD5, SHA-1 or DES) that protects neither integrity nor confidentiality (CWE-327). Use SHA-256 or better, and AES-GCM or ChaCha20-Poly1305.
metadata:
cwe:["CWE-327: Use of a Broken or Risky Cryptographic Algorithm"]
# Prüfwerk's own semgrep rules for C# (.NET Framework and .NET), #445. Written
# for Prüfwerk, not adapted from any third-party rule set (the Semgrep registry
# rules may not be used for a service offered to others).
# Same conventions as cra_semgrep.yaml: each rule id is `cra-ai-<n>-<slug>`,
# keyed back to its control via the `control-map` LUT, with its CWE and
# control in the metadata. Keep patterns tight: a false positive that the
# judge refutes marks the whole finding a false positive.
# Test cases: cra_semgrep_csharp.cs (`semgrep --test compliance-agent/rules`).
rules:
# --- cra-ai-20: injection and unsafe input handling --------------------------
- id:cra-ai-20-csharp-sql-string
languages:[csharp]
severity:ERROR
message:SQL text is built from strings (concatenation, interpolation or String.Format) and run as a command — SQL injection (CWE-89). Pass the values as parameters (SqlParameter, AddWithValue, FromSqlInterpolated).
metadata:
cwe:["CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')"]
message:A process is started with a command line built from strings — command injection if any part comes from outside (CWE-78). Start a fixed program with an argument list (ProcessStartInfo.ArgumentList) and validate the values.
metadata:
cwe:["CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"]
control:cra-ai-20
patterns:
- pattern-either:
- pattern:Process.Start($ARG, ...)
- pattern:Process.Start($FILE, $ARG, ...)
- pattern:new ProcessStartInfo($ARG, ...)
- pattern:new ProcessStartInfo($FILE, $ARG, ...)
- pattern:$P.Arguments = $ARG
# Only a ProcessStartInfo's: a file dialog's FileName is no command.
- patterns:
- pattern-either:
- pattern-inside:|
$PT $P = new ProcessStartInfo(...);
...
- pattern-inside:|
var $P = new ProcessStartInfo(...);
...
- pattern-inside:|
$P = new ProcessStartInfo(...);
...
- pattern:$P.FileName = $ARG
- metavariable-pattern:
metavariable:$ARG
patterns:
- pattern-either:
- pattern:'"..." + $E'
- pattern:$E + "..."
- pattern:String.Format(...)
- pattern:string.Format(...)
- pattern:String.Concat(...)
- pattern-regex:(?s)^(\$@?|@\$)".*\{
- pattern-not:'"..." + "..."'
- id:cra-ai-20-csharp-unsafe-deserialization
languages:[csharp]
severity:ERROR
message:$TYPE deserializes type information from its input, so data from outside can run code (CWE-502). Use a serializer bound to known types (System.Text.Json, DataContractSerializer, JSON.NET with TypeNameHandling.None).
metadata:
cwe:["CWE-502: Deserialization of Untrusted Data"]
message:XML is parsed with DTD processing or an external resolver enabled — external entities can read local files or reach internal hosts (XXE, CWE-611). Set XmlResolver = null and DtdProcessing = DtdProcessing.Prohibit (the default only from .NET Framework 4.5.2 on).
metadata:
cwe:["CWE-611: Improper Restriction of XML External Entity Reference"]
control:cra-ai-20
pattern-either:
- pattern:$X.XmlResolver = new XmlUrlResolver(...)
- pattern:$X.DtdProcessing = DtdProcessing.Parse
- pattern:$X.ProhibitDtd = false
- patterns:
- pattern-either:
- pattern-inside:|
$D = new XmlDocument();
...
- pattern-inside:|
$DT $D = new XmlDocument();
...
- pattern-inside:|
var $D = new XmlDocument();
...
- pattern-inside:|
$D = new XmlTextReader(...);
...
- pattern-inside:|
$DT $D = new XmlTextReader(...);
...
- pattern-inside:|
var $D = new XmlTextReader(...);
...
- pattern-not-inside:|
$D.XmlResolver = null;
...
- pattern-not-inside:|
$D.DtdProcessing = DtdProcessing.Prohibit;
...
- pattern-not-inside:|
var $D = new $T { ..., XmlResolver = null, ... };
...
- pattern-not-inside:|
$DT $D = new $T { ..., XmlResolver = null, ... };
...
- pattern-either:
- pattern:$D.Load(...)
- pattern:$D.LoadXml(...)
- pattern:$D.Read()
- id:cra-ai-20-csharp-path-traversal
languages:[csharp]
severity:WARNING
message:A file path is built from request input — "..\" in it reaches files outside the intended folder (path traversal, CWE-22). Take only the file name (Path.GetFileName) and check the full path stays under the base folder.
metadata:
cwe:["CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')"]
message:$ALG is a broken algorithm (MD5, SHA-1, DES, 3DES or RC2) that protects neither integrity nor confidentiality (CWE-327). Use SHA-256 or better, and AES-GCM.
metadata:
cwe:["CWE-327: Use of a Broken or Risky Cryptographic Algorithm"]
message:ECB mode encrypts equal blocks to equal ciphertext, so the structure of the data shows through (CWE-327). Use AES-GCM, or CBC with a random IV and a MAC.
metadata:
cwe:["CWE-327: Use of a Broken or Risky Cryptographic Algorithm"]
message:TLS certificate validation is switched off (the callback accepts every certificate), so anyone on the network path can read and change the traffic (CWE-295). Remove the callback, or pin the expected certificate.
# --- cra-ai-8: Keine Default-Passwörter --------------------------------------
- id:cra-ai-8-csharp-hardcoded-credential
languages:[csharp]
severity:ERROR
message:A credential ($NAME) is written into the source — every installation shares it, and it can be read out of the assembly (CWE-798). Load it from protected configuration or a secret store.
# Prüfwerk's own semgrep rules for Objective-C (iOS apps), as regex patterns:
# semgrep has no Objective-C parser. Same conventions and provenance as
# cra_semgrep_swift.yaml, whose Swift rules these mirror.
# Test cases: cra_semgrep_objc.m (`semgrep --test compliance-agent/rules`).
rules:
# --- cra-ai-14: data at rest -------------------------------------------------
- id:cra-ai-14-objc-secret-in-userdefaults
languages:[regex]
severity:WARNING
message:A password, token or key is stored in NSUserDefaults, an unencrypted plist in the app container that backups and device extraction read (CWE-312). Store it in the Keychain (kSecClassGenericPassword, with a ThisDeviceOnly accessibility).
metadata:
cwe:["CWE-312: Cleartext Storage of Sensitive Information"]
# Prüfwerk's own semgrep rules for Swift (iOS apps; Objective-C is in
# cra_semgrep_objc.yaml). Written for Prüfwerk, not
# adapted from any third-party rule set (the Semgrep registry rules may not be
# used for a service offered to others). mobsfscan already covers ATS, the
# Keychain accessibility, weak hashes and ciphers, TLS and web views; these
# rules cover what it does not.
# Same conventions as cra_semgrep.yaml: each rule id is `cra-ai-<n>-<slug>`,
# keyed back to its control via the `control-map` LUT, with its CWE and
# control in the metadata. Keep patterns tight: a false positive that the
# judge refutes marks the whole finding a false positive.
# Test cases: cra_semgrep_swift.swift (`semgrep --test compliance-agent/rules`).
rules:
# --- cra-ai-14: data at rest -------------------------------------------------
- id:cra-ai-14-swift-secret-in-userdefaults
languages:[swift]
severity:WARNING
message:A password, token or key is stored in UserDefaults, an unencrypted plist in the app container that backups and device extraction read (CWE-312). Store it in the Keychain (kSecClassGenericPassword, with a ThisDeviceOnly accessibility).
metadata:
cwe:["CWE-312: Cleartext Storage of Sensitive Information"]
message:A password, token or key is kept in @AppStorage, which stores it in UserDefaults, an unencrypted plist in the app container that backups and device extraction read (CWE-312). Store it in the Keychain instead.
metadata:
cwe:["CWE-312: Cleartext Storage of Sensitive Information"]
Prüfwerk runs these rules with its own semgrep invocation (--metrics=off,
local files only). upstream/ holds the selected files unchanged, with
their semgrep tests. pack.yaml is what the agent runs: the same rules with
ids prefixed by '0xdea-', re-serialised into one file, without
the rules listed below. Both are produced by scripts/vendor-semgrep-rules.py.
Selected from upstream: rules/c/**
Rules in the pack: 35 (from 49 files)
Not selected:
- rules/noisy/: upstream marks these unsuitable for general use
Left out
--------
- 0xdea-raptor-argv-envp-access (rules/c/argv-envp-access.yaml): 43 hits on every argv/getenv read; an audit aid, not a weakness
- 0xdea-raptor-format-string-bugs (rules/c/format-string-bugs.yaml): FP storm: 61 hits in lwIP, all literal formats joined with a macro ("%s"NEWLINE); our cra-ai-20-c-non-literal-format-string covers the real case
- 0xdea-raptor-high-entropy-assignment (rules/c/high-entropy-assignment.yaml): 14 hits, sampled hits are base64 tables and exception-name strings; gitleaks covers committed secrets
- 0xdea-raptor-integer-truncation (rules/c/integer-truncation.yaml): 23 hits in lwIP, sampled hits assign small constants (`x = 1`)
- 0xdea-raptor-interesting-api-calls (rules/c/interesting-api-calls.yaml): FP storm: 718 hits in lwIP; lists every call of an "interesting" API for a manual audit
- 0xdea-raptor-mismatched-memory-management (rules/c/mismatched-memory-management.yaml): 36 hits in lwIP, sampled hits are plain matching malloc/free pairs
- 0xdea-raptor-missing-break-in-switch (rules/c/missing-break-in-switch.yaml): intended fallthrough in FreeRTOS-Kernel and lwIP; a review hint by upstream's own description (code quality / audit aid), not a weakness
- 0xdea-raptor-missing-default-in-switch (rules/c/missing-default-in-switch.yaml): 22 hits; a review hint by upstream's own description (code quality / audit aid), not a weakness
- 0xdea-raptor-missing-return (rules/c/missing-return.yaml): FP storm: 1514 hits in FreeRTOS-Kernel (port macros); a review hint by upstream's own description (code quality / audit aid), not a weakness
- 0xdea-raptor-pointer-subtraction (rules/c/pointer-subtraction.yaml): 16 hits in lwIP, all `len = end - start` length arithmetic
- 0xdea-raptor-signed-unsigned-conversion (rules/c/signed-unsigned-conversion.yaml): FP storm: 221 hits in FreeRTOS-Kernel and lwIP, nearly all benign casts
- 0xdea-raptor-suspicious-assert (rules/c/suspicious-assert.yaml): FP storm: 176 hits in FreeRTOS-Kernel and lwIP (configASSERT/LWIP_ASSERT on sizes)
- 0xdea-raptor-typos (rules/c/typos.yaml): FP storm: 989 hits in FreeRTOS-Kernel and lwIP; a review hint by upstream's own description (code quality / audit aid), not a weakness
- 0xdea-raptor-write-into-stack-buffer (rules/c/write-into-stack-buffer.yaml): 27 hits on every write into a stack array; an audit aid, not a weakness
The software uses a function that accepts a format string as an argument,
but the format string originates from an external source. This can lead
to buffer overflows, denial of service, or data representation problems.
severity:ERROR
languages:
- c
- cpp
# NOTE: generic `va_list` matching for custom wrappers is not covered.
# NOTE: `dprintf` in C++ has a different signature; this rule may cause false positives with it.
# NOTE: `#define` format specifiers are not excluded due to Semgrep limitations; perhaps we could implement this with symbolic propagation (Semgrep Pro experimental feature)?
# NOTE: some obsolete Microsoft-specific functions, such as `_ftprintf`, `_sntprintf`, `_snwprintf`, `_sntscanf`, etc., are not covered.
The software calls free() on a pointer to memory that has a short
lifetime and was not allocated using associated heap allocation
functions such as malloc(), calloc(), or realloc().
severity:ERROR
languages:
- c
- cpp
# NOTE: this rule only covers `free` called on stack-allocated buffers (and possibly static variables); it does not cover other instances of `free` called on non-heap-allocated buffers; it also does not cover `alloca` and custom wrappers to `free`.
# NOTE: multi-dimensional arrays and other ways to create an array are not covered.
# NOTE: refer also to `raptor-mismatched-memory-management.yaml`.
vulnerability_class:Mishandled Sensitive Information
likelihood:MEDIUM
impact:MEDIUM
confidence:HIGH
technology:
- c
- cpp
cwe:
- "CWE-683: Function Call With Incorrect Order of Arguments"
owasp:
- A04:2025 - Cryptographic Failures
references:
- https://lkml.org/lkml/2009/11/11/336
- https://bugs.mysql.com/bug.php?id=23181
message:>-
The invocation of memset() is easy to get wrong. The second argument
is the character and the third argument is the size, but sometimes
these arguments are in the wrong order. This results in a no-op.
severity:ERROR
languages:
- c
- cpp
# NOTE: refer also to `c.lang.security.insecure-use-memset.insecure-use-memset` and `cpp.lang.correctness.memset-removal.memset-removal` for a different potential flaw involving `memset` optimization.
- "CWE-681: Incorrect Conversion between Numeric Types"
owasp:
- A10:2025 - Mishandling of Exceptional Conditions
references:
- https://g.co/kgs/PCHQjJ
- https://github.com/struct/mms
message:>-
Truncation errors occur when a primitive is cast to a primitive of a
smaller size and data is lost in the conversion. The value cannot be
trusted and the application will be in an undefined state.
severity:WARNING
languages:
- c
- cpp
# NOTE: the deep expression operator is necessary to catch some matches because C/C++ integer promotions do not seem entirely supported by Semgrep; this may generate lots of false positives.
# NOTE: some types (e.g., pointers) and use cases (e.g., comparisons) are not covered.
pattern-either:
# char: assignments
- patterns:
- pattern-either:
- pattern:(char $_) = <... (short $_) ...>
- pattern:(char $_) = <... (short int $_) ...>
- pattern:(char $_) = <... (unsigned short $_) ...>
- pattern:(char $_) = <... (unsigned short int $_) ...>
- pattern:(char $_) = <... (int $_) ...>
- pattern:(char $_) = <... (unsigned $_) ...>
- pattern:(char $_) = <... (unsigned int $_) ...>
- pattern:(char $_) = <... (long $_) ...>
- pattern:(char $_) = <... (long int $_) ...>
- pattern:(char $_) = <... (unsigned long $_) ...>
- pattern:(char $_) = <... (unsigned long int $_) ...>
- pattern-not:$_ = 0
# char: function return
- patterns:
- pattern-either:
- pattern:|
char $FUN(...)
{
...
return (short $_);
}
- pattern:|
char $FUN(...)
{
...
return (int $_);
}
- pattern:|
char $FUN(...)
{
...
return (long $_);
}
# improve output readability
- focus-metavariable:$FUN
# short: assignments
- patterns:
- pattern-either:
- pattern:(short $_) = <... (unsigned short $_) ...>
- pattern:(short int $_) = <... (unsigned short int $_) ...>
- pattern:(short $_) = <... (int $_) ...>
- pattern:(short $_) = <... (unsigned $_) ...>
- pattern:(short int $_) = <... (unsigned int $_) ...>
- pattern:(short $_) = <... (long $_) ...>
- pattern:(short int $_) = <... (long int $_) ...>
- pattern:(short $_) = <... (unsigned long $_) ...>
- pattern:(short int $_) = <... (unsigned long int $_) ...>
- pattern:(unsigned short $_) = <... (int $_) ...>
- pattern:(unsigned short int $_) = <... (unsigned int $_) ...>
- pattern:(unsigned short $_) = <... (long $_) ...>
- pattern:(unsigned short int $_) = <... (long int $_) ...>
- pattern:(unsigned short $_) = <... (unsigned long $_) ...>
- pattern:(unsigned short int $_) = <... (unsigned long int $_) ...>
- pattern-not:$_ = 0
# short: function return
- patterns:
- pattern-either:
- pattern:|
short $FUN(...)
{
...
return (int $_);
}
- pattern:|
short $FUN(...)
{
...
return (long $_);
}
# improve output readability
- focus-metavariable:$FUN
# int: assignments
- patterns:
- pattern-either:
- pattern:(int $_) = <... (unsigned $_) ...>
- pattern:(int $_) = <... (unsigned int $_) ...>
- pattern:(int $_) = <... (long $_) ...>
- pattern:(int $_) = <... (long int $_) ...>
- pattern:(int $_) = <... (unsigned long $_) ...>
- pattern:(int $_) = <... (unsigned long int $_) ...>
- pattern-not:$_ = 0
# int: function return
- patterns:
- pattern:|
int $FUN(...)
{
...
return (long $_);
}
# improve output readability
- focus-metavariable:$FUN
# long: assignments
- patterns:
- pattern-either:
- pattern:(long $_) = <... (unsigned long $_) ...>
- pattern:(long int $_) = <... (unsigned long int $_) ...>
The software performs a calculation that can produce an integer
overflow or wraparound, when the logic assumes that the resulting
value will always be larger than the original value. This can
introduce other weaknesses when the calculation is used for resource
management or execution control.
severity:WARNING
languages:
- c
- cpp
# NOTE: only multiplication and sum with two operands are covered; other arithmetic operations should also be considered (e.g., left shift, even subtraction), as well as any operation with more than two operands.
# NOTE: some allocation functions such as `kmalloc`, `HeapAlloc`, and custom wrappers are not covered.
# NOTE: there might exist other buggy input validation patterns not covered here, including the same patterns with a different order of operands.
# NOTE: consider excluding `strlen` patterns to avoid false positives (at the cost of some false negatives).
# NOTE: we should do some tests with the deep expression operator, refer also to `cpp.lang.security.memory.integer-overflow-allocation.integer-overflow-allocation`.
# NOTE: a dedicated rule for C++ operators such as `new` should be implemented.
Locate all calls to interesting and potentially insecure API
functions (candidate points). The auditor can backtrace from these
candidate points to find pathways allowing access from untrusted
input.
severity:WARNING
languages:
- c
- cpp
# NOTE: `goto`, `try/catch`, `sem/mutex`, `new/delete`, and `static_cast/reinterpret_cast` are not covered.
# NOTE: not all Microsoft-specific obsolete functions are covered.
# NOTE: consider excluding some matches for `strncpy`, `snprintf`, and similar functions where the length parameter is known at compile time (see `memcpy` below for an example). See also another possible approach described at https://cc-sw.com/semgrep-guide-for-a-security-engineer-part-6-of-6/. Beware of possible false negatives, though.
# NOTE: consider checking for format string specifiers that match the `(".*%l?s.*"|".*%S.*"|[a-zA-Z_][a-zA-Z0-9_]*)` regex.
# NOTE: consider extracting some patterns into separate rules to focus on the most interesting API calls (copy operations, exec functions, etc.).
# NOTE: nonlocking stdio functions (https://linux.die.net/man/3/fgets_unlocked) are not covered.
# NOTE: refer also to https://semgrep.dev/r?lang=C
vulnerability_class:Mishandled Sensitive Information
likelihood:LOW
impact:MEDIUM
confidence:LOW
technology:
- c
- cpp
cwe:
- "CWE-209: Generation of Error Message Containing Sensitive Information"
- "CWE-497: Exposure of Sensitive System Information to an Unauthorized Control Sphere"
owasp:
- A04:2025 - Cryptographic Failures
references:
- https://github.com/struct/mms
message:>-
The software generates an error message that includes sensitive
information about its environment, users, or associated data.
In particular, exposure of memory addresses might defeat ASLR.
severity:INFO
languages:
- c
- cpp
# NOTE: `#define` format specifiers are not considered due to Semgrep limitations, perhaps we could implement this with symbolic propagation (Semgrep Pro experimental feature)?
patterns:
- pattern-either:
# format string in 1st arg
- pattern:printf($FMT, ...)
- pattern:vprintf($FMT, ...)
- pattern:wprintf($FMT, ...)
- pattern:vwprintf($FMT, ...)
- pattern:vcprintf($FMT, ...)
- pattern:vcwprintf($FMT, ...)
- pattern:vscprintf($FMT, ...)
- pattern:vscwprintf($FMT, ...)
- pattern:printk($FMT, ...)
- pattern:warn($FMT, ...)
- pattern:vwarn($FMT, ...)
- pattern:warnx($FMT, ...)
- pattern:vwarnx($FMT, ...)
# format string in 2nd arg
- pattern:fprintf($_, $FMT, ...)
- pattern:vfprintf($_, $FMT, ...)
- pattern:fwprintf($_, $FMT, ...)
- pattern:vfwprintf($_, $FMT, ...)
- pattern:sprintf($_, $FMT, ...)
- pattern:vsprintf($_, $FMT, ...)
- pattern:asprintf($_, $FMT, ...)
- pattern:vasprintf($_, $FMT, ...)
- pattern:dprintf($_, $FMT, ...)
- pattern:vdprintf($_, $FMT, ...)
- pattern:wsprintf($_, $FMT, ...)
- pattern:syslog($_, $FMT, ...)
- pattern:vsyslog($_, $FMT, ...)
- pattern:err($_, $FMT, ...)
- pattern:verr($_, $FMT, ...)
- pattern:errx($_, $FMT, ...)
- pattern:verrx($_, $FMT, ...)
- pattern:warnc($_, $FMT, ...)
- pattern:vwarnc($_, $FMT, ...)
# format string in 3rd arg
- pattern:snprintf($_, $_, $FMT, ...)
- pattern:vsnprintf($_, $_, $FMT, ...)
- pattern:swprintf($_, $_, $FMT, ...)
- pattern:vswprintf($_, $_, $FMT, ...)
- pattern:errc($_, $_, $FMT, ...)
- pattern:verrc($_, $_, $FMT, ...)
- metavariable-regex:
metavariable:$FMT
# NOTE: some format string specifiers are not handled
Loaded 100 of 1421 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.