Backend foundation for the artifact-aware onboarding redesign (epic #118). Replaces the git-only TrackedRepository / DastTarget split with a single OnboardedTarget that is classified by what kind of software it is and carries the concrete artifacts provided for it.
This is steps 1–2 of the approved plan (full-unification, foundation-first). It is purely additive — no legacy scan path is touched, and the old models/collections stay in place. Nothing wires into the pipeline yet.
Changes
compliance-core
models/onboarding.rs (new) — OnboardedTarget with TargetType (9 families: web, backend, desktop, Android, iOS, bare-metal firmware, RTOS firmware, Yocto, PLC/SPS) and ArtifactKind (8 kinds: git, source archive, firmware image, mobile package, container image, live URL, PLC project, plaintext). Artifact carries per-kind config + ArtifactAuth (folds TrackedRepository git auth andDastAuthConfig). Plus Classification, TargetScanConfig (reuses the existing PentestConfig / tracker config).
scan_matrix.rs (new) — table-driven applicable_scans(target) / rules_for(type) / supports_pentest(type). The SAST umbrella + firmware/PLC/mobile/DAST scans are gated on which artifacts are actually present; a scan whose artifact is missing comes back with a blocked_reason.
traits/classifier.rs (new) — TargetClassifier port, mirroring the existing Scanner trait.
pipeline/patterns.rs — drop a now-redundant ScanType clone surfaced by the Copy derive.
Design notes
Id-preservation strategy (for the later migration): OnboardedTarget._id is meant to occupy the same id-space as the legacy TrackedRepository / DastTarget_id, so downstream collections keyed by repo_id / target_id keep resolving with zero row rewrites. This PR only lays the model; the migration is a later step (#132).
The unique-git_url guarantee moves from a DB unique index to an app-level check (a unique multikey index on an array field has null-collision caveats) — the artifacts.source_ref index here is intentionally non-unique.
Testing
17 new unit tests (serde/bson round-trip, enum display, artifact helpers, DastAuthConfig fold, and the applicable_scans truth table per target type). Verified against the exact CI commands:
Next: artifact ingest (#120) and the classifier impls + tramiton detector (#121), then the feature-flagged pipeline rewrite (#133) and migration (#132). Full breakdown in epic #118.
## What
Backend **foundation** for the artifact-aware onboarding redesign (epic #118). Replaces the git-only `TrackedRepository` / `DastTarget` split with a single `OnboardedTarget` that is classified by *what kind of software* it is and carries the concrete artifacts provided for it.
This is **steps 1–2** of the approved plan (full-unification, foundation-first). It is **purely additive** — no legacy scan path is touched, and the old models/collections stay in place. Nothing wires into the pipeline yet.
## Changes
**compliance-core**
- `models/onboarding.rs` (new) — `OnboardedTarget` with `TargetType` (9 families: web, backend, desktop, Android, iOS, bare-metal firmware, RTOS firmware, Yocto, PLC/SPS) and `ArtifactKind` (8 kinds: git, source archive, firmware image, mobile package, container image, live URL, PLC project, plaintext). `Artifact` carries per-kind config + `ArtifactAuth` (folds `TrackedRepository` git auth *and* `DastAuthConfig`). Plus `Classification`, `TargetScanConfig` (reuses the existing `PentestConfig` / tracker config).
- `scan_matrix.rs` (new) — table-driven `applicable_scans(target)` / `rules_for(type)` / `supports_pentest(type)`. The SAST umbrella + firmware/PLC/mobile/DAST scans are gated on which artifacts are actually present; a scan whose artifact is missing comes back with a `blocked_reason`.
- `traits/classifier.rs` (new) — `TargetClassifier` port, mirroring the existing `Scanner` trait.
- `models/scan.rs` — additive `ScanType` / `ScanPhase` variants (firmware-static, PLC control-logic, mobile-static, container). `ScanType` now derives `Copy`.
**compliance-agent**
- `database.rs` — `onboarded_targets()` collection accessor + 3 indexes (`artifacts.source_ref`, `artifacts.kind`, `target_type`).
- `pipeline/patterns.rs` — drop a now-redundant `ScanType` clone surfaced by the `Copy` derive.
## Design notes
- **Id-preservation strategy** (for the later migration): `OnboardedTarget._id` is meant to occupy the same id-space as the legacy `TrackedRepository` / `DastTarget` `_id`, so downstream collections keyed by `repo_id` / `target_id` keep resolving with zero row rewrites. This PR only lays the model; the migration is a later step (#132).
- The unique-`git_url` guarantee moves from a DB unique index to an app-level check (a unique multikey index on an array field has null-collision caveats) — the `artifacts.source_ref` index here is intentionally non-unique.
## Testing
17 new unit tests (serde/bson round-trip, enum display, artifact helpers, `DastAuthConfig` fold, and the `applicable_scans` truth table per target type). Verified against the exact CI commands:
- `cargo fmt --all --check` ✓
- `cargo clippy -p compliance-agent -- -D warnings` ✓
- `cargo clippy -p compliance-dashboard --features server --no-default-features -- -D warnings` ✓
- `cargo clippy -p compliance-dashboard --features web --no-default-features -- -D warnings` ✓
- `cargo clippy -p compliance-mcp -- -D warnings` ✓
- `cargo test -p compliance-core` ✓ (19 pass)
## Follow-ups (tracked)
Next: artifact ingest (#120) and the classifier impls + tramiton detector (#121), then the feature-flagged pipeline rewrite (#133) and migration (#132). Full breakdown in epic #118.
Refs #118, #119, #122, #121.
sharang
added this to the Onboarding v1 milestone 2026-07-10 10:24:23 +00:00
Invalid pointer dereference in the `fmt::Pointer` impl for `Atomic`/`Shared`
when the underlying pointer is invalid. Lockfile-only bump; no code changes.
Refs #118.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sharang
merged commit 675c4ef699 into main2026-07-10 13:41:26 +00:00
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.
What
Backend foundation for the artifact-aware onboarding redesign (epic #118). Replaces the git-only
TrackedRepository/DastTargetsplit with a singleOnboardedTargetthat is classified by what kind of software it is and carries the concrete artifacts provided for it.This is steps 1–2 of the approved plan (full-unification, foundation-first). It is purely additive — no legacy scan path is touched, and the old models/collections stay in place. Nothing wires into the pipeline yet.
Changes
compliance-core
models/onboarding.rs(new) —OnboardedTargetwithTargetType(9 families: web, backend, desktop, Android, iOS, bare-metal firmware, RTOS firmware, Yocto, PLC/SPS) andArtifactKind(8 kinds: git, source archive, firmware image, mobile package, container image, live URL, PLC project, plaintext).Artifactcarries per-kind config +ArtifactAuth(foldsTrackedRepositorygit auth andDastAuthConfig). PlusClassification,TargetScanConfig(reuses the existingPentestConfig/ tracker config).scan_matrix.rs(new) — table-drivenapplicable_scans(target)/rules_for(type)/supports_pentest(type). The SAST umbrella + firmware/PLC/mobile/DAST scans are gated on which artifacts are actually present; a scan whose artifact is missing comes back with ablocked_reason.traits/classifier.rs(new) —TargetClassifierport, mirroring the existingScannertrait.models/scan.rs— additiveScanType/ScanPhasevariants (firmware-static, PLC control-logic, mobile-static, container).ScanTypenow derivesCopy.compliance-agent
database.rs—onboarded_targets()collection accessor + 3 indexes (artifacts.source_ref,artifacts.kind,target_type).pipeline/patterns.rs— drop a now-redundantScanTypeclone surfaced by theCopyderive.Design notes
OnboardedTarget._idis meant to occupy the same id-space as the legacyTrackedRepository/DastTarget_id, so downstream collections keyed byrepo_id/target_idkeep resolving with zero row rewrites. This PR only lays the model; the migration is a later step (#132).git_urlguarantee moves from a DB unique index to an app-level check (a unique multikey index on an array field has null-collision caveats) — theartifacts.source_refindex here is intentionally non-unique.Testing
17 new unit tests (serde/bson round-trip, enum display, artifact helpers,
DastAuthConfigfold, and theapplicable_scanstruth table per target type). Verified against the exact CI commands:cargo fmt --all --check✓cargo clippy -p compliance-agent -- -D warnings✓cargo clippy -p compliance-dashboard --features server --no-default-features -- -D warnings✓cargo clippy -p compliance-dashboard --features web --no-default-features -- -D warnings✓cargo clippy -p compliance-mcp -- -D warnings✓cargo test -p compliance-core✓ (19 pass)Follow-ups (tracked)
Next: artifact ingest (#120) and the classifier impls + tramiton detector (#121), then the feature-flagged pipeline rewrite (#133) and migration (#132). Full breakdown in epic #118.
Refs #118, #119, #122, #121.