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

Provide error message when allow_stdio_access creates and undecideable error #1662

Merged
merged 1 commit into from
Feb 15, 2023
Merged

Provide error message when allow_stdio_access creates and undecideable error #1662

merged 1 commit into from
Feb 15, 2023

Conversation

SeanTAllen
Copy link
Contributor

If two containers are indistinguishable at create_container or exec_external time except for their allow_stdio_access value, then we are unable to proceed as we don't know if access should be allowed or not.

Prior to this commit, no error message at all was displayed when this was hit making it almost impossible for someone not "in the know" to diagnose.

This first version gives a very simple error message that will be improved with more information in later commits.

Signed-off-by: Sean T. Allen seanallen@microsoft.com

…e error

If two containers are indistinguishable at create_container or exec_external
time except for their `allow_stdio_access` value, then we are unable to proceed
as we don't know if access should be allowed or not.

Prior to this commit, no error message at all was displayed when this was
hit making it almost impossible for someone not "in the know" to diagnose.

This first version gives a very simple error message that will be improved
with more information in later commits.

Signed-off-by: Sean T. Allen <seanallen@microsoft.com>
@SeanTAllen SeanTAllen requested a review from a team as a code owner February 14, 2023 16:42
Copy link
Contributor

@helsaawy helsaawy left a comment

Choose a reason for hiding this comment

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

Minor questions below

pkg/securitypolicy/framework.rego Show resolved Hide resolved
pkg/securitypolicy/regopolicy_test.go Show resolved Hide resolved
input.rule == "create_container"

not container_started
possible_containers := [container |
Copy link
Contributor

Choose a reason for hiding this comment

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

it seems like a lot of the logic here is also used in create_container. Can we define a function that will return the matching containers (minus stdio) and reuse it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes but this was intentional as when we make this a better error message (coming in the not so distant future) this might no longer share all the logic. So I intentionally decided to not do that now given additional changes coming soon.

If you want it refactored now knowing that it might be undone when this is addressed further in March, I can do it. If come the changes in March, these still are rather similar, I was going to do the refactor to remove duplication then.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it.

errors["external processes only distinguishable by allow_stdio_access"] {
input.rule == "exec_external"

possible_processes := [process |
Copy link
Contributor

Choose a reason for hiding this comment

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

same here.

@anmaxvl anmaxvl merged commit 730efda into microsoft:main Feb 15, 2023
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.

3 participants