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

Add GitHub Actions type #243

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jhutchings1
Copy link
Contributor

This PR adds GitHub Actions as a distinct type. We use this in the GitHub Dependency graph because GitHub Actions are distinct in meaning from the GitHub repository package references, and sometimes get CVEs published on them.

@stevespringett stevespringett added the PURL type definition Non-core definitions that describe and standardize PURL types label Jul 19, 2023
@jhutchings1
Copy link
Contributor Author

@pombredanne @stevespringett Can you take a look at this? We're already using it in practice within GitHub, and I'd love to make sure that it's an accepted type definition.

PURL-TYPES.rst Outdated Show resolved Hide resolved

pkg:githubactions/package-url/purl-spec@244fd47e07d1004
pkg:githubactions/package-url/purl-spec@v1.2
pkg:githubactions/github/codeql-action/analyze@v2
Copy link
Member

Choose a reason for hiding this comment

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

What is the relationship between pkg:githubactions/github/codeql-action/analyze@v2 and the Marketplace where actions are found? For example, this action is not listed in the marketplace, but https://github.com/marketplace/actions/codeql-bundle is. I think this needs to be clarified as many people will associate the githubactions purl type with the actions that are in the Marketplace, but that's not true in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Marketplace listings are basically advertisements and disconnected from the actual software distribution. You can reference an action in any repository regardless of whether there is a Marketplace listing. The only requirement is that there's an action.yml file in the repository and that the version matches a SHA, branch, or release tag. You'll see some of the scenarios around how things get referenced here: https://docs.github.com/en/actions/learn-github-actions/finding-and-customizing-actions#adding-an-action-to-your-workflow

@@ -253,6 +253,23 @@ github
pkg:github/package-url/purl-spec@244fd47e07d1004
pkg:github/package-url/purl-spec@244fd47e07d1004#everybody/loves/dogs

githubactions
------
``githubactions`` for GitHub Actions:
Copy link
Member

Choose a reason for hiding this comment

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

What is the default repository_url? Does this apply to Actions? If not, why not? The purl spec does not differentiate between public Internet facing repositories and internal ones. If there's a default repository_url, even an internal one, it should be part of the purl type definition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I could add one of those if you think it's helpful. GitHub Actions are always in practice pulled from the current GitHub instance you're on. So if you're on github.com, it's that, and if you're on an enterprise server instance, it's that.


pkg:githubactions/package-url/purl-spec@244fd47e07d1004
pkg:githubactions/package-url/purl-spec@v1.2
pkg:githubactions/github/codeql-action/analyze@v2
Copy link

Choose a reason for hiding this comment

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

It appears like the name attribute could be a single word purl-spec or could have subpath codeql-action/analyze. This appear to be different from other schemes where subpath are after qualifiers separated by a hash.

pkg:githubactions/github/codeql-action@v2?repository_url=...#subpath=analyze

Choose a reason for hiding this comment

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

I think subpath has a special meaning for referring to files within a package, which is not the case here if the action is its own package which happens to be in the same repository as other packages. This seems consistent with Go where the namespace/name is treated as a single value which means something in Go instead of two separate values. (eg a lot of Go PURLs have the PURL name "v2" because of the way Go handles version epochs)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@matt-phylum has it. The subpath is about picking a non-default action in a repository in instances where multiple actions exist.

Copy link

Choose a reason for hiding this comment

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

This seems inconsistent with the description given above:

namespace is the user or organization
name is the repository name
subpath is used to point to the location of an action within a repository in the event there are multiple defined.

If the name component is strictly the repository name, then based on the components from the spec:

scheme:type/namespace/name@version?qualifiers#subpath

This example should be:

pkg:githubactions/github/codeql-action@v2#analyze

@emilwareus
Copy link

Hi! I'm trying to use this schema, how would you say this vulnerability would fit into the actions pURL? GHSA-hw6r-g8gj-2987

@jhutchings1
Copy link
Contributor Author

Hi! I'm trying to use this schema, how would you say this vulnerability would fit into the actions pURL? GHSA-hw6r-g8gj-2987

This schema is intended to refer to a GitHub Actions action, not a workflow, so in your case, I think the regular GitHub namespace is more appropriate.

@jhutchings1 jhutchings1 mentioned this pull request Apr 19, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PURL type definition Non-core definitions that describe and standardize PURL types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants