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

Support custom e2e kustomization resources #1294

Merged
merged 21 commits into from
Aug 16, 2024

Conversation

fanny-jiang
Copy link
Contributor

@fanny-jiang fanny-jiang commented Jul 16, 2024

What does this PR do?

  • Support adding custom resources in config/e2e/kustomization.yaml in E2E kind provisioner.
  • Updates config/e2e/kustomization.yaml with latest operator image name and tag if IMG environment variable is not set
  • Enables E2E tests for merge requests to main

Motivation

Provide more operator customization for E2E tests and add defaults for E2E operator image.

Additional Notes

Anything else we should know when reviewing?

Minimum Agent Versions

Are there minimum versions of the Datadog Agent and/or Cluster Agent required?

  • Agent: vX.Y.Z
  • Cluster Agent: vX.Y.Z

Describe your test plan

  • Run IMG=<custom_operator_image> aws-vault exec sso-agent-sandbox-account-admin -- make e2e-tests
    • Verify that config/e2e/kustomization.yaml is updated with the correct controller image name and tag
    • Verify that E2E tests pass
  • Run aws-vault exec sso-agent-sandbox-account-admin -- make e2e-tests
    • Verify that config/e2e/kustomization.yaml is updated with the default gcr.io/datadoghq/operator image name and latest tag
    • Verify that E2E tests pass

Checklist

  • PR has at least one valid label: bug, enhancement, refactoring, documentation, tooling, and/or dependencies
  • PR has a milestone or the qa/skip-qa label

@codecov-commenter
Copy link

codecov-commenter commented Jul 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.09%. Comparing base (9e90373) to head (dc76436).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1294   +/-   ##
=======================================
  Coverage   47.09%   47.09%           
=======================================
  Files         228      228           
  Lines       21380    21380           
=======================================
  Hits        10068    10068           
  Misses      10727    10727           
  Partials      585      585           
Flag Coverage Δ
unittests 47.09% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9e90373...dc76436. Read the comment docs.

@@ -66,32 +79,42 @@ require (
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/djherbis/times v1.6.0 // indirect
github.com/docker/cli v24.0.7+incompatible // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker v24.0.9+incompatible // indirect

Choose a reason for hiding this comment

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

Library Vulnerability

github.com/docker/docker → 24.0.9+incompatible

Authz zero length regression (...read more)

A security vulnerability has been detected in certain versions of Docker Engine, which could allow an attacker to bypass authorization plugins (AuthZ) under specific circumstances. The base likelihood of this being exploited is low. This advisory outlines the issue, identifies the affected versions, and provides remediation steps for impacted users.

Impact

Using a specially-crafted API request, an Engine API client could make the daemon forward the request or response to an authorization plugin without the body. In certain circumstances, the authorization plugin may allow a request which it would have otherwise denied if the body had been forwarded to it.

A security issue was discovered In 2018, where an attacker could bypass AuthZ plugins using a specially crafted API request. This could lead to unauthorized actions, including privilege escalation. Although this issue was fixed in Docker Engine v18.09.1 in January 2019, the fix was not carried forward to later major versions, resulting in a regression. Anyone who depends on authorization plugins that introspect the request and/or response body to make access control decisions is potentially impacted.

Docker EE v19.03.x and all versions of Mirantis Container Runtime are not vulnerable.

Vulnerability details

  • AuthZ bypass and privilege escalation: An attacker could exploit a bypass using an API request with Content-Length set to 0, causing the Docker daemon to forward the request without the body to the AuthZ plugin, which might approve the request incorrectly.
  • Initial fix: The issue was fixed in Docker Engine v18.09.1 January 2019..
  • Regression: The fix was not included in Docker Engine v19.03 or newer versions. This was identified in April 2024 and patches were released for the affected versions on July 23, 2024. The issue was assigned CVE-2024-41110.

Patches

  • docker-ce v27.1.1 containes patches to fix the vulnerability.
  • Patches have also been merged into the master, 19.0, 20.0, 23.0, 24.0, 25.0, 26.0, and 26.1 release branches.

Remediation steps

  • If you are running an affected version, update to the most recent patched version.
  • Mitigation if unable to update immediately:
    • Avoid using AuthZ plugins.
    • Restrict access to the Docker API to trusted parties, following the principle of least privilege.

References

View in Datadog  Leave us feedback  Documentation

@fanny-jiang fanny-jiang force-pushed the fanny/e2e/custom-kustomization branch from 941265e to 9984682 Compare August 2, 2024 00:09
test/e2e/go.mod Outdated
@@ -1,28 +1,35 @@
module github.com/DataDog/datadog-operator/e2e

go 1.21
go 1.22.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
go 1.22.0
go 1.22.4

Copy link
Contributor

@levan-m levan-m left a comment

Choose a reason for hiding this comment

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

Looks good to me and worked fine when running locally.

env:
- name: DD_CLUSTER_NAME
valueFrom:
configMapKeyRef:
Copy link
Contributor

Choose a reason for hiding this comment

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

why aren't we using global.clusterName? is it because cluster name is dynamic and we save it in CM and let kubernetes bind it when pod is created?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, exactly. we should be able to remove the configMap when this test-infra-definitions PR is merged.
We'll be able to use the NewDDAWithOperator method, which eventually sets global.clusterName here.

@fanny-jiang fanny-jiang merged commit 78b5ad1 into main Aug 16, 2024
24 checks passed
@fanny-jiang fanny-jiang deleted the fanny/e2e/custom-kustomization branch August 16, 2024 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants