Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#8972·trivy

feat(r): add R language support

Author: knqyf263Created Jun 3, 2025Updated Sep 28, 2026
Labelskind/feature

Description

This issue proposes adding support for the R programming language to Trivy so that users can scan R projects for known vulnerabilities.

Background

R is a pillar of data–science, statistics, and bioinformatics workflows, yet at present, Trivy cannot inspect R project dependencies. The R community already curates a vulnerability feed in the form of the R Advisory Database, which exposes advisories in the OSV Schema format. Leveraging that feed inside Trivy would immediately unlock vulnerability visibility for thousands of R practitioners.

Proposed Implementation

1. Target files for package detection
The analyser should inspect project artefacts in the following priority order.

  1. renv.lock – JSON lock-file that lists the complete dependency graph with exact versions. The formal structure is documented in the renv Lockfile Spec.
  2. DESCRIPTION – mandatory manifest that enumerates direct dependencies in the Imports, Depends, LinkingTo, and Suggests fields. A full reference is given in the DESCRIPTION File Specification.
  3. packrat.lock – legacy lock-file produced by Packrat. Still encountered in older code bases, hence worth supporting as an optional format.

2. R versioning system
R employs its own scheme, which differs from Semantic Versioning. Legal strings include major.minor.patch, major.minor-patch, and even four-component numbers such as 2024.06.01. Because no off-the-shelf Go library can compare such versions correctly, Trivy must embed a tailor-made comparator that (https://r-pkgs.org/lifecycle.html?utm_source=chatgpt.com#sec-lifecycle-version-number)

• accepts both dot and hyphen separators,
• handles four or more numeric components, and
• replicates the left-to-right numeric comparison performed by R itself.

3. Security-advisory integration
The R Advisory Database already publishes OSV-compliant YAML documents for both CRAN and Bioconductor packages. These files can be imported directly into trivy-db, bypassing vuln-list, exactly as Trivy does today for other OSV feeds.

4. Phased implementation plan
– Phase 1: Core
• Implement the custom R version comparator.
• Build a renv.lock parser using the renv Documentation.
• Wire the R Advisory Database into trivy-db.
– Phase 2: DESCRIPTION support
• Parse dependency fields and version constraints as defined in the Package-Dependencies section of the R manuals.
• Distinguish direct from transitive dependencies when both renv.lock and DESCRIPTION are present.
– Phase 3: Integration & testing
• Add a new language analyser under pkg/fanal/analyzer/language/r/.
• Provide a dependency parser in pkg/dependency/parser/r/.
• Implement a library detector in pkg/detector/library/r/.
• Add a new R type into pkg/purl package. • Import OSV data into trivy-db via a dedicated pipeline.
• Develop unit tests and golden integration tests that cover all three file formats.

Source: aquasecurity/trivy

View original on GitHubView discussion on GitHub