dcg

Package Managers

package_managers

Protects against dangerous package manager operations like publishing packages and removing critical system packages

  • 20blocking rules
  • 18safe patterns
  • 20High
~/.config/dcg/config.toml
[packs]
enabled = ["package_managers"]

Evaluated when a command contains npm, yarn, pnpm, pip, apt, yum, dnf, cargo, gem, brew.

Blocking rules

Each rule ID is package_managers:<name>. Use it in allowlists and [policy.rules].

  1. apt-remove

    High

    apt remove/purge removes packages. Verify no critical packages are affected.

  2. brew-uninstall

    High

    brew uninstall removes packages. Verify no dependent packages are affected.

  3. cargo-publish

    High

    cargo publish releases a crate to crates.io. Use --dry-run first.

  4. cargo-yank

    High

    cargo yank marks a version as unavailable. This can break dependent projects.

  5. gem-push

    High

    gem push releases a gem to rubygems.org. Verify before publishing.

  6. gem-yank

    High

    gem yank removes a published version from rubygems.org. This can break dependent projects.

  7. gradle-publish

    High

    gradle publish uploads artifacts. Use --dry-run first when possible.

  8. maven-deploy

    High

    mvn deploy publishes artifacts to a remote repository. Verify target repository.

  9. maven-release-perform

    High

    mvn release:perform publishes a release. Verify version and repository.

  10. npm-publish

    High

    npm publish releases a package publicly. Use --dry-run first.

  11. npm-unpublish

    High

    npm unpublish removes a published package. This can break dependent projects.

  12. nuget-delete

    High

    nuget delete removes or unlists a published package version. This can break dependent projects.

  13. pip-system

    High

    pip install to system directories requires careful review.

  14. pip-uninstall

    High

    pip uninstall removes installed packages. Verify dependencies before removing.

  15. pip-url

    High

    pip install from URL can install unvetted code. Verify the source first.

  16. pnpm-publish

    High

    pnpm publish releases a package publicly.

  17. poetry-publish

    High

    poetry publish releases a package. Use --dry-run first.

  18. poetry-remove

    High

    poetry remove uninstalls a dependency. Verify no critical packages are affected.

  19. yarn-publish

    High

    yarn publish releases a package publicly. Verify package.json first.

  20. yum-remove

    High

    yum/dnf remove removes packages. Verify no critical packages are affected.

Safe patterns

Checked first. A command that matches one is never blocked by this pack.

  • npm-install
  • yarn-add
  • pnpm-install
  • npm-list
  • yarn-list
  • npm-audit
  • yarn-audit
  • pip-list
  • poetry-show
  • poetry-env-list
  • cargo-safe
  • apt-list
  • apt-get-list
  • npm-dry-run
  • yarn-dry-run
  • pnpm-dry-run
  • cargo-dry-run
  • poetry-dry-run