-
Notifications
You must be signed in to change notification settings - Fork 264
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
Skip setting security policy when it's empty #1099
Conversation
@SeanTAllen fyi |
Is this enough? When I was testing other changes, I got errors from |
136fe1e
to
008b8ea
Compare
yeah, this was enough for me. |
Odd. I was able to run without any annotation and no errors without that being needed. |
I've been thinking about how this could have been missed. There must have been a change during review that seemed inconsequential where I didn't end up retesting without the annotation later (definite oversight on my part). I suspect that on the guest side, it was filtering out setting the policy from the default before. @anmaxvl I personally think the "" check should go inside the SetSecurityPolicy as it would be possible to call it incorrectly in the future and cause an issue. We could also had a check for "that security policy doesnt look right" on the guest side and error out if an empty one. What's concerning to me is this code in uvm.go:
So, the Unmarshall... at some point we lost an error check but either way, from this, without an annotation we somehow ended up with security policy that wasn't nil. That's concerning. It shouldn't turn an empty string into a security policy. Before this change goes in @anmaxvl, we should fix the Unmarshal not checking the error return value and understand if it errors when no annotation was used. |
@anmaxvl I tested the |
thanks for looking into it more. It makes sense now, we initialize an empty security policy, ignore the unmarshal error and end up in this state. I'll add the check. |
008b8ea
to
8594ddb
Compare
Due to an error ignored when calling to json.Unmarshal the call to SetSecurityPolicy with an empty or invalid string policy results in a policy with no Containers and AllowAll set to false. No container can be run as a result. Fix the behavior by not sending modification request for SetSecurityPolicy when policy string is empty (which is the default) and checking the error result from json.Unmarshal call Signed-off-by: Maksim An <maksiman@microsoft.com>
8594ddb
to
84fcbce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Related work items: microsoft#930, microsoft#962, microsoft#1004, microsoft#1008, microsoft#1039, microsoft#1045, microsoft#1046, microsoft#1047, microsoft#1052, microsoft#1053, microsoft#1054, microsoft#1057, microsoft#1058, microsoft#1060, microsoft#1061, microsoft#1063, microsoft#1064, microsoft#1068, microsoft#1069, microsoft#1070, microsoft#1071, microsoft#1074, microsoft#1078, microsoft#1079, microsoft#1081, microsoft#1082, microsoft#1083, microsoft#1084, microsoft#1088, microsoft#1090, microsoft#1091, microsoft#1093, microsoft#1094, microsoft#1096, microsoft#1098, microsoft#1099, microsoft#1102, microsoft#1103, microsoft#1105, microsoft#1106, microsoft#1108, microsoft#1109, microsoft#1115, microsoft#1116, microsoft#1122, microsoft#1123, microsoft#1126
Skip setting security policy when it's empty
Due to an error ignored when calling to json.Unmarshal the call
to SetSecurityPolicy with an empty or invalid string policy results
in a policy with no Containers and AllowAll set to false. No
container can be run as a result.
Fix the behavior by not sending modification request for SetSecurityPolicy
when policy string is empty (which is the default) and checking the
error result from json.Unmarshal call
Signed-off-by: Maksim An maksiman@microsoft.com