Skip to content

Conversation

@karthiknew07
Copy link

Summary

This PR implements an importer for Alpine Linux APKBUILD files, addressing issue #509.

Changes

  • Added APKBUILDParser class to parse secfixes sections from APKBUILD files
  • Added AlpineImporter class for VulnerableCode integration
  • Added comprehensive test suite in test_alpine.py
  • Registered the importer in IMPORTERS_REGISTRY
  • Parses CVE IDs and fixed versions from APKBUILD comment sections

How It Works

The importer fetches APKBUILD files from Alpine Git repository and parses the secfixes format:

# secfixes:
#   20.11.1-r0:
#     - CVE-2024-53566
#   18.2.1-r0:
#     - CVE-2021-26712
#     - CVE-2021-26713

Testing

  • Successfully tested with asterisk package
  • Imported 28 CVEs spanning 2018-2024
  • All advisories correctly stored in database

Related Issue

Fixes #509

@karthiknew07 karthiknew07 force-pushed the feature/alpine-apkbuild-importer-509 branch from 8593c96 to 2792a13 Compare November 19, 2025 03:37
Signed-off-by: karthiknew07 <karthik2005207@gmail.com>
@karthiknew07 karthiknew07 force-pushed the feature/alpine-apkbuild-importer-509 branch from 2792a13 to 797a42a Compare November 19, 2025 03:39
@TG1999
Copy link
Contributor

TG1999 commented Nov 19, 2025

Hey @karthiknew07 thanks for the contribution, https://github.com/aboutcode-org/vulnerablecode/tree/main/vulnerabilities/pipelines/v2_importers We are using these type of importer pipelines now. Can you adjust/migrate your code accordingly. Also see:

If you need any help, let us know. Thanks!

@karthiknew07
Copy link
Author

Thank you for the feedback and guidance! I appreciate you pointing me to the v2 pipeline format and issue #1944.

I'm currently working on migrating the Alpine importer to the new pipeline structure. I'll be:

  1. ✅ Creating AlpineLinuxImporterPipeline in vulnerabilities/pipelines/v2_importers/
  2. ✅ Using the new data structures: AffectedPackageV2, ReferenceV2, VulnerabilitySeverity
  3. ✅ Following the pattern from archlinux_importer.py and curl_importer.py
  4. ✅ Removing the old v1 importer code
  5. ✅ Updating the pipeline registry accordingly

I'll have an updated PR ready shortly. If I run into any issues during the migration, I'll reach out.

Thanks again for your guidance!

@karthiknew07
Copy link
Author

karthiknew07 commented Nov 21, 2025

✅ Migration to v2 pipeline complete!

The importer has been successfully migrated to the new pipeline format:

Changes:

  • Created AlpineLinuxImporterPipeline in v2 format
  • Uses AdvisoryV2 model and new data structures
  • Implements AffectedPackageV2 and ReferenceV2
  • Follows VCIO-next improvements

Verification:

  • ✅ 28 CVEs successfully imported
  • ✅ All data stored in AdvisoryV2 model
  • ✅ Follows archlinux_importer.py pattern
  • ✅ Old v1 code removed

Ready for review! @TG1999

Signed-off-by: karthiknew07 <karthik2005207@gmail.com>
@karthiknew07 karthiknew07 force-pushed the feature/alpine-apkbuild-importer-509 branch from 8d603c0 to ec0ba42 Compare November 21, 2025 08:35
self.log("Fetching Alpine Linux APKBUILD files")

# For now, process known packages
# In production, this would discover all packages
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this vibe coded by any chance ?

Copy link
Author

Choose a reason for hiding this comment

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

Hey @TG1999 — no, this wasn’t “vibe coded.”

I intentionally kept this importer minimal to get a working v2 pipeline and tests in place first. The current packages_data list is a deliberate placeholder so we can validate parsing and the new models . (it successfully imported ~28 CVEs for a test package).

# In production, this would discover all packages
self.packages_data = []

# Example package - can be expanded to fetch multiple packages
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this a scalable approach?

Copy link
Author

Choose a reason for hiding this comment

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

I agree it’s not scalable as-is.

My next steps are to add package discovery, incremental processing, batching, and improved error handling/logging so it can run across the full Alpine repo. If you have a preferred approach , I’d love your input before I build out the full discovery flow.

Thanks for the review!

Copy link
Author

Choose a reason for hiding this comment

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

@TG1999 , can you suggest some plan for it !

Copy link
Contributor

Choose a reason for hiding this comment

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

I would need to do some research for that, for now you can propose your full discovery flow. And if it looks good you can ahead and code that. Thanks!

Signed-off-by: karthiknew07 <karthik2005207@gmail.com>
@karthiknew07 karthiknew07 force-pushed the feature/alpine-apkbuild-importer-509 branch from b1ee85d to a7df25f Compare November 22, 2025 07:06
@karthiknew07 karthiknew07 requested a review from TG1999 November 22, 2025 15:29
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.

Collect Alpine vulnerability data from APKBUILD comments

2 participants