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

nodetaint/0.0.4-r22: cve remediation #35052

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

octo-sts[bot]
Copy link
Contributor

@octo-sts octo-sts bot commented Nov 23, 2024

@octo-sts octo-sts bot added P1 This label indicates our scanning found High, Medium or Low CVEs for these packages. automated pr GHSA-27wf-5967-98gx go/bump request-cve-remediation nodetaint/0.0.4-r22 labels Nov 23, 2024
Copy link
Contributor Author

octo-sts bot commented Nov 23, 2024

Gen AI suggestions to solve the build error:

• Detected Error: "cannot use doc (variable of type *"github.com/google/gnostic/openapiv2".Document) as *"github.com/google/gnostic-models/openapiv2".Document value in argument to proto.NewOpenAPIData"

• Error Category: Dependency/Version

• Failure Point: Go module dependency resolution during build, specifically with k8s.io/client-go package

• Root Cause Analysis: There's a type mismatch between gnostic packages due to incompatible versions. The kubernetes client-go package v0.27.8 is using an older version of gnostic that's incompatible with newer dependencies.

• Suggested Fix:

  1. Update the go/bump step in the melange YAML to use compatible versions:
  - uses: go/bump
    with:
      deps: k8s.io/[email protected] k8s.io/[email protected] k8s.io/[email protected] google.golang.org/[email protected] golang.org/x/[email protected]
  1. Add explicit version constraint for gnostic:
  - runs: |
      go mod edit -require github.com/google/[email protected]
      go mod tidy -compat=1.17

• Explanation: The error occurs because newer versions of dependencies are trying to use the updated gnostic-models package while k8s.io/client-go is still expecting the older gnostic package. By pinning to compatible versions and explicitly requiring the correct gnostic version, we ensure type compatibility across dependencies.

• Additional Notes:

  • This is a common issue when dealing with Kubernetes client libraries and their dependencies
  • The fix maintains security while ensuring build compatibility
  • Using v0.27.13 for k8s.io packages provides latest security updates while maintaining compatibility

• References:

@mamccorm mamccorm force-pushed the cve-nodetaint-c929e7455c24df2c8ff1ed3812c709c3 branch from d05e268 to d80dbc8 Compare December 7, 2024 20:37
Copy link
Contributor Author

octo-sts bot commented Dec 7, 2024

Gen AI suggestions to solve the build error:

• Detected Error: "failed to build package: unable to run package nodetaint pipeline: unable to run pipeline: exit status 1"

• Error Category: Build/Version

• Failure Point: During the go/bump step when updating dependencies

• Root Cause Analysis: The error appears to be caused by version incompatibility between the Go modules being updated. The pipeline is trying to update to newer versions of k8s.io components while keeping compatibility with Go 1.17 (-compat=1.17), which is causing conflicts.

• Suggested Fix:

  1. Update the go mod tidy compatibility version to match the kubernetes version being used:
  - runs: |
      # Update this line
      go mod tidy -compat=1.20
  1. Update the version constraints in the go/bump step to align with k8s.io v0.27.x requirements:
  - uses: go/bump
    with:
      deps: k8s.io/[email protected] k8s.io/[email protected] google.golang.org/[email protected] golang.org/x/[email protected] k8s.io/[email protected]

• Explanation:

  • Kubernetes v0.27.x requires Go 1.20+
  • The current configuration tries to use Go 1.17 compatibility which is too old
  • Aligning the Go compatibility version with the k8s.io module requirements should resolve the dependency conflicts

• Additional Notes:

  • Consider updating to a newer version of kubernetes components (v0.28.x or v0.29.x) if possible
  • The error message is truncated, but the root cause appears to be dependency resolution
  • The go.mod replacements should be aligned with the versions specified in the go/bump step

• References:

@developer-guy
Copy link
Member

the build is failing with the following error:

2024/12/08 11:58:53 WARN /var/cache/melange/gomodcache/k8s.io/[email protected]/applyconfigurations/meta/v1/unstructured.go:64:38: cannot use doc (variable of type *"github.com/google/gnostic/openapiv2".Document) as *"github.com/google/gnostic-models/openapiv2".Document value in argument to proto.NewOpenAPIData

which means that the project cannot be compiled with updating kubernetes dependency, so we have to add this as a note to the detected CVE entry here: https://github.com/wolfi-dev/advisories/blob/a1b97bda597968dbe9fac378f615103f55881e55/nodetaint.advisories.yaml#L494

Copy link
Contributor Author

octo-sts bot commented Dec 12, 2024

Gen AI suggestions to solve the build error:

• Detected Error:

cannot use doc (variable of type *"github.com/google/gnostic/openapiv2".Document) as *"github.com/google/gnostic-models/openapiv2".Document value in argument to proto.NewOpenAPIData

• Error Category: Dependency/Version

• Failure Point: Go package compilation during the build phase, specifically in k8s.io/client-go package

• Root Cause Analysis: There's a type mismatch between gnostic packages. This is a known issue when mixing certain versions of kubernetes client libraries with newer versions of gnostic dependencies.

• Suggested Fix:

  1. Add explicit version constraints for gnostic in the go/bump step:
  - uses: go/bump
    with:
      deps: |
        k8s.io/[email protected] 
        k8s.io/[email protected] 
        google.golang.org/[email protected] 
        golang.org/x/[email protected] 
        k8s.io/[email protected] 
        k8s.io/[email protected]
        github.com/google/[email protected]
        github.com/google/[email protected]

• Explanation: The error occurs because newer versions of kubernetes client libraries expect the gnostic-models package while older versions use the gnostic package. By explicitly pinning the gnostic versions, we ensure compatibility with the kubernetes client library version being used.

• Additional Notes:

  • This is a common issue when updating kubernetes-related packages
  • The specific versions suggested align with k8s.io/client-go v0.27.x requirements
  • Alternative approach would be to downgrade the kubernetes packages to a version before the gnostic split

• References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automated pr GHSA-27wf-5967-98gx go/bump nodetaint/0.0.4-r22 P1 This label indicates our scanning found High, Medium or Low CVEs for these packages. request-cve-remediation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants