Skip to content

Reports

Sam MG Harish edited this page Oct 15, 2026 · 2 revisions

Reports and data model

Files per scan

File Contents
meta.json Scan bookkeeping: status, timings, phase, progress, summary
result.json The analysis result the UI renders and every report is built from
scan.log The scan's log feed as the dashboard shows it (milestones, plus any line reporting a failure, warning or skip), one line each as <ISO timestamp><TAB><message>. Written in verbose runs only
checkpoint/ Resume state: progress.json plus one agent-<region>.json per region. Present only while the scan is running or paused; removed when it completes, fails or is cancelled
<apk-stem>_analysis-<timestamp>.json The engine's own export
Verbose artifacts The decompiled tree, the copied APK, per-call transcripts and <apk-stem>_llm_calls.jsonl; see Configuration

meta.json

{
  "id": "9f2c1a7b4d0e",
  "dir": "/Users/you/Documents/lu77U-MobileSec/lu77U-MobileSec-DIVA-20260813_101500",
  "kind": "static",
  "filename": "DIVA.apk",
  "status": "completed",
  "pause_reason": null,
  "resume_attempts": 0,
  "owner_pid": 41237,
  "boot_id": "…",
  "created_at": "2026-08-13T10:15:00+00:00",
  "started_at": "2026-08-13T10:15:01+00:00",
  "finished_at": "2026-08-13T10:22:47+00:00",
  "duration": 466.2,
  "progress": 100,
  "phase": "done",
  "error": null,
  "summary": {
    "primary_framework": "Java",
    "total_vulnerabilities": 19,
    "critical": 3, "high": 7, "medium": 6, "low": 3,
    "security_score": 2.5,
    "security_grade": "F",
    "weighted_finding_count": 206,
    "package_name": "jakhar.aseem.diva",
    "app_name": "Diva",
    "analysis_supported": true
  },
  "reports": {"json": true, "html": true, "pdf": true}
}

status is one of queued, running, paused, completed, failed, cancelled.

pause_reason is one of:

Value Set when Extra fields
user The Pause button none
interrupted The server died mid-scan and reconcile_orphans found a usable checkpoint, or the scan was still queued resumable: true. resume_attempts counts auto-resumes; after 2 the scan is left paused for the user
provider_quota The AI provider's account quota ran out on every key (llm_usage.unavailable starts with fatal_quota:). The partial result is saved and the working files are kept so the scan stays resumable resume_after: an ISO timestamp 5 hours ahead. Auto-resume retries once it has passed, checked every 5 minutes; quota_resume_attempts counts those retries, capped at 20
provider_unreachable The provider's host could not be reached when the scan stopped using it (llm_usage.unreachable is set: DNS failure, no network, connection refused). Kept resumable the same way resume_after 10 minutes ahead; retried and counted like a quota pause, sharing its cap

Both automatic paths need auto_resume on. owner_pid and boot_id record which server process owns the scan, from the moment it is queued, so a second server on the same machine does not reclaim scans a live one still owns.

On failure, error holds Scan failed (ref: 1a2b3c4d); the exception and traceback are in the server log under that reference.

result.json

{
  "metadata":            {"tool", "version", "timestamp", "target", "analysis_date"},
  "framework_detection": {"detected", "primary_framework", "confidence",
                          "confidence_level", "frameworks": [...]},
  "application_info":    {"package_name", "app_name", "version_name", "version_code",
                          "min_sdk", "target_sdk", "file_size", "file_size_mb",
                          "permissions", "activities", "services", "receivers", "providers"},
  "vulnerability_analysis": {"analyzed", "total_vulnerabilities",
                             "by_severity": {"critical": 3, "high": 7, ...},
                             "vulnerabilities": {"critical": [...], "high": [...], ...},
                             "refuted": [...], "refuted_count": 2},
  "analyzer_details":    {"framework", "analysis_time", "files_analyzed",
                          "decompilation_status", "agent_coverage", "llm_usage", "error"},
  "summary":             {"framework_detected", "vulnerability_scan_complete",
                          "total_vulnerabilities", "critical_count", "high_count",
                          "medium_count", "low_count", "refuted_count", "security_score",
                          "security_grade", "weighted_finding_count"},
  "analysis":            {"supported", "success", "files_analyzed", "analysis_time",
                          "framework", "decompilation_status", "unsupported_framework",
                          "error"},
  "dynamic_session":     {"device", "package", "install", "frida", "android_version",
                          "total_count", "verified_count", "refuted_count", "attempted",
                          "proof_review": {"reviewed", "rejected"}, "skipped_reason",
                          "environment": {"env_checks", "actions", "runtime_findings"}},
  "reports":             {"json": true, "html": true, "pdf": true}
}

vulnerability_analysis.by_severity holds counts; vulnerabilities holds the findings bucketed by the same keys.

analyzer_details.llm_usage is the provider's usage summary for the scan: call, retry and throttle counters, token and cache counts, wall clock, keys_total/keys_used, and unavailable, which names why the provider stopped answering (for example fatal_quota: ...); see AI providers.

refuted is a separate bucket for findings the mechanical gates refuted with no model call (gate_result.mechanically_refuted). They are kept and countable but stay out of the severity buckets.

reports records which formats a scan will serve. JSON and HTML are always true (rendered on demand); pdf follows the pdf_generation setting as it stood when the scan finished.

If the engine's JSON export fails, build_result back-fills framework_detection, application_info, vulnerability_analysis and summary from the in-memory detection result.

Partial results

A scan stopped mid-analysis (Stop, or a resume that never completed) still stores what it gathered:

{
  "metadata": {"partial": true, "generated_at": "..."},
  "summary": {"vulnerability_scan_complete": false, "total_vulnerabilities": 7,
              "security_score": null},
  "vulnerability_analysis": {"analyzed": true, "by_severity": {...}, "vulnerabilities": {...}},
  "analysis": {"success": false, "decompilation_status": "Stopped before completion"},
  "reports": {}
}

security_score is null on purpose: an incomplete scan has no meaningful score.

Coverage block

analyzer_details.agent_coverage says what the AI phase examined and why it stopped (the analysis alias block does not repeat it).

analysis.limitation / analyzer_details.limitation is set when part of the app could only be read in reduced form, and is empty otherwise. Today that is a Flutter release build Blutter could not disassemble, analysed from libapp.so's strings, the platform layer and the native libraries instead; the text names why and what was read (see Static analysis). Shape and stop_reason values are documented in Static analysis.

The HTML report turns these into notices at the top of the report:

Notice Trigger
Incomplete analysis complete: false. Names degraded_reason and how many of N regions were not fully examined, and states that scanner findings are still complete
Incomplete source scope.source_missing > 0. Classes with no file in the decompiled output. They stay in the call graph but nobody could read them
Reduced coverage limitation is set. Quotes it
The analysis did not run A supported framework whose analysis failed (decompilation_status: "Failed") or whose decompiler is not configured (Tool Not Configured). Shows the reason in place of the statistics, which would otherwise say nothing was found and print a score of 100

The on-demand renderer reads analyzer_details and the analysis alias merged, details first: the alias alone has no coverage block, and reading only it once kept every downloaded report from showing the incomplete-analysis notice.

A finding

{
  "title": "SQL injection in NotesProvider",
  "severity": "High",
  "cvss_vector": "AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N",
  "cvss_score": 8.4,
  "description": "...",
  "file": "sources/jakhar/aseem/diva/NotesProvider.java",
  "location": "",
  "line": 76, "line_start": 76, "line_end": 80,
  "impact": "...",
  "exploitation": "...",
  "recommendation": "...",
  "cwe": "CWE-89",
  "owasp_mobile": "M4: Insufficient Input/Output Validation",
  "code_snippet": "...the exact vulnerable lines...",
  "code_context": {
    "start_line": 72, "end_line": 84,
    "highlight_start": 76, "highlight_end": 80,
    "lines": ["...", "..."],
    "lines_html": ["<span class=...>", "..."]
  },
  "dynamic_verification": {"status": "verified", "evidence": "..."},
  "vuln_class": "CODE-01",
  "source": "static-analyzer",
  "surface": "storage",
  "gate_result": {
    "verdict": "PASS",
    "reasons": [], "warnings": [],
    "original_severity": "High", "final_severity": "High",
    "chain_eligible": false, "weak_class_rule": "",
    "mechanically_refuted": false, "severity_cap": "",
    "needs_recitation": false
  },
  "chain": null,
  "chained_into": ["chain-001"],
  "related_findings": [{"with": "...", "reason": "...", "pattern": "CHAIN-01",
                        "confirmed": true}]
}

In the HTML report a finding's CVSS pill shows the base score of the vector it was reported with. When validation lowered the severity below that score's band (a class ceiling, a development-host cap, a demotion to Informational) the pill reads "CVSS 9.1 as reported", so a Low badge beside a 9.1 does not read as a contradiction; the dashboard does not show CVSS.

code_context is filled from disk after analysis: 4 lines of real source either side of the cited span, plus per-line Pygments HTML so the UI and the HTML report colorize without running a highlighter. dynamic_verification is present only for findings phase 2 selected; its absence means "not applicable", not "unproven". Its status is verified or refuted with the device evidence, or not_verified with a reason; a verdict the proof review set aside is not_verified and keeps what it replaced in rejected_status and rejected_evidence (see Dynamic verification). dynamic_session.refuted_count counts device refutations; it is unrelated to the refuted_count in vulnerability_analysis, which counts findings the gates refuted.

Classification, provenance and grading fields:

Field Meaning
vuln_class Catalogue code from validation/taxonomy.py, prefixed by its MASVS group (PLATFORM-01, NETWORK-01, STORAGE-04, …), or a chain pattern id
source Which layer produced it: agent (a region agent or the file review), static-analyzer, semgrep, chain-builder
surface Which region's agent found it; empty for scanner and file-review findings
gate_result What validation concluded, including the severity the finding started at and severity_cap, the lowest ceiling any gate imposed (empty when none did); the judgment pass cannot raise a finding above it
chain Present only on a chain finding: components and ordered attacker steps
chained_into Chain ids this finding is a component of
related_findings Same-file groupings and unconfirmed chain-table pairings. Not a verdict

Internal fields the gates read but that do not survive into the report: confidence (the model's own, read by the confidence gate), agent_origin (including "file_review" for the review pass), region_key, region_files_read, region_searches, cited_file_read, source_unresolved, operand_provenance, webview_mitigations, vendor_sdk, pool_reference (where a Flutter finding was cited before it was moved to the code that loads the value).

These pass through three whitelists (ResponseParser.normalize_vulnerability, JSONExporter._build_vulnerability_data, web/serializers), each of which drops unlisted keys silently. A new finding field must be added to all three or it vanishes with no error.

Severity and scoring

Severity is derived, not taken at face value.

  1. The model is asked for a CVSS v3.1 base vector and told severity is computed from it.
  2. ResponseParser.normalize_vulnerability normalizes any severity word given, as a fallback.
  3. A vector with base metrics left out (models most often drop AC) is completed by cvss.complete_vector when it states an attack vector and at least one non-None impact: stated metrics are kept, missing exploitability metrics take their worst case (AC:L, PR:N, UI:N, S:U) and a missing C, I or A is N. The completed vector replaces the partial one.
  4. If cvss_vector parses, utils/cvss.py computes the base score using FIRST's formula, including the specified round-up function, and the band replaces the model's word. Both cvss_score and the derived severity are stored.
  5. A vector that still will not parse is dropped and the word-based severity stands.

The parser tolerates the optional CVSS:3.1/ prefix, out-of-order metrics, and appended temporal or environmental metrics, which are ignored since only the base score is computed.

Bands follow FIRST: 0.0 Informational, 0.1–3.9 Low, 4.0–6.9 Medium, 7.0–8.9 High, 9.0–10.0 Critical.

Security score

utils/scoring.py is the single formula, shared by the JSON exporter, the HTML builder and the web serializer. Three copies of this arithmetic used to exist and they disagreed (the HTML one weighted Critical at 25).

weighted = 20*critical + 10*high + 5*medium + 2*low        # info weighs 0
score    = round(100 * exp(-weighted / (40 / ln 2)), 1)    # ≈ exp(-weighted/57.7)

Exponential decay replaced the old linear 100 - weighted, which hit zero at roughly five Criticals, so a merely-bad app and a catastrophic one both reported 0.0. The decay approaches zero without reaching it, so more findings always score strictly worse. HALF_POINT = 40.0 anchors the middle: two Criticals plus a Medium, or four Highs, scores 50.

Three numbers are exported together:

Field Use
security_score 0–100 headline
security_grade A ≥ 90, B ≥ 75, C ≥ 60, D ≥ 40, else F
weighted_finding_count Uncapped weighted total. The number to compare two scans with, since the 0–100 score compresses at the low end

legacy_security_score() keeps the old linear formula for one release so a stored scan history can still be compared against its own past values.

Informational carries no weight. Validation demotes gate-failed findings to Informational rather than deleting them, so any penalty there would let a downgraded note keep dragging the score.

It is a blunt aggregate, not a risk model. A scan where analysis did not run scores 0.0; a scan stopped early scores null.

Report generation

All three formats come from the stored result.json at request time. Nothing is pre-rendered, so all three are always offered and the HTML always matches the current stored result.

Format Path
JSON The stored result, re-serialized
HTML render_report_html() feeds ComprehensiveHTMLBuilder
PDF The same HTML, converted by WeasyPrint or headless Edge. 400 when pdf_generation is off

report_renderer.py bridges the two shapes. The HTML builder was written against live DetectionResult objects, so the renderer wraps the stored JSON in shims (_DetectionResultShim, _BasicInfoShim, _FrameworkResultsShim) exposing the same attributes, and flattens the severity-bucketed findings back into one list. One builder produces both the scan-time and the on-demand report.

The HTML report contains: header with counts, score and grade; coverage and scope notices where relevant; an unsupported-framework notice where relevant; statistics; a findings index grouped by title; per-finding detail with the highlighted code table, gate result, chain callout and related-findings list; CWE links; dynamic verification badges; app info; components; framework confidence; analysis details.

PDF backends

Host Backend Failure mode
macOS, Linux WeasyPrint Missing Pango and friends; /report/pdf returns 500 and the log names the import error
Windows Headless Microsoft Edge msedge.exe not found under Program Files or on PATH

WeasyPrint's native dependencies are awkward on Windows; Edge ships with the OS. JSON and HTML never touch either backend.

Clone this wiki locally