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

support querying platform specific API capabilities in RepoClient #4049

Open
spencerschrock opened this issue Apr 22, 2024 · 2 comments
Open
Labels
area/api kind/enhancement New feature or request

Comments

@spencerschrock
Copy link
Contributor

Is your feature request related to a problem? Please describe.
The RepoClient interface contains shared functionality between forges. However when a feature is forge specific, it becomes difficult to query it without polluting the RepoClient interface. This makes it difficult to support issues (such as #2465) which is a GitHub specific implementation to a portion of the Security-Policy check.

// RepoClient interface is used by Scorecard checks to access a repo.
type RepoClient interface {
InitRepo(repo Repo, commitSHA string, commitDepth int) error
URI() string
IsArchived() (bool, error)

Describe the solution you'd like
There should be a way of querying platform specific values.

Other examples of features we might want to be able to query (although can't yet):

  • hasVulnerabilityAlertsEnabled (GitHub link)
  • default token permissions (GitHub, not an API)
  • requiring approval for external contributor workflow runs (GitHub, not an API yet, link)

Describe alternatives you've considered
We could add something like ListSecurityPolicies, but that seems short sighted for this problem. There are other features we'd like to one day query, and we can't add a method for all of them.

We could also "inject" this private reporting as a file. So that we create a fake file which would be detected normally by the current Security-Policy check. This might work for this specific example, but would fail on other features.

@spencerschrock spencerschrock added kind/enhancement New feature or request area/api labels Apr 22, 2024
@spencerschrock
Copy link
Contributor Author

@raghavkaul This may be related to the Metadata() function we've discussed in the past, although it may be it's own thing.

@pnacht
Copy link
Contributor

pnacht commented Apr 22, 2024

Note: default token permissions can be queried via the REST API (maybe graphQL, too?):

However, they require elevated permissions: organization_administration:read and administration:read, respectively...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api kind/enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

2 participants