Skip to content

Commit 745922b

Browse files
authored
Added ShellTasksValidation audit action data to issues (#4756)
* Add ShellTasksValidation audit action data to issues * Add validation for issues by knob * Remove knob
1 parent b74907b commit 745922b

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/Agent.Worker/Handlers/ProcessHandler/ProcessHandlerHelper.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.Collections.Generic;
66
using Agent.Sdk.Knob;
7+
using Microsoft.TeamFoundation.DistributedTask.WebApi;
78
using Microsoft.VisualStudio.Services.Agent.Util;
89
using Microsoft.VisualStudio.Services.Common;
910

@@ -132,7 +133,13 @@ public static (bool, Dictionary<string, object>) ValidateInputArguments(
132133
{
133134
if (enableAudit && !enableValidation)
134135
{
135-
context.Warning(StringUtil.Loc("ProcessHandlerInvalidScriptArgs"));
136+
var issue = new Issue
137+
{
138+
Type = IssueType.Warning,
139+
Message = StringUtil.Loc("ProcessHandlerInvalidScriptArgs"),
140+
};
141+
issue.Data.Add("auditAction", "1"); // ShellTasksValidation = 1
142+
context.AddIssue(issue);
136143
}
137144
if (enableValidation)
138145
{

src/Agent.Worker/Handlers/ProcessHandler/ProcessHandlerV2.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License.
33

44
using Agent.Sdk.Knob;
5+
using Microsoft.TeamFoundation.DistributedTask.WebApi;
56
using Microsoft.VisualStudio.Services.Agent.Util;
67
using Newtonsoft.Json;
78
using System;
@@ -288,7 +289,13 @@ private void ValidateScriptArgs(
288289

289290
if (!shouldThrow && enableSecureArgumentsAudit)
290291
{
291-
ExecutionContext.Warning(StringUtil.Loc("ProcessHandlerInvalidScriptArgs"));
292+
var issue = new Issue
293+
{
294+
Type = IssueType.Warning,
295+
Message = StringUtil.Loc("ProcessHandlerInvalidScriptArgs"),
296+
};
297+
issue.Data.Add("auditAction", "1"); // ShellTasksValidation = 1
298+
ExecutionContext.AddIssue(issue);
292299
}
293300
}
294301
if (enableTelemetry && telemetry != null)

0 commit comments

Comments
 (0)