Skip to content

Enable looking up RuleSets in parent rules - #248

Merged
puerco merged 1 commit into
slsa-framework:mainfrom
puerco:new-repo
Jul 29, 2025
Merged

Enable looking up RuleSets in parent rules#248
puerco merged 1 commit into
slsa-framework:mainfrom
puerco:new-repo

Conversation

@puerco

@puerco puerco commented Jul 29, 2025

Copy link
Copy Markdown
Member

This PR changes the API query to allow the client to look for the ContinuityControl controls in parent rules. Without this, querying a ruleset's rules return 404.

/cc @TomHennen

Signed-off-by: Adolfo García Veytia (Puerco) puerco@carabiner.dev

var oldestActive *github.RepositoryRuleset
for _, rule := range rules {
ruleset, _, err := ghc.Client().Repositories.GetRuleset(ctx, ghc.Owner(), ghc.Repo(), rule.RulesetID, false)
ruleset, _, err := ghc.Client().Repositories.GetRuleset(ctx, ghc.Owner(), ghc.Repo(), rule.RulesetID, true)

@puerco puerco Jul 29, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@TomHennen do you have any objections if we enable looking up the rules in parent rules? If this is not enabled, looking up rules defined at the org level returns 404. We can handle the 404 and ignore the rulesets but that means that the control cannot be fulfilled by org-level rules.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's do it.

@puerco

puerco commented Jul 29, 2025

Copy link
Copy Markdown
Member Author

To repro:

# 404s
curl 'https://api.github.com/repos/protobom/protobom/rulesets/969281?includes_parents=false'

# 200 OK
curl 'https://api.github.com/repos/protobom/protobom/rulesets/969281?includes_parents=true'

This PR changes the API query to allow the client to look for
the ContinuityControl controls in parent rules as well.

Signed-off-by: Adolfo García Veytia (Puerco) <puerco@carabiner.dev>
@puerco
puerco merged commit 3506901 into slsa-framework:main Jul 29, 2025
2 checks passed
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.

2 participants