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

Use http/1.1 for webhooks, metrics and profiling endpoints #1923

Merged
merged 1 commit into from
Nov 23, 2023

Conversation

yuumasato
Copy link
Contributor

@yuumasato yuumasato commented Oct 18, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

This mitigates an HTTP/2 Stream Cancellation Attack that can lead to a denial-of-service.

Which issue(s) this PR fixes:

CVE-2023-44487

Does this PR have test?

Yes, added test cases for Metrics, Webhooks and profiling endpoints checking that they are serving HTTP/1.1

Special notes for your reviewer:

Does this PR introduce a user-facing change?

None

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. labels Oct 18, 2023
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 18, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: yuumasato / name: Watson Yuuma Sato (0629fb8)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Oct 18, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @yuumasato!

It looks like this is your first PR to kubernetes-sigs/security-profiles-operator 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/security-profiles-operator has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 18, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @yuumasato. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Oct 18, 2023
Copy link
Contributor

@Vincent056 Vincent056 left a comment

Choose a reason for hiding this comment

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

/lgtm
thanks for the patch

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 18, 2023
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 18, 2023
@saschagrunert
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 19, 2023
@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 19, 2023
@codecov-commenter
Copy link

codecov-commenter commented Oct 19, 2023

Codecov Report

Merging #1923 (0629fb8) into main (3bee9d9) will decrease coverage by 0.05%.
Report is 1 commits behind head on main.
The diff coverage is n/a.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1923      +/-   ##
==========================================
- Coverage   49.32%   49.28%   -0.05%     
==========================================
  Files          72       72              
  Lines        7008     7008              
==========================================
- Hits         3457     3454       -3     
- Misses       3420     3422       +2     
- Partials      131      132       +1     

@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 19, 2023
@k8s-ci-robot k8s-ci-robot removed the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 19, 2023
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 17, 2023
@yuumasato yuumasato force-pushed the disable-http2 branch 2 times, most recently from dca3a5f to 66c1258 Compare November 17, 2023 18:10
@yuumasato
Copy link
Contributor Author

/retest

@yuumasato yuumasato force-pushed the disable-http2 branch 2 times, most recently from 41a4a15 to b372999 Compare November 20, 2023 15:04
@yuumasato
Copy link
Contributor Author

I have limited runAndRetryPodCMD() to 5 times.
This should allow other tests to run. I want to see if the metrics endpoint name can be resolved.

test/suite_test.go Outdated Show resolved Hide resolved
@yuumasato
Copy link
Contributor Author

@saschagrunert Hi, I have moved the test for webhook and metrics endpoints HTTP versions behind a check for "flakyness".

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 21, 2023
@saschagrunert saschagrunert added tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Nov 21, 2023
@yuumasato yuumasato force-pushed the disable-http2 branch 2 times, most recently from 122ca4b to 899f3a9 Compare November 22, 2023 13:17
@yuumasato
Copy link
Contributor Author

I moved the webhook and metrics test case to file test/e2e_flaky_test.go to ensure they are run with make test-flaky-e2e

This mitigates an HTTP/2 Stream Cancellation Attack that can lead to a
denial-of-service.
Tests are also added to ensure the metrics, webhook and profiling
endpoints are serving HTTP/1.1

The profiling HTTP test is Selinux Specific, and the
Webhook and Metrics HTTP version tests are marked as flaky, as the
urls, for some reason, are not solved in upstream CI.
@rhmdnd
Copy link
Contributor

rhmdnd commented Nov 22, 2023

These tests work for me on an OpenShift cluster if I apply #1979

--- PASS: TestSuite (189.72s)
    --- PASS: TestSuite/TestSecurityProfilesOperator_Flaky (188.60s)
        --- SKIP: TestSuite/TestSecurityProfilesOperator_Flaky/cluster-wide:_Seccomp:_Metrics (0.00s)
        --- PASS: TestSuite/TestSecurityProfilesOperator_Flaky/cluster-wide:_SPOD:_Test_webhook_HTTP_version (10.93s)
        --- PASS: TestSuite/TestSecurityProfilesOperator_Flaky/cluster-wide:_SPOD:_Test_Metrics_HTTP_version (8.04s)
        --- PASS: TestSuite/TestSecurityProfilesOperator_Flaky/cluster-wide:_Seccomp:_Verify_profile_binding (26.92s)
        --- SKIP: TestSuite/TestSecurityProfilesOperator_Flaky/cluster-wide:_Seccomp:_Verify_profile_recording_logs (0.00s)
        --- SKIP: TestSuite/TestSecurityProfilesOperator_Flaky/cluster-wide:_Seccomp:_Verify_profile_recording_bpf (0.00s)
        --- SKIP: TestSuite/TestSecurityProfilesOperator_Flaky/namespaced:_Seccomp:_Metrics (0.00s)
        --- PASS: TestSuite/TestSecurityProfilesOperator_Flaky/namespaced:_SPOD:_Test_webhook_HTTP_version (7.79s)
        --- PASS: TestSuite/TestSecurityProfilesOperator_Flaky/namespaced:_SPOD:_Test_Metrics_HTTP_version (8.04s)
PASS
ok      sigs.k8s.io/security-profiles-operator/test     189.726s

Thanks for digging into all this @yuumasato.

Copy link
Contributor

@rhmdnd rhmdnd left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot
Copy link
Contributor

@rhmdnd: changing LGTM is restricted to collaborators

In response to this:

/lgtm

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.

@yuumasato
Copy link
Contributor Author

@rhmdnd Thanks for checking the execution of the flaky tests.

@saschagrunert saschagrunert removed the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Nov 23, 2023
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 23, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: saschagrunert, yuumasato

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

@k8s-ci-robot k8s-ci-robot merged commit 47c73e8 into kubernetes-sigs:main Nov 23, 2023
19 checks passed
@yuumasato yuumasato deleted the disable-http2 branch November 23, 2023 09:29
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants