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

golang-crossbuild: Fix a vulnerability CVE-2022-24765 #34242

Closed
wants to merge 6 commits into from

Conversation

v1v
Copy link
Member

@v1v v1v commented Jan 12, 2023

What does this PR do?

The announcement for CVE-2022-24765 recommends setting GIT_CEILING_DIRECTORIES to prevent out-of-bounds config access.

Why is it important?

Otherwise, it will fail with:

[2023-01-11T09:58:36.531Z] >> Building using: cmd='build/mage-linux-amd64 golangCrossBuild', env=[CC=o64-clang, CXX=o64-clang++, GOARCH=amd64, GOARM=, GOOS=darwin, PLATFORM_ID=darwin-amd64]
[2023-01-11T09:58:36.632Z] fatal: detected dubious ownership in repository at '/go/src/github.com/elastic/beats'

How to test this PR locally

cd <your-beats>
PACKAGES="docker" PLATFORMS="linux/arm64" mage package

Related issues

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jan 12, 2023
@botelastic
Copy link

botelastic bot commented Jan 12, 2023

This pull request doesn't have a Team:<team> label.

@mergify
Copy link
Contributor

mergify bot commented Jan 12, 2023

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @v1v? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

@mergify mergify bot assigned v1v Jan 12, 2023
@v1v v1v added backport-7.17 Automated backport to the 7.17 branch with mergify backport-v8.6.0 Automated backport with mergify labels Jan 12, 2023
dev-tools/mage/crossbuild.go Outdated Show resolved Hide resolved
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jan 12, 2023

💔 Build Failed

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-01-13T09:47:23.289+0000

  • Duration: 7 min 11 sec

Steps errors 1

Expand to view the steps failures

Shell Script
  • Took 0 min 16 sec . View more details here
  • Description: HOME=/var/lib/jenkins/workspace/Beats_beats_PR-34242 GO_VERSION=1.18.9 ./dev-tools/run_with_go_ver make test-mage

❕ Flaky test report

No test was executed to be analysed.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

dev-tools/mage/crossbuild.go Outdated Show resolved Hide resolved
dev-tools/mage/crossbuild.go Outdated Show resolved Hide resolved
@@ -333,6 +333,8 @@ func (b GolangCrossBuilder) Build() error {
"--env", "MAGEFILE_VERBOSE="+verbose,
"--env", "MAGEFILE_TIMEOUT="+EnvOr("MAGEFILE_TIMEOUT", ""),
"--env", fmt.Sprintf("SNAPSHOT=%v", Snapshot),
// See https://github.com/elastic/golang-crossbuild/issues/232
"--env", "GIT_CEILING_DIRECTORIES=\/"),
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
"--env", "GIT_CEILING_DIRECTORIES=\/"),
"--env", "GIT_CEILING_DIRECTORIES=//"),

@v1v v1v closed this Jan 13, 2023
@elasticmachine
Copy link
Collaborator

💔 Build Failed

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-01-13T09:50:57.976+0000

  • Duration: 99 min 48 sec

Test stats 🧪

Test Results
Failed 0
Passed 25235
Skipped 1954
Total 27189

Steps errors 5

Expand to view the steps failures

metricbeat-goIntegTest - mage goIntegTest
  • Took 51 min 53 sec . View more details here
  • Description: mage goIntegTest
metricbeat-crosscompile - make -C metricbeat crosscompile
  • Took 8 min 43 sec . View more details here
  • Description: make -C metricbeat crosscompile
metricbeat-crosscompile - make -C metricbeat crosscompile
  • Took 6 min 54 sec . View more details here
  • Description: make -C metricbeat crosscompile
metricbeat-crosscompile - make -C metricbeat crosscompile
  • Took 6 min 7 sec . View more details here
  • Description: make -C metricbeat crosscompile
Error signal
  • Took 0 min 0 sec . View more details here
  • Description: Error 'hudson.AbortException: script returned exit code 2'

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-7.17 Automated backport to the 7.17 branch with mergify backport-v8.6.0 Automated backport with mergify needs_team Indicates that the issue/PR needs a Team:* label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants