Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 29 additions & 29 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2475,6 +2475,35 @@ Contents of probable licence file $GOMODCACHE/github.com/!azure/go-autorest/auto
limitations under the License.


--------------------------------------------------------------------------------
Dependency : github.com/Masterminds/semver
Version: v1.5.0
Licence type (autodetected): MIT
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/!masterminds/semver@v1.5.0/LICENSE.txt:

Copyright (C) 2014-2019, Matt Butcher and Matt Farina

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


--------------------------------------------------------------------------------
Dependency : github.com/Microsoft/go-winio
Version: v0.6.2
Expand Down Expand Up @@ -41190,35 +41219,6 @@ Contents of probable licence file $GOMODCACHE/github.com/!google!cloud!platform/
limitations under the License.


--------------------------------------------------------------------------------
Dependency : github.com/Masterminds/semver
Version: v1.5.0
Licence type (autodetected): MIT
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/!masterminds/semver@v1.5.0/LICENSE.txt:

Copyright (C) 2014-2019, Matt Butcher and Matt Farina

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


--------------------------------------------------------------------------------
Dependency : github.com/UNO-SOFT/zlog
Version: v0.8.1
Expand Down
5 changes: 5 additions & 0 deletions changelog/fragments/1774861942-upgrade-osquery-5.22.1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: feature

summary: upgrade osquery version to 5.22.1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I noticed the upstream changelog mentions possible breaking behavior to some responses related to UTF-8 encoding. Consider calling that out in the description field.

component: osquerybeat
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
github.com/Azure/go-autorest/autorest v0.11.30
github.com/Azure/go-autorest/autorest/date v0.3.1
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/semver v1.5.0
github.com/Microsoft/go-winio v0.6.2
github.com/PaesslerAG/gval v1.2.2
github.com/PaesslerAG/jsonpath v0.1.1
Expand Down
12 changes: 6 additions & 6 deletions x-pack/osquerybeat/_meta/config/beat.reference.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@ osquerybeat:
# # If the current platform/arch is unset, bundled osquery is used.
# linux:
# amd64:
# artifact_url: "https://example.org/osquery-5.19.0.linux_x86_64.tar.gz"
# artifact_url: "https://example.org/osquery-5.22.1.linux_x86_64.tar.gz"
# sha256: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
# arm64:
# artifact_url: "https://example.org/osquery-5.19.0.linux_aarch64.tar.gz"
# artifact_url: "https://example.org/osquery-5.22.1.linux_aarch64.tar.gz"
# sha256: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
# # Optional platform-level SSL fallback (used if amd64/arm64 ssl is unset).
# #ssl.verification_mode: full
# darwin:
# amd64:
# artifact_url: "https://example.org/osquery-5.19.0.darwin.pkg"
# artifact_url: "https://example.org/osquery-5.22.1.darwin.pkg"
# sha256: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
# arm64:
# artifact_url: "https://example.org/osquery-5.19.0.darwin.pkg"
# artifact_url: "https://example.org/osquery-5.22.1.darwin.pkg"
# sha256: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
# windows:
# amd64:
# artifact_url: "https://example.org/osquery-5.19.0.windows.msi"
# artifact_url: "https://example.org/osquery-5.22.1.windows.msi"
# sha256: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
# arm64:
# artifact_url: "https://example.org/osquery-5.19.0.windows_arm64.zip"
# artifact_url: "https://example.org/osquery-5.22.1.windows_arm64.zip"
# sha256: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
# # Allow non-HTTPS artifact URLs (not recommended).
# #allow_insecure_url: false
Expand Down
14 changes: 7 additions & 7 deletions x-pack/osquerybeat/internal/distro/distro.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var (
DataCacheDir = filepath.Join(DataDir, "cache")
)

