Safeguard
Security Guides•

What should I check before adding a new R package to a project?

A seven point intake check for an R package: source, license, authors, compiled code, update history, dependencies and a lockfile entry.

Safeguard Security Team
3 min read

Before adding an R package, check where it comes from, its license and authors, whether it has compiled code, how recently it was updated, and what it depends on. Then record the exact version in a lockfile and scan the result. The whole intake takes about ten minutes.

Why bother

One install.packages call can pull in dozens of packages. Each one runs code on your machine and in your analysis. Registry policy helps, but as covered in what CRAN checks, acceptance is not a security audit.

The seven checks

  1. Source. Is it from the main repository, a Bioconductor release, or a GitHub URL? A development version on a personal repository has had no registry gate at all. CRAN policy itself says packages should not anticipate or recommend development versions of other packages on other repositories.
  2. License. CRAN policy requires clear and unambiguous ownership. Read the License field and check it fits your use.
  3. Authors. Look at the Authors@R field. CRAN prefers it to list all authors and copyright holders, with ORCID identifiers where people have them. A named, traceable team is a better sign than an anonymous one.
  4. Compiled code. Packages with C, C++ or Fortran carry memory safety risk. CRAN policy bars compiled code that terminates the R process, but that is a behavior rule, not a vulnerability audit.
  5. Network behavior. Policy asks that packages using the Internet fail gracefully and that security provisions, like certificate checks, are not circumvented. Read the code for downloads at install or load time.
  6. Update history. When was the last release, and does the maintainer answer issues? Remember that CRAN may archive packages that stop passing checks.
  7. Dependencies. List what it pulls in. Fewer is better.

Record it

Add the package, then snapshot. The renv lockfile guide shows what gets recorded, and the renv documentation notes that the lockfile stores enough metadata to reinstall every package on a new machine. Commit the lockfile with the project files.

CheckWhere to look
License, authorsDESCRIPTION file
Compiled codesrc directory in the source
DependenciesImports and Depends fields
Update historyNEWS file and release dates

Try it yourself

Click through it at your own pace, or open it full screen. Look at the transitive dependencies, the ones step seven asks you to find.

Quick check

Is a package from GitHub riskier than one from CRAN?

It passes through no registry gate, so you carry the review yourself. That does not make it unsafe, only less checked.

Where do I record the version I approved?

In the project's lockfile, committed with the code. Add a short note in your lab wiki on why you trusted it.

Safeguard's SBOM and dependency scanning can inventory an R project, and a free scan is available.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.