Skip to content

Generate android artifact - #49293

Merged
ksykulev merged 3 commits into
35075-software-os-show-android-versions-and-vulnerabilitiesfrom
47335-artifact
Jul 15, 2026
Merged

Generate android artifact#49293
ksykulev merged 3 commits into
35075-software-os-show-android-versions-and-vulnerabilitiesfrom
47335-artifact

Conversation

@ksykulev

@ksykulev ksykulev commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Related issue: Resolves #47335

Checklist for submitter

  • Input data is properly validated, SELECT * is avoided, SQL injection is prevented (using placeholders for values in statements), JS inline code is prevented especially for url redirects, and untrusted data interpolated into shell scripts/commands is validated against shell metacharacters.
  • Timeouts are implemented and retries are limited to avoid infinite loops

Testing

  • Added/updated automated tests
  • QA'd all new/changed functionality manually

Summary by CodeRabbit

  • New Features
    • Added Android OSV processing support.
    • Generates compressed vulnerability artifacts for each Android major version.
    • Includes Android CVE identifiers, severity ratings, fixed security patch levels, and deterministic vulnerability listings.
    • Supports filtering output by Android version.
    • Consolidates duplicate advisories and retains the latest available security patch level.
  • Bug Fixes
    • Normalizes Android “next” version labels and excludes unsupported kernel- or SoC-specific entries.
    • Prevents unsupported delta-processing options in Android mode.

Copilot AI review requested due to automatic review settings July 14, 2026 19:43
@ksykulev
ksykulev requested a review from a team as a code owner July 14, 2026 19:43
@ksykulev
ksykulev changed the base branch from main to 35075-software-os-show-android-versions-and-vulnerabilities July 14, 2026 19:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Android support to Fleet’s cmd/osv-processor so it can generate gzipped OSV-derived vulnerability artifacts for Android, alongside existing Ubuntu and RHEL processing.

Changes:

  • Adds --platform android mode with default input dir /tmp/android-osv and an runAndroid processing pipeline.
  • Introduces Android-specific artifact schema/types and writes per-Android-version artifacts named osv-android-<ver>-<date>.json.gz.
  • Adds unit tests covering Android range parsing, CVE extraction, deduplication, filtering, and artifact generation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
