runner icon indicating copy to clipboard operation
runner copied to clipboard

Drop '(' and ')' from OS.Description so OS.Description doesn't fail User-Agent validation when it contains mismatched brackets

Open fhammerl opened this issue 3 years ago • 0 comments

Closes https://github.com/actions/runner/issues/2165

Bug

Linux Liquorix has an OS description that contains mismatched brackets, so the constructor of ProductInfoHeaderValue throws.

Solution

Drop all () to prevent nested UserAgent comments I don't know of other chars that would need to be sanitized.

Context

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent

We use dotnet's OSDescription to get a string that we then include in our UserAgent header as a ProductInfoHeaderValue.

The constructor of ProductInfoHeaderValue validates if a string is compliant with UserAgent formatting. There aren't many requirements, but one of them is matching brackets -> () Brackets represent a comment in a UserAgent.

fhammerl avatar Nov 30 '22 13:11 fhammerl