Skip to content

Conversation

@Redent0r
Copy link
Contributor

Fixes #10087

This PR adds the ability for the policy to save and load data to a state kept in the regorus engine, and also validates one field (sandbox name) to show capabilities.

@katacontainersbot katacontainersbot added the size/huge Largest and most complex task (probably needs breaking into small pieces) label Oct 16, 2024
Copy link
Contributor

@burgerdev burgerdev left a comment

Choose a reason for hiding this comment

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

Thanks, this is great!

@fidencio
Copy link
Member

@Redent0r, please, rebase this PR atop of the current main.

I've done a reasonable amount of changes in the workflows in order to get measured rootfs working, and that will requires PRs to be rebased, sorry.

@Redent0r Redent0r force-pushed the saulparedes/add-policy-state branch 2 times, most recently from 4ec207d to fa4e605 Compare October 30, 2024 20:35
@Redent0r Redent0r force-pushed the saulparedes/add-policy-state branch 3 times, most recently from 31f99cd to 51e2678 Compare November 1, 2024 22:34
@Redent0r Redent0r marked this pull request as ready for review November 4, 2024 02:58
Copy link
Member

@fidencio fidencio left a comment

Choose a reason for hiding this comment

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

lgtm, thanks @Redent0r!

@fidencio
Copy link
Member

fidencio commented Nov 4, 2024

@Redent0r, I've approved and re-triggered the failing CI (which is NOT related to the changes you're proposing).

@3u13r
Copy link
Contributor

3u13r commented Nov 12, 2024

Since we can now use the state to model more complex request chains, can we add some unit tests so that the expected requests are allowed (technically already covered by the e2e tests) and no other requests on a certain state are allowed (not yet covered by e2e tests as far as I understand).

@Redent0r
Copy link
Contributor Author

Since we can now use the state to model more complex request chains, can we add some unit tests so that the expected requests are allowed (technically already covered by the e2e tests) and no other requests on a certain state are allowed (not yet covered by e2e tests as far as I understand).

Thanks! Created #10529 to tackle on a separate PR

Use regorous engine's add_data method to add state to the policy.
This data can later be accessed inside rego context through the data namespace.

Support state modifications (json-patches) that may be returned as a result from policy evaluation.

Also initialize a policy engine data slice "pstate" dedicated for storing state.

Fixes kata-containers#10087

Signed-off-by: Saul Paredes <[email protected]>
Make sure all container sandbox names match the sandbox name of the first container.

Signed-off-by: Saul Paredes <[email protected]>
@Redent0r Redent0r force-pushed the saulparedes/add-policy-state branch from 56020fc to c207312 Compare November 12, 2024 23:20
@katacontainersbot katacontainersbot added size/large Task of significant size and removed size/huge Largest and most complex task (probably needs breaking into small pieces) labels Nov 12, 2024
@Redent0r Redent0r requested a review from danmihai1 November 13, 2024 18:41
@danmihai1 danmihai1 merged commit d9977b3 into kata-containers:main Nov 13, 2024
282 of 364 checks passed
@Redent0r Redent0r deleted the saulparedes/add-policy-state branch November 13, 2024 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test size/large Task of significant size

Projects

None yet

Development

Successfully merging this pull request may close these issues.

genpolicy: Add state to policy

7 participants