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

The fingerprint processor incorrectly includes a function reference in a json.Marshal call #35174

Closed
faec opened this issue Apr 21, 2023 · 1 comment · Fixed by #36468
Closed
Labels
bug Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Comments

@faec
Copy link
Contributor

faec commented Apr 21, 2023

The fingerprint.String function here:

func (p *fingerprint) String() string {
	json, _ := json.Marshal(p.config)
	return procName + "=" + string(json)
}

calls json.Marshal on a config struct that includes the field Method hashMethod, with the definition type hashMethod func() hash.Hash. Marshalling function references isn't supported and will probably behave in unexpected/undesirable ways. In fingerprint/hash.go there is a lookup table mapping strings to hashMethods, and this string form is probably what is intended, so either the Marshal call should be changed or the Config struct should use a more marshal-friendly wrapper for its hash method.

@faec faec added bug Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team labels Apr 21, 2023
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants