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

addBuildTag fails when string contains a colon #1072

Open
pbcahill opened this issue Oct 10, 2024 · 2 comments
Open

addBuildTag fails when string contains a colon #1072

pbcahill opened this issue Oct 10, 2024 · 2 comments

Comments

@pbcahill
Copy link

The addBuildTag function fails if the string being used contains a colon :.

Example: tl.addBuildTag("test:value");

Error returned in pipeline log:
##[error]A potentially dangerous Request.Path value was detected from the client (:).

Seems to be the same bug reported here - https://developercommunity.visualstudio.com/t/Error-when-setting-vsobuildaddbuildt/10163239 - so it is happening with regular script tasks and api calls too.

Debug logs:

##[debug]Add build tag: test:value to build: 1157156 at backend.
##[debug]Processed: ##vso[build.addbuildtag]test:value
##[debug]task result: Succeeded
##[debug]Processed: ##vso[task.complete result=Succeeded;done=true;]
Async Command Start: Add Build Tag
Async Command End: Add Build Tag
##[error]A potentially dangerous Request.Path value was detected from the client (:).
##[debug]Microsoft.VisualStudio.Services.Common.VssServiceException: A potentially dangerous Request.Path value was detected from the client (:).
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponseAsync(HttpResponseMessage response, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync(HttpRequestMessage message, HttpCompletionOption completionOption, Object userState, CancellationToken cancellationToken)
   at Microsoft.TeamFoundation.Build.WebApi.BuildHttpClientCompatBase.SendAsync[T](HttpRequestMessage message, Object userState, CancellationToken cancellationToken, Func`3 processResponse)
   at Microsoft.TeamFoundation.Build.WebApi.BuildHttpClientCompatBase.SendAsync[T](HttpMethod method, IEnumerable`1 additionalHeaders, Guid locationId, Object routeValues, ApiResourceVersion version, HttpContent content, IEnumerable`1 queryParameters, Object userState, CancellationToken cancellationToken, Func`3 processResponse)
   at Microsoft.VisualStudio.Services.Agent.Worker.Build.BuildServer.AddBuildTag(Int32 buildId, Guid projectId, String buildTag, CancellationToken cancellationToken) in D:\a\_work\1\s\src\Agent.Worker\Build\BuildServer.cs:line 120
   at Microsoft.VisualStudio.Services.Agent.Worker.Build.BuildAddBuildTagCommand.AddBuildTagAsync(IAsyncCommandContext context, VssConnection connection, Guid projectId, Int32 buildId, String buildTag, CancellationToken cancellationToken) in D:\a\_work\1\s\src\Agent.Worker\Build\BuildCommandExtension.cs:line 188
   at Microsoft.VisualStudio.Services.Agent.Worker.AsyncCommandContext.WaitAsync() in D:\a\_work\1\s\src\Agent.Worker\AsyncCommandContext.cs:line 130
   at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.RunStepAsync(IStep step, CancellationToken jobCancellationToken) in D:\a\_work\1\s\src\Agent.Worker\StepsRunner.cs:line 305
@ivanduplenskikh
Copy link
Contributor

@pbcahill, thank you for escalating this problem. I've prepared a PR in the agent repository. This PR solves this issue by passing build tags as Body parameter.

@pbcahill
Copy link
Author

pbcahill commented Nov 6, 2024

Ok great thank you @ivanduplenskikh! I will give it a try once the new agent version is available to use.

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

No branches or pull requests

2 participants