cmd/osv-processor/main.go Adds Android platform mode, parsing/aggregation logic, and Android artifact writer/types.
cmd/osv-processor/main_test.go Adds tests for Android processing behavior and artifact output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/osv-processor/main.go
Comment thread cmd/osv-processor/main.go
Comment on lines +100 to +104
type AndroidVuln struct {
CVE string `json:"cve"`
FixedSPL string `json:"fixed_spl"` // YYYY-MM-DD date when the fix was included
Severity string `json:"severity,omitempty"`
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither concern exists in the data:

Zero non-zero introduced value. Every Android CVE is introduced: <ver>:0, meaning "affected from the beginning." There's no "introduced after SPL X" case.

Zero disjoint ranges within a single affected entry. Multi-version entries use separate events (introduced: 15:0, fixed: 15:2026-05-01, introduced: 16:0, fixed: 16:2026-05-01) which our parser already handles correctly by extracting each (major, fixed_spl) pair.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The OSV processor now supports an android platform. It models aliases and Android-specific severity, parses Android ecosystem ranges, extracts CVEs, groups vulnerabilities by Android major version, selects fixed SPL dates and severities, and writes sorted compressed artifacts. CLI defaults and dispatch support Android, while delta flags are rejected. Tests cover parsing, filtering, normalization, deduplication, SPL selection, artifact generation, and validation.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The Android osv-processor work is implemented, but the required fleetdm/vulnerabilities CI/publish step from #47335 is not shown. Add the fleetdm/vulnerabilities CI/cron that fetches Android OSV data, runs osv-processor --platform android, and publishes the gzipped artifact.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly names the main change: generating the Android artifact.
Description check ✅ Passed The description includes the related issue, checklist items, and testing details, and the remaining template items appear intentionally omitted.
Out of Scope Changes check ✅ Passed The changes stay focused on Android artifact generation and tests, with no obvious unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 47335-artifact

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
cmd/osv-processor/main.go (1)

943-962: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Minor: anonymous struct type repeated.

The {major, fixedSPL string} shape is declared twice (slice declaration and append literal). A small named type would remove the duplication.

♻️ Optional cleanup
+type androidFixedEvent struct {
+	major    string
+	fixedSPL string
+}
+
 ...
-				var fixedEvents []struct {
-					major    string
-					fixedSPL string
-				}
+				var fixedEvents []androidFixedEvent
 				for _, event := range r.Events {
 					...
-					fixedEvents = append(fixedEvents, struct {
-						major    string
-						fixedSPL string
-					}{major, spl})
+					fixedEvents = append(fixedEvents, androidFixedEvent{major, spl})
 				}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/osv-processor/main.go` around lines 943 - 962, Define a named type for
the fixed Android event entries near the fixedEvents declaration, then use it
for both the fixedEvents slice and the append literal in this loop. Preserve the
existing major and fixedSPL fields and behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmd/osv-processor/main.go`:
- Around line 840-845: The isAndroidVersion function currently accepts path
traversal and malformed prefixes by checking only the first character. Replace
that check with strict validation allowing only the documented Android version
forms (numeric major versions with an optional decimal component or trailing L),
and reject separators, traversal characters, and other suffixes before the value
reaches the output filename path.
- Around line 825-838: Update the Android severity fixture in
cmd/osv-processor/main_test.go:1567-1606 from “Medium” to the valid Android ASB
severity “Moderate”; no direct change is needed in androidSeverityRank in
cmd/osv-processor/main.go:825-838.

---

Nitpick comments:
In `@cmd/osv-processor/main.go`:
- Around line 943-962: Define a named type for the fixed Android event entries
near the fixedEvents declaration, then use it for both the fixedEvents slice and
the append literal in this loop. Preserve the existing major and fixedSPL fields
and behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f62052ca-1742-49ec-ac16-ce86f6822603

📥 Commits

Reviewing files that changed from the base of the PR and between d3092bb and 483dae8.

📒 Files selected for processing (2)
  • cmd/osv-processor/main.go
  • cmd/osv-processor/main_test.go

Comment thread cmd/osv-processor/main.go
Comment thread cmd/osv-processor/main.go
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 46 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.99%. Comparing base (883efbf) to head (97c3cf6).
⚠️ Report is 1 commits behind head on 35075-software-os-show-android-versions-and-vulnerabilities.

Files with missing lines Patch % Lines
cmd/osv-processor/main.go 75.00% 32 Missing and 14 partials ⚠️
Additional details and impacted files
@@                                       Coverage Diff                                       @@
##           35075-software-os-show-android-versions-and-vulnerabilities   #49293      +/-   ##
===============================================================================================
+ Coverage                                                        67.97%   67.99%   +0.02%     
===============================================================================================
  Files                                                             3801     3805       +4     
  Lines                                                           239965   240843     +878     
  Branches                                                         12693    12693              
===============================================================================================
+ Hits                                                            163123   163773     +650     
- Misses                                                           62058    62191     +133     
- Partials                                                         14784    14879      +95     
Flag Coverage Δ
backend 69.58% <75.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ksykulev

Copy link
Copy Markdown
Contributor Author

This what the output of running the artifact job looks like:

2026/07/14 14:38:06 Processing Android OSV files from /tmp/android-osv-sample/extracted
2026/07/14 14:38:06 Processed 500 files...
2026/07/14 14:38:06 Processed 1000 files...
2026/07/14 14:38:06 Processed 1500 files...
2026/07/14 14:38:06 Processed 2000 files...
2026/07/14 14:38:07 Processed 2500 files...
2026/07/14 14:38:07 Processed 3000 files...
2026/07/14 14:38:07 Processed 3403 files, skipped 0 files in 409ms
2026/07/14 14:38:07 Discovered 12 Android versions
2026/07/14 14:38:07 Total Android CVEs across all versions: 4358
2026/07/14 14:38:07 Android 11: 574 CVEs -> /tmp/android-osv-output4/osv-android-11-2026-07-14.json.gz
2026/07/14 14:38:07 Android 9: 202 CVEs -> /tmp/android-osv-output4/osv-android-9-2026-07-14.json.gz
2026/07/14 14:38:07 Android 8.0: 85 CVEs -> /tmp/android-osv-output4/osv-android-8.0-2026-07-14.json.gz
2026/07/14 14:38:07 Android 15: 351 CVEs -> /tmp/android-osv-output4/osv-android-15-2026-07-14.json.gz
2026/07/14 14:38:07 Android 17: 67 CVEs -> /tmp/android-osv-output4/osv-android-17-2026-07-14.json.gz
2026/07/14 14:38:07 Android 10: 382 CVEs -> /tmp/android-osv-output4/osv-android-10-2026-07-14.json.gz
2026/07/14 14:38:07 Android 8.1: 160 CVEs -> /tmp/android-osv-output4/osv-android-8.1-2026-07-14.json.gz
2026/07/14 14:38:07 Android 12: 601 CVEs -> /tmp/android-osv-output4/osv-android-12-2026-07-14.json.gz
2026/07/14 14:38:07 Android 12L: 501 CVEs -> /tmp/android-osv-output4/osv-android-12L-2026-07-14.json.gz
2026/07/14 14:38:07 Android 13: 760 CVEs -> /tmp/android-osv-output4/osv-android-13-2026-07-14.json.gz
2026/07/14 14:38:07 Android 14: 451 CVEs -> /tmp/android-osv-output4/osv-android-14-2026-07-14.json.gz
2026/07/14 14:38:07 Android 16: 224 CVEs -> /tmp/android-osv-output4/osv-android-16-2026-07-14.json.gz
2026/07/14 14:38:07 Android processing completed in 414ms

Comment thread cmd/osv-processor/main.go Outdated
filesProcessed := 0
filesSkipped := 0

err := filepath.Walk(cfg.InputDir, func(path string, info os.FileInfo, err error) error {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Since the only file metadata you are using here is info.IsDir() you could use filepath.WalkDir here instead and avoid issuing an extra sys call per file.

Comment thread cmd/osv-processor/main.go
}
log.Printf("Total Android CVEs across all versions: %d", totalCVEs)

for ver, cveMap := range collected {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to return early here and/or print a log line if collected is empty?

Comment thread cmd/osv-processor/main.go

for _, r := range affected.Ranges {
if r.Type != "ECOSYSTEM" {
continue

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are your thoughts about keeping a record of what was skipped because conditions like this?

...
skippedNonEcosystem++
continue
...
skippedNonFixed++
continue
....

log.Printf("Total: %d, Skipped entries — non-Android ecosystem: %d, non-fixed: %d, totalEntries, skippedNonEcosystem, skippedNonFixed)

LMKWYT

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call. I will change it to log a bit more to be safe.

2026/07/15 11:53:48 Processing Android OSV files from /tmp/android-osv-sample/extracted
2026/07/15 11:53:48 Processed 500 files...
2026/07/15 11:53:48 Processed 1000 files...
2026/07/15 11:53:48 Processed 1500 files...
2026/07/15 11:53:48 Processed 2000 files...
2026/07/15 11:53:48 Processed 2500 files...
2026/07/15 11:53:48 Processed 3000 files...
2026/07/15 11:53:48 Processed 3403 files, skipped 0 files in 512ms
2026/07/15 11:53:48 Affected entries: 7424 total, skipped — non-Android ecosystem: 0, non-ECOSYSTEM range: 0, non-version prefix: 1683
2026/07/15 11:53:48 Discovered 12 Android versions
2026/07/15 11:53:48 Total Android CVEs across all versions: 4358
2026/07/15 11:53:48 Android 15: 351 CVEs -> /tmp/android-osv-output5/osv-android-15-2026-07-15.json.gz
2026/07/15 11:53:48 Android 16: 224 CVEs -> /tmp/android-osv-output5/osv-android-16-2026-07-15.json.gz
2026/07/15 11:53:48 Android 17: 67 CVEs -> /tmp/android-osv-output5/osv-android-17-2026-07-15.json.gz
2026/07/15 11:53:48 Android 11: 574 CVEs -> /tmp/android-osv-output5/osv-android-11-2026-07-15.json.gz
2026/07/15 11:53:48 Android 8.1: 160 CVEs -> /tmp/android-osv-output5/osv-android-8.1-2026-07-15.json.gz
2026/07/15 11:53:48 Android 13: 760 CVEs -> /tmp/android-osv-output5/osv-android-13-2026-07-15.json.gz
2026/07/15 11:53:48 Android 14: 451 CVEs -> /tmp/android-osv-output5/osv-android-14-2026-07-15.json.gz
2026/07/15 11:53:48 Android 9: 202 CVEs -> /tmp/android-osv-output5/osv-android-9-2026-07-15.json.gz
2026/07/15 11:53:48 Android 10: 382 CVEs -> /tmp/android-osv-output5/osv-android-10-2026-07-15.json.gz
2026/07/15 11:53:48 Android 8.0: 85 CVEs -> /tmp/android-osv-output5/osv-android-8.0-2026-07-15.json.gz
2026/07/15 11:53:48 Android 12: 601 CVEs -> /tmp/android-osv-output5/osv-android-12-2026-07-15.json.gz
2026/07/15 11:53:48 Android 12L: 501 CVEs -> /tmp/android-osv-output5/osv-android-12L-2026-07-15.json.gz
2026/07/15 11:53:48 Android processing completed in 518ms

This is what the new output will look like,


return &artifact, nil
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple of gaps here in testing:

  1. Every test that hits the dedup branch uses identical severities, so the androidSeverityRank(...) > precedence is never exercised.
  2. Real Android entries carry GIT ranges beside ECOSYSTEM ones; no test feeds one.
  3. No test mixes in a different ecosystem. Give the non-Android entry a version-like fixed event and assert no phantom artifact is produced.
  4. --exclude-versions mode. Only inclusive --versions is tested; the exclusion branch is untested.

@juan-fdz-hawa juan-fdz-hawa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! None of the comments are blocking, just nits/improvements - I'll leave it to you if you want to implement them.

@ksykulev
ksykulev merged commit 02ac22a into 35075-software-os-show-android-versions-and-vulnerabilities Jul 15, 2026
35 checks passed
@ksykulev
ksykulev deleted the 47335-artifact branch July 15, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android vulnerabilities: build OSV Android feed artifact (osv-processor + CI)

3 participants