Skip to content

Guard against nil pointer dereference#8107

Merged
ycombinator merged 4 commits intoelastic:mainfrom
ycombinator:guard-nil
May 8, 2025
Merged

Guard against nil pointer dereference#8107
ycombinator merged 4 commits intoelastic:mainfrom
ycombinator:guard-nil

Conversation

@ycombinator
Copy link
Copy Markdown
Contributor

This PR adds a guard against a variable being nil before we try to dereference it.

@ycombinator ycombinator requested a review from a team as a code owner May 7, 2025 18:49
@ycombinator ycombinator requested review from kaanyalti and swiatekm May 7, 2025 18:49
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented May 7, 2025

This pull request does not have a backport label. Could you fix it @ycombinator? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-./d./d is the label that automatically backports to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@ycombinator ycombinator added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team backport-active-9 Automated backport with mergify to all the active 9.[0-9]+ branches backport-8.19 Automated backport to the 8.19 branch labels May 7, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

ebeahan
ebeahan previously approved these changes May 7, 2025
swiatekm
swiatekm previously approved these changes May 7, 2025
@ycombinator ycombinator dismissed stale reviews from swiatekm and ebeahan via bbd0323 May 7, 2025 19:03
@ycombinator ycombinator enabled auto-merge (squash) May 7, 2025 19:11
@ycombinator ycombinator requested review from ebeahan and swiatekm May 7, 2025 19:22
Comment thread testing/integration/beat_receivers_test.go
@elastic-sonarqube
Copy link
Copy Markdown

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

cc @ycombinator

@ycombinator ycombinator requested a review from cmacknz May 7, 2025 22:00
@ycombinator ycombinator merged commit eb9d202 into elastic:main May 8, 2025
12 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented May 8, 2025

@Mergifyio backport 9.0

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented May 8, 2025

backport 9.0

✅ Backports have been created

Details

mergify bot pushed a commit that referenced this pull request May 8, 2025
* Add nil guard

* Return if nil

* Use the assert.CollectT object

(cherry picked from commit eb9d202)
mergify bot pushed a commit that referenced this pull request May 8, 2025
* Add nil guard

* Return if nil

* Use the assert.CollectT object

(cherry picked from commit eb9d202)

# Conflicts:
#	testing/integration/beat_receivers_test.go
@ycombinator ycombinator deleted the guard-nil branch May 8, 2025 00:14
ycombinator added a commit that referenced this pull request May 8, 2025
* Add nil guard

* Return if nil

* Use the assert.CollectT object

(cherry picked from commit eb9d202)

Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
ycombinator added a commit that referenced this pull request May 8, 2025
* Add nil guard

* Return if nil

* Use the assert.CollectT object

(cherry picked from commit eb9d202)

# Conflicts:
#	testing/integration/beat_receivers_test.go

Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
v1v added a commit to v1v/elastic-agent that referenced this pull request May 8, 2025
* upstream/main:
  Guard against `nil` pointer dereference (elastic#8107)
  Generate NOTICE.txt with only modules used by binaries (elastic#8053)
  Retry enrollment requests when an error is returned, add enrollment timeout (elastic#8056)
  Changelog for 8.17.6 version (elastic#8062) (elastic#8106)
  [main][Automation] Update versions (elastic#8098)
  Allow using beats receivers for self-monitoring (elastic#8031)
  Adding new configuration setting: `agent.upgrade.rollback.window` (elastic#8065)
  [Integration Testing] Allow tests to declare themselves as needing a FIPS environment (elastic#8083)
  fix(agentless): overcome SIGPIPE in agentless promotion pipeline (elastic#8094)
  ksm autosharing integration configuration update (elastic#8086)
@leehinman
Copy link
Copy Markdown
Contributor

I don't think this was sufficient. I see a different error now. @swiatekm

>>> (linux-arm64-ubuntu-2404-default) Test output (sudo) (stdout): fixture.go:679: >> running binary with: [/opt/Elastic/Agent/elastic-agent status --output json]
>>> (linux-arm64-ubuntu-2404-default) Test output (sudo) (stdout): beat_receivers_test.go:273:
>>> (linux-arm64-ubuntu-2404-default) Test output (sudo) (stdout): Error Trace:	/home/ubuntu/agent/testing/integration/beat_receivers_test.go:279
>>> (linux-arm64-ubuntu-2404-default) Test output (sudo) (stdout): /usr/local/go/src/runtime/asm_arm64.s:1223
>>> (linux-arm64-ubuntu-2404-default) Test output (sudo) (stdout): Error:      	Should be zero, but was 3
>>> (linux-arm64-ubuntu-2404-default) Test output (sudo) (stdout): beat_receivers_test.go:273:
>>> (linux-arm64-ubuntu-2404-default) Test output (sudo) (stdout): Error Trace:	/home/ubuntu/agent/testing/integration/beat_receivers_test.go:283
>>> (linux-arm64-ubuntu-2404-default) Test output (sudo) (stdout): /usr/local/go/src/runtime/asm_arm64.s:1223
>>> (linux-arm64-ubuntu-2404-default) Test output (sudo) (stdout): Error:      	Expected value not to be nil.
>>> (linux-arm64-ubuntu-2404-default) Test output (sudo) (stdout): beat_receivers_test.go:273:
>>> (linux-arm64-ubuntu-2404-default) Test output (sudo) (stdout): Error Trace:	/home/ubuntu/agent/testing/integration/beat_receivers_test.go:273
>>> (linux-arm64-ubuntu-2404-default) Test output (sudo) (stdout): Error:      	Condition never satisfied
>>> (linux-arm64-ubuntu-2404-default) Test output (sudo) (stdout): Test:       	TestAgentMonitoring/compare_logs_ingested_by_agent_monitoring_vs_otel_monitoring
>>> (linux-arm64-ubuntu-2404-default) Test output (sudo) (stdout): fixture_install.go:310: [test TestAgentMonitoring/compare_logs_ingested_by_agent_monitoring_vs_otel_monitoring] Inside fixture cleanup function
>>> (linux-arm64-ubuntu-2404-default) Test output (sudo) (stdout): fixture_install.go:326: collecting diagnostics; test failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-8.19 Automated backport to the 8.19 branch backport-active-9 Automated backport with mergify to all the active 9.[0-9]+ branches skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants