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

DeviceCode: Send engflow_auth version in requests #35

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

minor-fixes
Copy link
Contributor

@minor-fixes minor-fixes commented Aug 19, 2024

This change modifies the HTTP client used by the DeviceCode Authenticator implementation to send version information in each request.

The version info is sent in the User-Agent header, using the format:

engflow_auth/vX.Y.Z

The version string is generated by the buildstamp library and is a semver string in a release binary, or a "pseudoversion" in a dev binary, similar go Go module pseudoversions.

Tested:

  • Added unit tests
  • bazel run //cmd/engflow_auth against dev cluster fails (no buildstamp info)
  • bazel run --stamp //cmd/engflow_auth against dev cluster succeeds

Bug: linear/CUS-387

@minor-fixes minor-fixes force-pushed the scott/CUS-387 branch 2 times, most recently from ec9e18f to ce2c427 Compare August 19, 2024 19:21
}

func (t *HeaderInsertingTransport) RoundTrip(req *http.Request) (*http.Response, error) {
for k := range t.Headers {
Copy link
Contributor

Choose a reason for hiding this comment

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

Call req.Clone(req.Context()) and modify that. http.RoundTripper is not supposed to modify the original request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! Good to know - thanks

This change modifies the HTTP client used by the `DeviceCode`
Authenticator implementation to send version information in each
request.

The version info is sent in the `User-Agent` header, using the format:

    engflow_auth/vX.Y.Z

The version string is generated by the `buildstamp` library and is a
semver string in a release binary, or a "pseudoversion" in a dev binary,
similar go Go module pseudoversions.

Tested: Added unit tests
Bug: linear/CUS-387
@minor-fixes
Copy link
Contributor Author

@minor-fixes minor-fixes merged commit 8a6abfe into scott/auth_interface Aug 20, 2024
5 checks passed
@minor-fixes minor-fixes deleted the scott/CUS-387 branch August 20, 2024 20:37
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

Successfully merging this pull request may close these issues.

2 participants