-
Notifications
You must be signed in to change notification settings - Fork 386
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
AntreaNetworkPolicy should not be applied to Pods in other Namespaces #4116
Labels
kind/bug
Categorizes issue or PR as related to a bug.
priority/critical-urgent
Highest priority. Must be actively worked on as someone's top priority right now.
Milestone
Comments
tnqn
changed the title
AntreaNetworkPolicy should not not applied to Pods in other Namespaces
AntreaNetworkPolicy should not be applied to Pods in other Namespaces
Aug 15, 2022
tnqn
added
the
priority/critical-urgent
Highest priority. Must be actively worked on as someone's top priority right now.
label
Aug 15, 2022
tnqn
added a commit
to tnqn/antrea
that referenced
this issue
Aug 16, 2022
When AntreaNetworkPolicy uses Group as AppliedTo, the Group should not select Pods in other Namespaces, otherwise the policy would be applied to other Namespaces. This was prevented by using a validation when creating AppliedToGroup for Group, which ensures that the Group doesn't have a NamespaceSelector. However, the validation could be bypassed by several approaches, the most straightforward one is to use a parent Group as AppliedTo and make one of its child Groups use NamespaceSelector. It's hard to cover all cases if the validation is only in the phase of creating AppliedToGroup because of its dynamic nature. This patch implements a validation when syncing AppliedToGroup. The validation ensures that the AppliedToGroup cannot have any members in other Namespaces if it's derived from a namespaced Group, regardless of the way by which the members are selected. The error encountered when syncing AppliedToGroup will be reflected in the statuses of the NetworkPolicies that use this AppliedToGroup. This patch also unifies the behavior of ClusterNetworkPolicy and AntreaNetworkPolicy when a ClusterGroup/Group used as AppliedTo contains IPBlocks only: it would be treated like empty AppliedTo in both cases. Fixes antrea-io#4116 Signed-off-by: Quan Tian <qtian@vmware.com>
tnqn
added a commit
to tnqn/antrea
that referenced
this issue
Aug 16, 2022
When AntreaNetworkPolicy uses Group as AppliedTo, the Group should not select Pods in other Namespaces, otherwise the policy would be applied to other Namespaces. This was prevented by using a validation when creating AppliedToGroup for Group, which ensures that the Group doesn't have a NamespaceSelector. However, the validation could be bypassed by several approaches, the most straightforward one is to use a parent Group as AppliedTo and make one of its child Groups use NamespaceSelector. It's hard to cover all cases if the validation is only in the phase of creating AppliedToGroup because of its dynamic nature. This patch implements a validation when syncing AppliedToGroup. The validation ensures that the AppliedToGroup cannot have any members in other Namespaces if it's derived from a namespaced Group, regardless of the way by which the members are selected. The error encountered when syncing AppliedToGroup will be reflected in the statuses of the NetworkPolicies that use this AppliedToGroup. This patch also unifies the behavior of ClusterNetworkPolicy and AntreaNetworkPolicy when a ClusterGroup/Group used as AppliedTo contains IPBlocks only: it would be treated like empty AppliedTo in both cases. Fixes antrea-io#4116 Signed-off-by: Quan Tian <qtian@vmware.com>
tnqn
added a commit
to tnqn/antrea
that referenced
this issue
Aug 16, 2022
When AntreaNetworkPolicy uses Group as AppliedTo, the Group should not select Pods in other Namespaces, otherwise the policy would be applied to other Namespaces. This was prevented by using a validation when creating AppliedToGroup for Group, which ensures that the Group doesn't have a NamespaceSelector. However, the validation could be bypassed by several approaches, the most straightforward one is to use a parent Group as AppliedTo and make one of its child Groups use NamespaceSelector. It's hard to cover all cases if the validation is only in the phase of creating AppliedToGroup because of its dynamic nature. This patch implements a validation when syncing AppliedToGroup. The validation ensures that the AppliedToGroup cannot have any members in other Namespaces if it's derived from a namespaced Group, regardless of the way by which the members are selected. The error encountered when syncing AppliedToGroup will be reflected in the statuses of the NetworkPolicies that use this AppliedToGroup. This patch also unifies the behavior of ClusterNetworkPolicy and AntreaNetworkPolicy when a ClusterGroup/Group used as AppliedTo contains IPBlocks only: it would be treated like empty AppliedTo in both cases. Fixes antrea-io#4116 Signed-off-by: Quan Tian <qtian@vmware.com>
tnqn
added a commit
to tnqn/antrea
that referenced
this issue
Aug 17, 2022
When AntreaNetworkPolicy uses Group as AppliedTo, the Group should not select Pods in other Namespaces, otherwise the policy would be applied to other Namespaces. This was prevented by using a validation when creating AppliedToGroup for Group, which ensures that the Group doesn't have a NamespaceSelector. However, the validation could be bypassed by several approaches, the most straightforward one is to use a parent Group as AppliedTo and make one of its child Groups use NamespaceSelector. It's hard to cover all cases if the validation is only in the phase of creating AppliedToGroup because of its dynamic nature. This patch implements a validation when syncing AppliedToGroup. The validation ensures that the AppliedToGroup cannot have any members in other Namespaces if it's derived from a namespaced Group, regardless of the way by which the members are selected. The error encountered when syncing AppliedToGroup will be reflected in the statuses of the NetworkPolicies that use this AppliedToGroup. This patch also unifies the behavior of ClusterNetworkPolicy and AntreaNetworkPolicy when a ClusterGroup/Group used as AppliedTo contains IPBlocks only: it would be treated like empty AppliedTo in both cases. Fixes antrea-io#4116 Signed-off-by: Quan Tian <qtian@vmware.com>
tnqn
added a commit
that referenced
this issue
Aug 17, 2022
…#4119) When AntreaNetworkPolicy uses Group as AppliedTo, the Group should not select Pods in other Namespaces, otherwise the policy would be applied to other Namespaces. This was prevented by using a validation when creating AppliedToGroup for Group, which ensures that the Group doesn't have a NamespaceSelector. However, the validation could be bypassed by several approaches, the most straightforward one is to use a parent Group as AppliedTo and make one of its child Groups use NamespaceSelector. It's hard to cover all cases if the validation is only in the phase of creating AppliedToGroup because of its dynamic nature. This patch implements a validation when syncing AppliedToGroup. The validation ensures that the AppliedToGroup cannot have any members in other Namespaces if it's derived from a namespaced Group, regardless of the way by which the members are selected. The error encountered when syncing AppliedToGroup will be reflected in the statuses of the NetworkPolicies that use this AppliedToGroup. This patch also unifies the behavior of ClusterNetworkPolicy and AntreaNetworkPolicy when a ClusterGroup/Group used as AppliedTo contains IPBlocks only: it would be treated like empty AppliedTo in both cases. Fixes #4116 Signed-off-by: Quan Tian <qtian@vmware.com> Signed-off-by: Quan Tian <qtian@vmware.com>
heanlan
pushed a commit
to heanlan/antrea
that referenced
this issue
Mar 29, 2023
…antrea-io#4119) When AntreaNetworkPolicy uses Group as AppliedTo, the Group should not select Pods in other Namespaces, otherwise the policy would be applied to other Namespaces. This was prevented by using a validation when creating AppliedToGroup for Group, which ensures that the Group doesn't have a NamespaceSelector. However, the validation could be bypassed by several approaches, the most straightforward one is to use a parent Group as AppliedTo and make one of its child Groups use NamespaceSelector. It's hard to cover all cases if the validation is only in the phase of creating AppliedToGroup because of its dynamic nature. This patch implements a validation when syncing AppliedToGroup. The validation ensures that the AppliedToGroup cannot have any members in other Namespaces if it's derived from a namespaced Group, regardless of the way by which the members are selected. The error encountered when syncing AppliedToGroup will be reflected in the statuses of the NetworkPolicies that use this AppliedToGroup. This patch also unifies the behavior of ClusterNetworkPolicy and AntreaNetworkPolicy when a ClusterGroup/Group used as AppliedTo contains IPBlocks only: it would be treated like empty AppliedTo in both cases. Fixes antrea-io#4116 Signed-off-by: Quan Tian <qtian@vmware.com> Signed-off-by: Quan Tian <qtian@vmware.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
kind/bug
Categorizes issue or PR as related to a bug.
priority/critical-urgent
Highest priority. Must be actively worked on as someone's top priority right now.
Describe the bug
Group validation was only performed when creating AppliedToGroup for namespaced group, there were two ways that can bypass the validation and apply the AntreaNetworkPolicy to Pods in other Namespaces:
Expected
AntreaNetworkPolicy should never be applied to Pods in other Namespaces at any time point.
Versions:
cab72fc
The text was updated successfully, but these errors were encountered: