Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(secret): Add built-in secrets rules for Private Packagist #7826

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nicwortel
Copy link

@nicwortel nicwortel commented Oct 30, 2024

Description

Private Packagist is a package repository for Composer, the dependency manager for PHP. It allows businesses to publish private packages for consumption within their organization, mirror open-source packages, receive vulnerability alerts, etc.

Private Packagist generates user and organization tokens for authentication.

All tokens are generated with a prefix and a checksum to help with automated secret scanning.
See https://packagist.com/docs/composer-authentication#token-format.

This pull requests adds built-in rules for the tokens generated by Private Packagist so Trivy can detect them.

Related issues

None.

If you think your change is trivial enough, you can skip the issue and instead add justification and explanation in the PR description.

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

Private Packagist (Packagist.com) is a package repository for Composer,
the dependency manager for PHP.
Private Packagist generates user and organization tokens for
authentication.

All tokens are generated with a prefix and a checksum to help with
automated secret scanning.
See https://packagist.com/docs/composer-authentication#token-format.
Category: CategoryPrivatePackagist,
Title: "Private Packagist user token",
Severity: "HIGH",
// https://packagist.com/docs/composer-authentication#token-format
Copy link
Author

Choose a reason for hiding this comment

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

I don't see any other comments referring to the documentation of the token format, but I thought it would be useful.
Let me know if I should remove it.

@nicwortel
Copy link
Author

The Private Packagist token actually contains a checksum which can be calculated based on the prefix and random string, but as far as I'm aware Trivy doesn't support this, so I haven't implemented such a check.

ID: "private-packagist-user-token",
Category: CategoryPrivatePackagist,
Title: "Private Packagist user token",
Severity: "HIGH",
Copy link
Author

Choose a reason for hiding this comment

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

I couldn't find any documentation on how to choose a severity level for secrets.
How should I determine the level?

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.

1 participant