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

Add Security section to enhancement template #1621

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

JoelSpeed
Copy link
Contributor

This came up in conversation a while back, enhancements do not currently encourage you to think about the security aspects of a feature.

In particular this came up in the context of a feature that deployed a DaemonSet and granted it fairly wide permissions to update Node objects. There had been no discussion within the enhancement doc about limiting the scope of permissions to only the Node on which the daemonset resides.

We should add a new section to the enhancement template to prompt folks to discuss what are the implications of changes, and hopefully document scenarios like above in the future.

CC @derekwaynecarr

@openshift-ci openshift-ci bot requested review from LorbusChris and Miciah May 2, 2024 16:44
Copy link
Contributor

openshift-ci bot commented May 2, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from joelspeed. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@JoelSpeed
Copy link
Contributor Author

Anything more we want to do on this update or shall we get this merged?

@openshift-bot
Copy link

Inactive enhancement proposals go stale after 28d of inactivity.

See https://github.com/openshift/enhancements#life-cycle for details.

Mark the proposal as fresh by commenting /remove-lifecycle stale.
Stale proposals rot after an additional 7d of inactivity and eventually close.
Exclude this proposal from closing by commenting /lifecycle frozen.

If this proposal is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 21, 2024
@JoelSpeed
Copy link
Contributor Author

/remove-lifecycle stale

Anyone any objection to merging this? Can I get some labels please?

@openshift-ci openshift-ci bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 21, 2024
@openshift-bot
Copy link

Inactive enhancement proposals go stale after 28d of inactivity.

See https://github.com/openshift/enhancements#life-cycle for details.

Mark the proposal as fresh by commenting /remove-lifecycle stale.
Stale proposals rot after an additional 7d of inactivity and eventually close.
Exclude this proposal from closing by commenting /lifecycle frozen.

If this proposal is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 20, 2024
@JoelSpeed
Copy link
Contributor Author

/remove-lifecycle stale

@openshift-ci openshift-ci bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 20, 2024
Copy link
Contributor

@deads2k deads2k left a comment

Choose a reason for hiding this comment

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

good idea. How about enforcing the bits that are easy to enforce.

- Which service accounts will be affected by the change, what permissions will the feature code need?
- Will end users need to make any security considerations when enabling this feature?
- What is the scope of the required RBAC?
- Are cluster wider permissions required?
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is a thing we want to control or know, we should add an e2e test/registry similar to the certificate ownerships that requires a high level ACK. The list can determine if the source CVO, any serviceaccount from a namespace created by CVO or created by a serviceaccount in a namespace created by the CVO (etc).

Asking without enforcement is hollow and this one is easy.

Copy link
Contributor Author

@JoelSpeed JoelSpeed Aug 9, 2024

Choose a reason for hiding this comment

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

Neat idea, I wonder how many would fail this test right now.

Off the top of my head, and in my own areas, I know both CCMs and the operator would, the CAPI operator would. I suspect many have reasons to, but I can look into this

- Will end users need to make any security considerations when enabling this feature?
- What is the scope of the required RBAC?
- Are cluster wider permissions required?
- Should RBAC be limited to only the namespace(s) where the feature is enabled?
Copy link
Contributor

Choose a reason for hiding this comment

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

why ask a question you only want a "yes" to. Why not instead ask if this one is an exception?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reworded

- What is the scope of the required RBAC?
- Are cluster wider permissions required?
- Should RBAC be limited to only the namespace(s) where the feature is enabled?
- Should RBAC be limited to just the node(s) where the feature is enabled?
Copy link
Contributor

Choose a reason for hiding this comment

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

this isn't a capability that exists in kube.

Copy link
Contributor Author

@JoelSpeed JoelSpeed Aug 9, 2024

Choose a reason for hiding this comment

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

Perhaps this one needs rewording, but the sentiment here was about nodes writing to other nodes. I was thinking about things like the MCD and their new MCN construct. They are having to add new permissions to nodes (not Kubelet) to allow something on each node to update something within the cluster, that could be widely scoped. I want people to think about how to narrow that scope

- Are cluster wider permissions required?
- Should RBAC be limited to only the namespace(s) where the feature is enabled?
- Should RBAC be limited to just the node(s) where the feature is enabled?
- Are we adding new permissions or escalation paths from Nodes to the Cluster level?
Copy link
Contributor

Choose a reason for hiding this comment

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

being more specific about: can a token on node/A be used to read or write information about a different node would likely help the answers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added an extra "i.e."


Principles to consider:
- The permissions you grant should be well scoped and follow the principle of least privilege. Do not use wildcard permissions.
- If the feature operates at the host level, the host root user should not be able to escalate to the cluster level. The feature may only modify resources directly related to the node it operates on.
Copy link
Contributor

Choose a reason for hiding this comment

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

link to the example in kubernetes/kubernetes#124711


### Security Context

What security context will the new component run with? What is the impact of the security context on the security posture of the cluster?
Copy link
Contributor

Choose a reason for hiding this comment

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

We added an e2e test to ensure all components specify which SCC they want. Just an example of something similar to the RBAC bits.

Copy link
Contributor

openshift-ci bot commented Aug 9, 2024

@JoelSpeed: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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.

None yet

6 participants