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

OCPBUGS-33041: Add RoleBinding for BuildConfig Webhooks #28750

Merged

Conversation

adambkaplan
Copy link
Contributor

Starting in OCP 4.16, the system:webhook ClusterRole will not be granted to anonymous users by default. This will break most systems that use BuildConfig webhooks to trigger builds, since many can't be add an OpenShift auth token to their HTTP headers (ex: GitHub). Only new installations will be impacted; upgrades to 4.16 will continue to support unauthenticated BuildConfig webhooks.

This test update verifies that BuildConfig webhooks can be triggered using a namespace-scoped RoleBinding for the system:unauthenticated group. RoleBindings are preferable to ClusterRoleBindings as they limit unauthenticated API calls to specific namespaces, reducing the potential attack surface.

Use of BuildConfig webhooks should be discouraged in favor of Pipelines as Code, which has more robust mechanisms for securing webhook calls from external systems. It also does not rely on an aggregated apiserver and associated RBAC.

@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. labels Apr 26, 2024
@openshift-ci-robot
Copy link

@adambkaplan: This pull request references Jira Issue OCPBUGS-33041, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.16.0) matches configured target version for branch (4.16.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @dpuniaredhat

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

Starting in OCP 4.16, the system:webhook ClusterRole will not be granted to anonymous users by default. This will break most systems that use BuildConfig webhooks to trigger builds, since many can't be add an OpenShift auth token to their HTTP headers (ex: GitHub). Only new installations will be impacted; upgrades to 4.16 will continue to support unauthenticated BuildConfig webhooks.

This test update verifies that BuildConfig webhooks can be triggered using a namespace-scoped RoleBinding for the system:unauthenticated group. RoleBindings are preferable to ClusterRoleBindings as they limit unauthenticated API calls to specific namespaces, reducing the potential attack surface.

Use of BuildConfig webhooks should be discouraged in favor of Pipelines as Code, which has more robust mechanisms for securing webhook calls from external systems. It also does not rely on an aggregated apiserver and associated RBAC.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Apr 26, 2024
@adambkaplan
Copy link
Contributor Author

/assign @ibihim

/cc @sanchezl

@openshift-trt-bot
Copy link

Job Failure Risk Analysis for sha: 4c03c56

Job Name Failure Risk
pull-ci-openshift-origin-master-e2e-aws-ovn-single-node High
[sig-builds][Feature:Builds][webhook] TestWebhook [apigroup:build.openshift.io][apigroup:image.openshift.io] [Suite:openshift/conformance/parallel]
This test has passed 100.00% of 48 runs on jobs ['periodic-ci-openshift-release-master-nightly-4.16-e2e-aws-ovn-single-node'] in the last 14 days.
---
[sig-network] can collect pod-to-host poller pod logs
This test has passed 100.00% of 48 runs on jobs ['periodic-ci-openshift-release-master-nightly-4.16-e2e-aws-ovn-single-node'] in the last 14 days.
---
[sig-network] can collect host-to-host poller pod logs
This test has passed 100.00% of 48 runs on jobs ['periodic-ci-openshift-release-master-nightly-4.16-e2e-aws-ovn-single-node'] in the last 14 days.

@openshift-trt-bot
Copy link

Job Failure Risk Analysis for sha: cc972cf

Job Name Failure Risk
pull-ci-openshift-origin-master-e2e-metal-ipi-ovn-ipv6 High
[sig-builds][Feature:Builds][webhook] TestWebhook [apigroup:build.openshift.io][apigroup:image.openshift.io] [Suite:openshift/conformance/parallel]
This test has passed 100.00% of 22 runs on jobs ['periodic-ci-openshift-release-master-nightly-4.16-e2e-metal-ipi-ovn-ipv6'] in the last 14 days.
pull-ci-openshift-origin-master-e2e-aws-ovn-single-node-serial Low
[sig-arch] events should not repeat pathologically for ns/openshift-etcd-operator
This test has passed 50.00% of 50 runs on jobs ['periodic-ci-openshift-release-master-nightly-4.16-e2e-aws-ovn-single-node-serial'] in the last 14 days.

@adambkaplan
Copy link
Contributor Author

/assign @sayan-biswas

/cc @apoorvajagtap

@sanchezl
Copy link
Contributor

/retest-required

@adambkaplan
Copy link
Contributor Author

/test e2e-gcp-ovn-builds

Builds had a bad PAT token for private git repo testing. 🤞 it's fixed now.

@adambkaplan
Copy link
Contributor Author

/retest

@adambkaplan
Copy link
Contributor Author

/test e2e-gcp-ovn-builds

1 similar comment
@sanchezl
Copy link
Contributor

/test e2e-gcp-ovn-builds

@openshift-trt-bot
Copy link

Job Failure Risk Analysis for sha: 8507f77

Job Name Failure Risk
pull-ci-openshift-origin-master-e2e-aws-ovn-single-node-upgrade IncompleteTests
Tests for this run (25) are below the historical average (2292): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)

@openshift-trt-bot
Copy link

Job Failure Risk Analysis for sha: 0ae4678

Job Name Failure Risk
pull-ci-openshift-origin-master-e2e-aws-ovn-single-node-upgrade IncompleteTests
Tests for this run (20) are below the historical average (2246): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)

Copy link
Contributor

@sanchezl sanchezl left a comment

Choose a reason for hiding this comment

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

/lgtm

kind: RoleBinding
metadata:
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
Copy link
Contributor

Choose a reason for hiding this comment

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

consider removing, this is the default

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 30, 2024
@sjenning
Copy link
Contributor

sjenning commented May 1, 2024

/approve

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 4, 2024
@sanchezl
Copy link
Contributor

sanchezl commented May 4, 2024

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 4, 2024
@sanchezl
Copy link
Contributor

sanchezl commented May 4, 2024

/retest-required

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD ab28660 and 2 for PR HEAD ef7e238 in total

@sayan-biswas
Copy link

/retest-required

@openshift-trt-bot
Copy link

Job Failure Risk Analysis for sha: ef7e238

Job Name Failure Risk
pull-ci-openshift-origin-master-e2e-metal-ipi-ovn-ipv6 High
[sig-builds][Feature:Builds][webhook] TestWebhook [apigroup:build.openshift.io][apigroup:image.openshift.io] [Suite:openshift/conformance/parallel]
This test has passed 100.00% of 31 runs on jobs ['periodic-ci-openshift-release-master-nightly-4.16-e2e-metal-ipi-ovn-ipv6'] in the last 14 days.

Comment on lines 118 to 127
client: &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
},
},
Copy link
Member

Choose a reason for hiding this comment

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

The transport needs Proxy: http.ProxyFromEnvironment. Some of our CI jobs (like metal) access the cluster through a proxy. If no proxy environment variables are set, this is a no-op.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed!

Starting in OCP 4.16, the `system:webhook` ClusterRole will not be
granted to anonymous users by default. This will break most systems
that use BuildConfig webhooks to trigger builds, since many can't be
add an OpenShift auth token to their HTTP headers (ex: GitHub). Only
new installations will be impacted; upgrades to 4.16 will continue to
support unauthenticated BuildConfig webhooks.

This test update verifies that BuildConfig webhooks can be triggered
using a namespace-scoped RoleBinding for the `system:unauthenticated`
group. RoleBindings are preferable to ClusterRoleBindings as they limit
unauthenticated API calls to specific namespaces, reducing the
potential attack surface. The core webhook tests were also updated to
verify that unauthenticated webhooks fail if this rolebinding is
missing.

Use of BuildConfig webhooks should be discouraged in favor of Pipelines
as Code, which has more robust mechanisms for securing webhook calls
from external systems. It also does not rely on an aggregated apiserver
and associated RBAC.

See also https://issues.redhat.com/browse/AUTH-509

Signed-off-by: Adam Kaplan <[email protected]>
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label May 6, 2024
@adambkaplan
Copy link
Contributor Author

@stbenjam updated the transport to include the proxy configuration - PTAL.

@stbenjam
Copy link
Member

stbenjam commented May 6, 2024

/retest-required

@stbenjam
Copy link
Member

stbenjam commented May 6, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 6, 2024
Copy link
Contributor

openshift-ci bot commented May 6, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adambkaplan, sanchezl, sayan-biswas, sjenning, stbenjam

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

The pull request process is described 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

@openshift-trt-bot
Copy link

Job Failure Risk Analysis for sha: 43b42d4

Job Name Failure Risk
pull-ci-openshift-origin-master-e2e-metal-ipi-ovn-ipv6 IncompleteTests
Tests for this run (23) are below the historical average (1300): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD 15c3521 and 2 for PR HEAD 43b42d4 in total

@eggfoobar
Copy link
Contributor

/retest-required

Copy link
Contributor

openshift-ci bot commented May 7, 2024

@adambkaplan: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-csi 43b42d4 link false /test e2e-gcp-csi
ci/prow/e2e-gcp-ovn-rt-upgrade 43b42d4 link false /test e2e-gcp-ovn-rt-upgrade
ci/prow/e2e-aws-ovn-single-node-upgrade 43b42d4 link false /test e2e-aws-ovn-single-node-upgrade

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/test-infra repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit 75f7e06 into openshift:master May 7, 2024
20 of 23 checks passed
@openshift-ci-robot
Copy link

@adambkaplan: Jira Issue OCPBUGS-33041: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-33041 has been moved to the MODIFIED state.

In response to this:

Starting in OCP 4.16, the system:webhook ClusterRole will not be granted to anonymous users by default. This will break most systems that use BuildConfig webhooks to trigger builds, since many can't be add an OpenShift auth token to their HTTP headers (ex: GitHub). Only new installations will be impacted; upgrades to 4.16 will continue to support unauthenticated BuildConfig webhooks.

This test update verifies that BuildConfig webhooks can be triggered using a namespace-scoped RoleBinding for the system:unauthenticated group. RoleBindings are preferable to ClusterRoleBindings as they limit unauthenticated API calls to specific namespaces, reducing the potential attack surface.

Use of BuildConfig webhooks should be discouraged in favor of Pipelines as Code, which has more robust mechanisms for securing webhook calls from external systems. It also does not rely on an aggregated apiserver and associated RBAC.

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 openshift-eng/jira-lifecycle-plugin repository.

stbenjam added a commit to stbenjam/origin that referenced this pull request May 8, 2024
…icated-webhook-bc"

This reverts commit 75f7e06, reversing
changes made to 15c3521.
adambkaplan added a commit to adambkaplan/origin that referenced this pull request May 8, 2024
…ticated-webhook-bc"

This reverts commit e3c844d,
restoring the test changes in origin#28750.
deads2k added a commit that referenced this pull request May 8, 2024
TRT-1656: Revert #28750 "OCPBUGS-33041: Add RoleBinding for BuildConfig Webhooks"
adambkaplan added a commit to adambkaplan/origin that referenced this pull request May 8, 2024
…ticated-webhook-bc"

This reverts commit e3c844d,
restoring the test changes in origin#28750.
@openshift-merge-robot
Copy link
Contributor

Fix included in accepted release 4.16.0-0.nightly-2024-05-08-222442

@adambkaplan adambkaplan deleted the unauthenticated-webhook-bc branch May 10, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet