feat(findings): app variants (phone/tablet app, flavors, app targets) on every finding #481

Merged
sharang merged 1 commits from feat/app-variants into main 2026-10-06 00:27:00 +00:00
Owner

iOS readiness, story 4: app variants (phone/tablet). Requested by the platform session for the mobile epic. Stage only.

The scope follows the platform session's decision:

  • a variant as a classification fact and a label on every finding;
  • findings are not merged across variants;
  • groups (#464) carry the variant per place.

Detection (pipeline/variants.rs, once per scan)

  • Eclipse/ADT: sibling apps, each with its own AndroidManifest.xml and project.properties (gt-mobile: Mobile App/Tablet App).
  • Gradle:
    • several application modules (com.android.application, also the version-catalog alias);
    • product flavors and build types that have their own source set (<module>/src/<flavor>/).
    • Groovy and Kotlin DSL: phone {, create("tablet") {, getByName("release") {.
    • src/main is shared and gets no variant label.
  • Xcode: several application targets of one project (PBXNativeTarget, productType … application) whose directory is named after the target (Xcode's default layout).
  • One module, flavor or target on its own is not a variant.
  • Unity bundle ids already exist as bundle_id facts (#480). Unity has no per-variant file split, so it gets no labels.

Where the variant appears

  • Classification: one app_variant fact per variant, with its source. The target page shows it under "Erkannte Merkmale".
  • Findings:
    • Finding.variant and Occurrence.variant are set by RunFindings from the innermost variant directory that holds the file.
    • Labelling runs before grouping, so the group description lists e.g. …/Main.java:1 (Tablet App), and again on save.
    • Rows stored earlier get their variant on the next scan.
    • A group spanning several variants has no variant of its own; each of its places has one.
  • Issues:
    • The title includes the variant: [low] mobsfscan (Tablet App): …. The title is what an existing issue is matched by, so without this the tablet finding would land in the phone app's issue.
    • The body gets a **Variant:** line.
  • API:
    • GET /api/v1/findings?variant=… matches a finding's own variant or any place in a group.
    • GET /api/v1/findings/variants?repo_id=… lists the variants.
  • Dashboard:
    • an "Alle Varianten" filter, shown only when variants exist;
    • the variant under the title in the findings list;
    • a "Variante: …" badge on the finding page.
  • Nightly: finding lines now end in [variant]. Without it, the same file name in two apps collapsed into one line. legacy-adt-unity now shows each manifest finding for Pump Phone and Pump Tablet.

Tests

  • Unit tests:
    • ADT, Gradle modules, Kotlin/Groovy flavors, Xcode targets, a single app;
    • labelling, including group places and shared code;
    • issue title and body.
  • Mongo integration test tests/finding_variants.rs:
    • the same flaw in both apps gives 2 findings with their variants;
    • an earlier row without a variant gets one;
    • a group lists each place's variant.
  • The existing group_findings, live_findings, resolve_findings and manual_findings integration tests are green.
  • fmt and clippy -D warnings: agent, core, mcp, and dashboard (server and wasm).
  • Unit test runs: agent lib 688, dashboard 82, core 85.
  • Nightly run locally (bless, then compare): green. The Python baselines' OSV drift was discarded.

To check on stage

  1. Rescan an ADT pair, e.g. fixtures/nightly/mobile/legacy-adt-unity as an archive.
  2. The target page lists app_variant=Pump Phone (adt) and app_variant=Pump Tablet (adt).
  3. Findings: each manifest finding appears twice, labelled "Pump Phone" and "Pump Tablet".
  4. The "Alle Varianten" filter narrows the list to one app.
  5. Tracker issues are separate, with the variant in the title.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

**iOS readiness, story 4: app variants (phone/tablet).** Requested by the platform session for the mobile epic. Stage only. The scope follows the platform session's decision: - a variant as a classification fact **and** a label on every finding; - findings are **not** merged across variants; - groups (#464) carry the variant per place. ## Detection (`pipeline/variants.rs`, once per scan) - **Eclipse/ADT:** sibling apps, each with its own `AndroidManifest.xml` and `project.properties` (gt-mobile: *Mobile App*/*Tablet App*). - **Gradle:** - several application modules (`com.android.application`, also the version-catalog alias); - product flavors and build types that have their own source set (`<module>/src/<flavor>/`). - Groovy and Kotlin DSL: `phone {`, `create("tablet") {`, `getByName("release") {`. - `src/main` is shared and gets no variant label. - **Xcode:** several application targets of one project (`PBXNativeTarget`, `productType … application`) whose directory is named after the target (Xcode's default layout). - One module, flavor or target on its own is not a variant. - Unity bundle ids already exist as `bundle_id` facts (#480). Unity has no per-variant file split, so it gets no labels. ## Where the variant appears - **Classification:** one `app_variant` fact per variant, with its source. The target page shows it under "Erkannte Merkmale". - **Findings:** - `Finding.variant` and `Occurrence.variant` are set by `RunFindings` from the innermost variant directory that holds the file. - Labelling runs **before** grouping, so the group description lists e.g. `…/Main.java:1 (Tablet App)`, and again on save. - Rows stored earlier get their variant on the next scan. - A group spanning several variants has no variant of its own; each of its places has one. - **Issues:** - The title includes the variant: `[low] mobsfscan (Tablet App): …`. The title is what an existing issue is matched by, so without this the tablet finding would land in the phone app's issue. - The body gets a `**Variant:**` line. - **API:** - `GET /api/v1/findings?variant=…` matches a finding's own variant or any place in a group. - `GET /api/v1/findings/variants?repo_id=…` lists the variants. - **Dashboard:** - an "Alle Varianten" filter, shown only when variants exist; - the variant under the title in the findings list; - a "Variante: …" badge on the finding page. - **Nightly:** finding lines now end in ` [variant]`. Without it, the same file name in two apps collapsed into one line. `legacy-adt-unity` now shows each manifest finding for *Pump Phone* and *Pump Tablet*. ## Tests - Unit tests: - ADT, Gradle modules, Kotlin/Groovy flavors, Xcode targets, a single app; - labelling, including group places and shared code; - issue title and body. - **Mongo integration test `tests/finding_variants.rs`:** - the same flaw in both apps gives 2 findings with their variants; - an earlier row without a variant gets one; - a group lists each place's variant. - The existing `group_findings`, `live_findings`, `resolve_findings` and `manual_findings` integration tests are green. - fmt and clippy `-D warnings`: agent, core, mcp, and dashboard (server and wasm). - Unit test runs: agent lib 688, dashboard 82, core 85. - Nightly run locally (bless, then compare): green. The Python baselines' OSV drift was discarded. ## To check on stage 1. Rescan an ADT pair, e.g. `fixtures/nightly/mobile/legacy-adt-unity` as an archive. 2. The target page lists `app_variant=Pump Phone (adt)` and `app_variant=Pump Tablet (adt)`. 3. Findings: each manifest finding appears twice, labelled "Pump Phone" and "Pump Tablet". 4. The "Alle Varianten" filter narrows the list to one app. 5. Tracker issues are separate, with the variant in the title. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang added 1 commit 2026-10-06 00:18:41 +00:00
feat(findings): app variants (phone/tablet app, flavors, app targets) on every finding
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 7m53s
916b9d469f
iOS readiness, story 4. A repository with a phone and a tablet app showed
the same flaw twice with nothing telling them apart.

- pipeline/variants.rs recognises the variants once per scan:
  Eclipse/ADT sibling apps, several Android application modules, product
  flavors and build types with their own source sets (src/<flavor>/;
  src/main is shared and labels nothing), several app targets of one
  Xcode project (sources in the directory named after the target). One
  module, flavor or target alone is no variant.
- Classification: one `app_variant` fact per variant, with its source
  (adt, gradle-module, gradle-flavor, xcode-target); the target page's
  "Erkannte Merkmale" lists them.
- Finding.variant and Occurrence.variant: RunFindings labels every finding
  by the innermost variant directory holding its file, before grouping
  (so a group's place list names each place's variant) and on save; rows
  stored before get theirs on the next scan. Findings are never merged
  across variants; a group spanning variants keeps none itself.
- Issues: the variant is in the title ("[low] mobsfscan (Tablet App): …"),
  which keeps the same flaw in two variants two issues, and a **Variant**
  line in the body.
- API: `variant` filter on /api/v1/findings (own or any grouped place),
  GET /api/v1/findings/variants for the filter's choices.
- Dashboard: "Alle Varianten" filter (only when there are variants), the
  variant under the title in the list and as a badge on the finding page.
- Nightly: finding lines carry " [variant]", so the same file in two
  apps no longer collapses into one line; legacy-adt-unity now shows
  each manifest finding for Pump Phone and Pump Tablet.
- Docs (findings guide); Mongo integration test tests/finding_variants.rs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang merged commit 2893a5813e into main 2026-10-06 00:27:00 +00:00
Sign in to join this conversation.