// Windows ARM URL: https://github.com/osquery/osquery/releases/download/5.19.0/osquery-5.19.0.windows_arm64.zip
// Windows ARM URL: https://github.com/osquery/osquery/releases/download/5.22.1/osquery-5.22.1.windows_arm64.zip
const (
osqueryDownloadBaseURL = "https://pkg.osquery.io"
osqueryDownloadGithubBaseURL = "https://github.com/osquery/osquery/releases/download"
Expand All @@ -44,16 +44,16 @@ const (

osqueryLensesDir = "lenses"

osqueryVersion = "5.19.0"
osqueryVersion = "5.22.1"
osqueryMSIExt = ".msi"
osqueryPkgExt = ".pkg"
osqueryZipExt = ".zip"

osqueryDistroDarwinSHA256 = "f24b62075c22e3edcbb635bc0b118a221f69584b5d70c7caa78475bb4fd3ade4"
osqueryDistroLinuxSHA256 = "3b9583cc037a2c5a7405d567083398103256a42e0fcfd026a11cc7aef410c772"
osqueryDistroLinuxARMSHA256 = "fa649f57bfb1a6cb836a9af6e280b79382ff4a4e885c5998359c12e5caa051d3"
osqueryDistroWindowsSHA256 = "6fe06cab43a31c596e4001616eee66fb32556bf5c228c4a4ba6daf2897edc1a3"
osqueryDistroWindowsZipSHA256 = "298f4dfb2dad2bdf666b337d9d258c4bcc5254ad546c4710b24fcc864096c587"
osqueryDistroDarwinSHA256 = "63118ae94aa4292c7b302a69a121e197d120eafcfcb186fd3ebeccb1b0c06129"
osqueryDistroLinuxSHA256 = "ce03611ab75da07d069d56aa88b71028a411dbf5147ff5249cf941cb8553de86"
osqueryDistroLinuxARMSHA256 = "5eb41f11329aa19a8a1cb81ad21ecd9155b97b22e7b491b388908a6c28402717"
osqueryDistroWindowsSHA256 = "91238c6f7543979e59d88886d61e8e7a222f6595f89b24bfac385d31433f7a02"
osqueryDistroWindowsZipSHA256 = "5909552058b3d2986782c3dd618e7d6138c5ed11cfaac8e7f4d4280312b049e5"
)

type OSArch struct {
Expand Down
31 changes: 22 additions & 9 deletions x-pack/osquerybeat/internal/install/artifact/artifact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,23 @@
"sync"
"testing"

"github.com/Masterminds/semver"

Check failure on line 24 in x-pack/osquerybeat/internal/install/artifact/artifact_test.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

File is not properly formatted (goimports)

Check failure on line 24 in x-pack/osquerybeat/internal/install/artifact/artifact_test.go

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

File is not properly formatted (goimports)

Check failure on line 24 in x-pack/osquerybeat/internal/install/artifact/artifact_test.go

View workflow job for this annotation

GitHub Actions / lint (macos-latest)

File is not properly formatted (goimports)
"github.com/elastic/beats/v7/x-pack/osquerybeat/internal/config"
"github.com/elastic/beats/v7/x-pack/osquerybeat/internal/distro"
"github.com/elastic/elastic-agent-libs/logp"
)

var testOsqueryVersion = distro.OsquerydVersion()

func nextPatchVersion(version string) string {
parsed, err := semver.NewVersion(version)
if err != nil {
return version
}
next := parsed.IncPatch()
return (&next).String()
}

func testInstallConfig(url, sha string) config.InstallConfig {
cfg := config.InstallConfig{
AllowInsecureURL: true,
Expand Down Expand Up @@ -129,7 +142,7 @@
}

func TestExtractArtifactFromSignedURLPath(t *testing.T) {
artifactBytes := buildTarGzArtifact(t, "5.19.0", true)
artifactBytes := buildTarGzArtifact(t, testOsqueryVersion, true)
artifactFile := filepath.Join(t.TempDir(), "artifact.tar.gz")
if err := os.WriteFile(artifactFile, artifactBytes, 0600); err != nil {
t.Fatalf("write artifact failed: %v", err)
Expand Down Expand Up @@ -240,7 +253,7 @@
}

log := logp.NewLogger("artifact_test")
version := "5.19.0"
version := testOsqueryVersion
artifactBytes := buildTarGzArtifact(t, version, true)
sum := sha256.Sum256(artifactBytes)
sha := hex.EncodeToString(sum[:])
Expand Down Expand Up @@ -281,8 +294,8 @@
}

log := logp.NewLogger("artifact_test")
artifactV1 := buildTarGzArtifact(t, "5.19.0", true)
artifactV2 := buildTarGzArtifact(t, "5.20.0", true)
artifactV1 := buildTarGzArtifact(t, testOsqueryVersion, true)
artifactV2 := buildTarGzArtifact(t, nextPatchVersion(testOsqueryVersion), true)

sum1 := sha256.Sum256(artifactV1)
sha1 := hex.EncodeToString(sum1[:])
Expand Down Expand Up @@ -332,7 +345,7 @@
}

log := logp.NewLogger("artifact_test")
version := "5.19.0"
version := testOsqueryVersion
artifactBytes := buildTarGzArtifact(t, version, true)
sum := sha256.Sum256(artifactBytes)
sha := hex.EncodeToString(sum[:])
Expand Down Expand Up @@ -405,7 +418,7 @@
}

log := logp.NewLogger("artifact_test")
version := "5.19.0"
version := testOsqueryVersion
artifactBytes := buildTarGzArtifact(t, version, false)
sum := sha256.Sum256(artifactBytes)
sha := hex.EncodeToString(sum[:])
Expand All @@ -432,7 +445,7 @@
}

log := logp.NewLogger("artifact_test")
version := "5.19.0"
version := testOsqueryVersion
artifactBytes := buildTarGzArtifactWithExtra(t, version, "docs/README.txt", []byte("extra"))
sum := sha256.Sum256(artifactBytes)
sha := hex.EncodeToString(sum[:])
Expand Down Expand Up @@ -501,8 +514,8 @@
}

log := logp.NewLogger("artifact_test")
artifactV1 := buildTarGzArtifact(t, "5.19.0", true)
artifactV2 := buildTarGzArtifact(t, "5.20.0", true)
artifactV1 := buildTarGzArtifact(t, testOsqueryVersion, true)
artifactV2 := buildTarGzArtifact(t, nextPatchVersion(testOsqueryVersion), true)

sum1 := sha256.Sum256(artifactV1)
sha1 := hex.EncodeToString(sum1[:])
Expand Down Expand Up @@ -672,7 +685,7 @@
t.Fatalf("write tar header failed: %v", err)
}
const maxTarEntrySize = 10 << 20 // 10 MiB
if _, err := io.CopyN(tw, tr, maxTarEntrySize); err != nil && err != io.EOF {

Check failure on line 688 in x-pack/osquerybeat/internal/install/artifact/artifact_test.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

comparing with != will fail on wrapped errors. Use errors.Is to check for a specific error (errorlint)

Check failure on line 688 in x-pack/osquerybeat/internal/install/artifact/artifact_test.go

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

comparing with != will fail on wrapped errors. Use errors.Is to check for a specific error (errorlint)

Check failure on line 688 in x-pack/osquerybeat/internal/install/artifact/artifact_test.go

View workflow job for this annotation

GitHub Actions / lint (macos-latest)

comparing with != will fail on wrapped errors. Use errors.Is to check for a specific error (errorlint)
t.Fatalf("copy tar entry failed: %v", err)
}
}
Expand Down
3 changes: 2 additions & 1 deletion x-pack/osquerybeat/internal/install/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"strings"
"testing"

"github.com/elastic/beats/v7/x-pack/osquerybeat/internal/distro"
"github.com/elastic/elastic-agent-libs/logp"
)

Expand Down Expand Up @@ -39,7 +40,7 @@ func setupFiles(testdataBaseDir string, files []string) (string, error) {
if strings.HasSuffix(base, ".exe") {
content = []byte("fake windows binary")
} else {
content = []byte("#!/bin/sh\necho \"osqueryd version 5.19.0\"\n")
content = []byte("#!/bin/sh\necho \"osqueryd version " + distro.OsquerydVersion() + "\"\n")
}
}

Expand Down
12 changes: 6 additions & 6 deletions x-pack/osquerybeat/osquerybeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@ osquerybeat:
# # If the current platform/arch is unset, bundled osquery is used.
# linux:
# amd64:
# artifact_url: "https://example.org/osquery-5.19.0.linux_x86_64.tar.gz"
# artifact_url: "https://example.org/osquery-5.22.1.linux_x86_64.tar.gz"
# sha256: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
# arm64:
# artifact_url: "https://example.org/osquery-5.19.0.linux_aarch64.tar.gz"
# artifact_url: "https://example.org/osquery-5.22.1.linux_aarch64.tar.gz"
# sha256: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
# # Optional platform-level SSL fallback (used if amd64/arm64 ssl is unset).
# #ssl.verification_mode: full
# darwin:
# amd64:
# artifact_url: "https://example.org/osquery-5.19.0.darwin.pkg"
# artifact_url: "https://example.org/osquery-5.22.1.darwin.pkg"
# sha256: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
# arm64:
# artifact_url: "https://example.org/osquery-5.19.0.darwin.pkg"
# artifact_url: "https://example.org/osquery-5.22.1.darwin.pkg"
# sha256: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
# windows:
# amd64:
# artifact_url: "https://example.org/osquery-5.19.0.windows.msi"
# artifact_url: "https://example.org/osquery-5.22.1.windows.msi"
# sha256: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
# arm64:
# artifact_url: "https://example.org/osquery-5.19.0.windows_arm64.zip"
# artifact_url: "https://example.org/osquery-5.22.1.windows_arm64.zip"
# sha256: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
# # Allow non-HTTPS artifact URLs (not recommended).
# #allow_insecure_url: false
Expand Down
Loading