Skip to content

Commit

Permalink
Supports wildcard GitHub Actions repo ACL
Browse files Browse the repository at this point in the history
  • Loading branch information
kiootic committed Jul 3, 2023
1 parent 0679e39 commit 69bbdc8
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions internal/models/credential_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ func (c CredentialID) Matches(r *config.ACLSubjectRule) bool {
case CredentialIDKindGitHubUser:
return r.GitHubUser != "" && r.GitHubUser == data
case CredentialIDGitHubRepositoryActions:
return r.GitHubRepositoryActions != "" && r.GitHubRepositoryActions == data
return r.GitHubRepositoryActions != "" &&
(r.GitHubRepositoryActions == data ||
r.GitHubRepositoryActions == "*")
case CredentialIDIP:
if r.IpRange == "" {
return false
Expand Down Expand Up @@ -85,10 +87,15 @@ func MakeCredentialIDIndexKeys(id CredentialID) []CredentialIndexKey {

switch CredentialIDKind(kind) {
case CredentialIDKindUserID,
CredentialIDKindGitHubUser,
CredentialIDGitHubRepositoryActions:
CredentialIDKindGitHubUser:
return []CredentialIndexKey{CredentialIndexKey(id)}

case CredentialIDGitHubRepositoryActions:
return []CredentialIndexKey{
CredentialIndexKey(id),
CredentialIndexKey(CredentialIDGitHubRepositoryActions + ":*"),
}

case CredentialIDIP:
addr, err := netip.ParseAddr(data)
if err != nil {
Expand Down

0 comments on commit 69bbdc8

Please sign in to comment.