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

User Agent Header not Set #1295

Closed
RedlineTriad opened this issue Jul 29, 2022 · 1 comment · Fixed by #1423
Closed

User Agent Header not Set #1295

RedlineTriad opened this issue Jul 29, 2022 · 1 comment · Fixed by #1423
Assignees
Milestone

Comments

@RedlineTriad
Copy link

The following line of code is wrong:

client.DefaultRequestHeaders.Add(HttpRequestHeader.UserAgent.ToString(), $"ScannerMSBuild/{Utilities.ScannerVersion}");

HttpRequestHeader.UserAgent.ToString()

returns UserAgent the name of the enum variant.

However, the correct value of the header is User-Agent as seen here:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent

This causes reverse proxies and other logic that cares about this value (such as different auth flows for scanners than users) to break.
And is very annoying to debug because it's such a small error.

@andrei-epure-sonarsource andrei-epure-sonarsource added this to To do in S4NET Kanban via automation Aug 9, 2022
@pavel-mikula-sonarsource pavel-mikula-sonarsource moved this from To do to In progress in S4NET Kanban Nov 30, 2022
This was referenced Nov 30, 2022
@github-actions github-actions bot moved this from In progress to Review in progress in S4NET Kanban Nov 30, 2022
@github-actions github-actions bot moved this from Review in progress to Reviewer approved in S4NET Kanban Dec 1, 2022
S4NET Kanban automation moved this from Reviewer approved to Done Dec 1, 2022
@pavel-mikula-sonarsource pavel-mikula-sonarsource added this to the 5.9.0 milestone Dec 1, 2022
@pavel-mikula-sonarsource
Copy link
Contributor

The new user-agent header contains rebranded version of the string SonarScanner-for-.NET/<version>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
S4NET Kanban
  
Done
Development

Successfully merging a pull request may close this issue.

4 participants