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

[ASM] Update Iast Log Warning to Error #6492

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class MongoDatabaseAspect
}
catch (global::System.Exception ex)
{
IastModule.Log.Warning(ex, $"Error invoking {nameof(MongoDatabaseAspect)}.{nameof(AnalyzeCommand)}");
IastModule.Log.Error(ex, $"Error invoking {nameof(MongoDatabaseAspect)}.{nameof(AnalyzeCommand)}");
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather add a LogAspectException function in the IastModule and call it, so if we want to change the functionality in the future we will only have to touch that function instead of all call sites

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, it can ensure no Error flooding happens, sending only one of each

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea, I'll do it in another PR 😄

return command;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static NewtonsoftJsonAspects()
}
catch (Exception ex)
{
IastModule.Log.Warning(ex, "Error while tainting the JObject");
IastModule.Log.Error(ex, "Error while tainting the JObject");
}

return result;
Expand Down Expand Up @@ -113,7 +113,7 @@ static NewtonsoftJsonAspects()
}
catch (Exception ex)
{
IastModule.Log.Warning(ex, "Error while tainting the JArray");
IastModule.Log.Error(ex, "Error while tainting the JArray");
}

return result;
Expand All @@ -136,7 +136,7 @@ static NewtonsoftJsonAspects()
}
catch (Exception ex)
{
IastModule.Log.Warning(ex, "Error while tainting the JToken");
IastModule.Log.Error(ex, "Error while tainting the JToken");
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static void AppendFormatted1(ref DefaultInterpolatedStringHandler target,
}
catch (Exception ex)
{
IastModule.Log.Warning(ex, $"Error invoking {nameof(DefaultInterpolatedStringHandlerAspect)}.{nameof(AppendFormatted1)}");
IastModule.Log.Error(ex, $"Error invoking {nameof(DefaultInterpolatedStringHandlerAspect)}.{nameof(AppendFormatted1)}");
}
}

Expand All @@ -59,7 +59,7 @@ public static void AppendFormatted2(ref DefaultInterpolatedStringHandler target,
}
catch (Exception ex)
{
IastModule.Log.Warning(ex, $"Error invoking {nameof(DefaultInterpolatedStringHandlerAspect)}.{nameof(AppendFormatted2)}");
IastModule.Log.Error(ex, $"Error invoking {nameof(DefaultInterpolatedStringHandlerAspect)}.{nameof(AppendFormatted2)}");
}
}

Expand All @@ -83,7 +83,7 @@ public static void AppendFormatted3(ref DefaultInterpolatedStringHandler target,
}
catch (Exception ex)
{
IastModule.Log.Warning(ex, $"Error invoking {nameof(DefaultInterpolatedStringHandlerAspect)}.{nameof(AppendFormatted3)}");
IastModule.Log.Error(ex, $"Error invoking {nameof(DefaultInterpolatedStringHandlerAspect)}.{nameof(AppendFormatted3)}");
}
}

Expand All @@ -106,7 +106,7 @@ public static void AppendFormatted4<T>(ref DefaultInterpolatedStringHandler targ
}
catch (Exception ex)
{
IastModule.Log.Warning(ex, $"Error invoking {nameof(DefaultInterpolatedStringHandlerAspect)}.{nameof(AppendFormatted4)}");
IastModule.Log.Error(ex, $"Error invoking {nameof(DefaultInterpolatedStringHandlerAspect)}.{nameof(AppendFormatted4)}");
}
}

Expand All @@ -130,7 +130,7 @@ public static void AppendFormatted5<T>(ref DefaultInterpolatedStringHandler targ
}
catch (Exception ex)
{
IastModule.Log.Warning(ex, $"Error invoking {nameof(DefaultInterpolatedStringHandlerAspect)}.{nameof(AppendFormatted5)}");
IastModule.Log.Error(ex, $"Error invoking {nameof(DefaultInterpolatedStringHandlerAspect)}.{nameof(AppendFormatted5)}");
}
}

Expand All @@ -154,7 +154,7 @@ public static void AppendFormatted6<T>(ref DefaultInterpolatedStringHandler targ
}
catch (Exception ex)
{
IastModule.Log.Warning(ex, $"Error invoking {nameof(DefaultInterpolatedStringHandlerAspect)}.{nameof(AppendFormatted6)}");
IastModule.Log.Error(ex, $"Error invoking {nameof(DefaultInterpolatedStringHandlerAspect)}.{nameof(AppendFormatted6)}");
}
}

Expand All @@ -179,7 +179,7 @@ public static void AppendFormatted7<T>(ref DefaultInterpolatedStringHandler targ
}
catch (Exception ex)
{
IastModule.Log.Warning(ex, $"Error invoking {nameof(DefaultInterpolatedStringHandlerAspect)}.{nameof(AppendFormatted7)}");
IastModule.Log.Error(ex, $"Error invoking {nameof(DefaultInterpolatedStringHandlerAspect)}.{nameof(AppendFormatted7)}");
}
}

Expand All @@ -198,7 +198,7 @@ public static void AppendLiteral(ref DefaultInterpolatedStringHandler target, st
}
catch (Exception ex)
{
IastModule.Log.Warning(ex, $"Error invoking {nameof(DefaultInterpolatedStringHandlerAspect)}.{nameof(AppendLiteral)}");
IastModule.Log.Error(ex, $"Error invoking {nameof(DefaultInterpolatedStringHandlerAspect)}.{nameof(AppendLiteral)}");
}
}

Expand All @@ -217,7 +217,7 @@ public static string ToStringAndClear(ref DefaultInterpolatedStringHandler targe
}
catch (Exception ex)
{
IastModule.Log.Warning(ex, $"Error invoking {nameof(DefaultInterpolatedStringHandlerAspect)}.{nameof(ToStringAndClear)}");
IastModule.Log.Error(ex, $"Error invoking {nameof(DefaultInterpolatedStringHandlerAspect)}.{nameof(ToStringAndClear)}");
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static object Parse(string json, JsonDocumentOptions options)
}
catch (Exception ex)
{
IastModule.Log.Warning(ex, "Error tainting JsonDocument.Parse result");
IastModule.Log.Error(ex, "Error tainting JsonDocument.Parse result");
}

return doc;
Expand All @@ -60,7 +60,7 @@ public static object Parse(string json, JsonDocumentOptions options)
}
catch (Exception ex)
{
IastModule.Log.Warning(ex, "Error casting to IJsonElement");
IastModule.Log.Error(ex, "Error casting to IJsonElement");
return null;
}

Expand All @@ -77,7 +77,7 @@ public static object Parse(string json, JsonDocumentOptions options)
}
catch (Exception ex)
{
IastModule.Log.Warning(ex, "Error tainting JsonElement.GetString result");
IastModule.Log.Error(ex, "Error tainting JsonElement.GetString result");
}

return str;
Expand All @@ -101,7 +101,7 @@ public static object Parse(string json, JsonDocumentOptions options)
}
catch (Exception ex)
{
IastModule.Log.Warning(ex, "Error casting to IJsonElement");
IastModule.Log.Error(ex, "Error casting to IJsonElement");
return null;
}

Expand All @@ -118,7 +118,7 @@ public static object Parse(string json, JsonDocumentOptions options)
}
catch (Exception ex)
{
IastModule.Log.Warning(ex, "Error tainting JsonElement.GetRawText result");
IastModule.Log.Error(ex, "Error tainting JsonElement.GetRawText result");
}

return str;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class JavaScriptSerializerAspects
}
catch (Exception ex)
{
IastModule.Log.Warning(ex, "Error while tainting json in DeserializeObject");
IastModule.Log.Error(ex, "Error while tainting json in DeserializeObject");
}

return result;
Expand Down
Loading