Updated validate to fall back to Elastic-Agent-Version header'#6864
Updated validate to fall back to Elastic-Agent-Version header'#6864michalpristas wants to merge 1 commit into
Conversation
|
If this is for agentless, you will need the ECH integrations servers updated before you can rely on this being available which might taken longer than you want. What problem is this solving? Why is the user agent not compatible? |
|
Discussion happening in elastic/elastic-agent#13695 |
| ver, err = version.NewVersion(elasticAgentVersion) | ||
| if err == nil { | ||
| return ver, nil | ||
| } | ||
|
|
||
| return nil, ErrInvalidUserAgent |
There was a problem hiding this comment.
ErrInvalidUserAgent seems overly broad for what this function is checking. Also, that error is being returned from the error checking being done at this function's call site. So maybe this function should just return the raw error at the end?
| ver, err = version.NewVersion(elasticAgentVersion) | |
| if err == nil { | |
| return ver, nil | |
| } | |
| return nil, ErrInvalidUserAgent | |
| // Fallback | |
| return version.NewVersion(elasticAgentVersion) |
| r = r.WithContext(ctx) | ||
|
|
||
| ver, err := validateUserAgent(r.Context(), zlog, userAgent, ct.verCon) | ||
| ver, err := validateUserAgent(r.Context(), zlog, userAgent, r.Header.Get("Elastic-Agent-Version"), ct.verCon) |
There was a problem hiding this comment.
Can we add this into the openapi spec?
|
@michalpristas checking in on this PR - are you waiting on additional reviews? Or are we waiting on another dependency to move this forward? |
|
no i'm thinking whether to ship this or not, the underlying issue was really about integrations, but this may be handy but is not required |
related to elastic/elastic-agent#13695
when uncompatible user agent comes it tries to fallback to version from
Elastic-Agent-Versionheader if present.