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

security: fix AliasCheck panic (update) #294

Open
1 of 4 tasks
dhiaayachi opened this issue Sep 25, 2024 · 0 comments
Open
1 of 4 tasks

security: fix AliasCheck panic (update) #294

dhiaayachi opened this issue Sep 25, 2024 · 0 comments

Comments

@dhiaayachi
Copy link
Owner

Updated checkServiceExistsOnRemoteServer to ensure there are services returned from the specified node before proceeding with the service matcher.

Description

Resolves the following

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x10370a28c]

goroutine 344 [running]:
[github.com/hashicorp/consul/agent/checks.(*CheckAlias).checkServiceExistsOnRemoteServer(0x140009f37c0](http://github.com/hashicorp/consul/agent/checks.(*CheckAlias).checkServiceExistsOnRemoteServer(0x140009f37c0), 0x140009f37d0)
        [github.com/hashicorp/consul/agent/checks/alias.go:164](http://github.com/hashicorp/consul/agent/checks/alias.go:164) +0x18c
[github.com/hashicorp/consul/agent/checks.(*CheckAlias).runQuery.func1(0x1](http://github.com/hashicorp/consul/agent/checks.(*CheckAlias).runQuery.func1(0x1)?)
        [github.com/hashicorp/consul/agent/checks/alias.go:237](http://github.com/hashicorp/consul/agent/checks/alias.go:237) +0x28
[github.com/hashicorp/consul/agent/checks.(*CheckAlias).processChecks(0x140009f37c0](http://github.com/hashicorp/consul/agent/checks.(*CheckAlias).processChecks(0x140009f37c0), {0x0, 0x0, 0x1057baa22?}, 0x140010dff48)
        [github.com/hashicorp/consul/agent/checks/alias.go:284](http://github.com/hashicorp/consul/agent/checks/alias.go:284) +0x36c
[github.com/hashicorp/consul/agent/checks.(*CheckAlias).runQuery(0x140009f37c0](http://github.com/hashicorp/consul/agent/checks.(*CheckAlias).runQuery(0x140009f37c0), 0x0?)
        [github.com/hashicorp/consul/agent/checks/alias.go:236](http://github.com/hashicorp/consul/agent/checks/alias.go:236) +0x29c
[github.com/hashicorp/consul/agent/checks.(*CheckAlias).run(0x0](http://github.com/hashicorp/consul/agent/checks.(*CheckAlias).run(0x0)?, 0x0?)
        [github.com/hashicorp/consul/agent/checks/alias.go:89](http://github.com/hashicorp/consul/agent/checks/alias.go:89) +0x58
created by [github.com/hashicorp/consul/agent/checks.(*CheckAlias).Start](http://github.com/hashicorp/consul/agent/checks.(*CheckAlias).Start) in goroutine 342
        [github.com/hashicorp/consul/agent/checks/alias.go:64](http://github.com/hashicorp/consul/agent/checks/alias.go:64) +0x15c

Fixes hashicorp#21339

Testing & Reproduction steps

curl --request PUT --data '{"name": "a", "check": {"AliasNode": "doesnotexist"}}' http://127.0.0.1:8500/v1/agent/service/register

Links

hashicorp#21339

PR Checklist

  • updated test coverage
  • external facing docs updated
  • appropriate backport labels added
  • not a security concern
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant