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

Old bundles not properly cleaned up during activation #4940

Closed
ashutosh-narkar opened this issue Jul 27, 2022 · 0 comments · Fixed by #4944
Closed

Old bundles not properly cleaned up during activation #4940

ashutosh-narkar opened this issue Jul 27, 2022 · 0 comments · Fixed by #4944
Assignees
Labels

Comments

@ashutosh-narkar
Copy link
Member

When OPA downloads a bundle which owns everything (ie. no manifest roots defined) and a bundle is already activated, OPA should delete all the existing data in the store and then write the new data to the store. If the existing bundle also has no manifest roots defined, the cleanup is not happening as expected. For example, if OPA has the following bundle loaded:

Bundle name: foo
Bundle roots: [""]
Bundle revision: rev-1
Bundle data: {"a": "b"}

Now if OPA downloads a new bundle as follows:

Bundle name: foo
Bundle roots: [""]
Bundle revision: rev-2
Bundle data: {"x": "y"}

The expected data in the store should be {"x": "y"} but currently the store has {"x": "y", "a": "b"}.

@ashutosh-narkar ashutosh-narkar self-assigned this Jul 27, 2022
ashutosh-narkar added a commit to ashutosh-narkar/opa that referenced this issue Jul 28, 2022
If OPA has an activated bundle that owns all roots
and a new bundle with empty roots is to be activated, the
old bundle's data should first be erased from the store.
Currently both the old and new data is kept in the store.

This commit attempts to fix this by providing an indication to
the truncate call about the scenario in which the root is to be
overwritten.

Fixes: open-policy-agent#4940

Signed-off-by: Ashutosh Narkar <[email protected]>
srenatus pushed a commit that referenced this issue Jul 29, 2022
If OPA has an activated bundle that owns all roots
and a new bundle with empty roots is to be activated, the
old bundle's data should first be erased from the store.
Currently both the old and new data is kept in the store.

This commit attempts to fix this by providing an indication to
the truncate call about the scenario in which the root is to be
overwritten.

Fixes: #4940

Signed-off-by: Ashutosh Narkar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant