Skip to content

Commit 596729f

Browse files
authored
fix: handle duplicate parameters in request parameters (#148)
- upgrade SonarAnalyzer.CSharp to address security vulnerability
1 parent e491c53 commit 596729f

File tree

6 files changed

+7
-5
lines changed

6 files changed

+7
-5
lines changed

APIMatic.Core.Test/APIMatic.Core.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<PrivateAssets>all</PrivateAssets>
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1414
</PackageReference>
15-
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.51.0.59060">
15+
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.0.0.0000" >
1616
<PrivateAssets>all</PrivateAssets>
1717
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1818
</PackageReference>

APIMatic.Core.Test/Http/HttpClientWrapperSSLTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public async Task TestHttpClientSkipSSLCertificateVerification_OKResponse()
6565
// Act
6666
var actual = await client.ExecuteAsync(request);
6767

68-
Assert.AreEqual(actual.StatusCode, (int)HttpStatusCode.OK);
68+
Assert.AreEqual((int)HttpStatusCode.OK, actual.StatusCode);
6969
}
7070
}
7171
}

APIMatic.Core.Test/MockTypes/Convertors/UnixDateTimeConverter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ namespace APIMatic.Core.Test.MockTypes.Convertors
55
/// <summary>
66
/// Extends from DateTimeConverterBase, uses unix DateTime format.
77
/// </summary>
8+
#pragma warning disable S2094
89
public class UnixDateTimeConverter : CoreUnixDateTimeConverter { }
10+
#pragma warning restore S2094
911
}

APIMatic.Core/APIMatic.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<PrivateAssets>all</PrivateAssets>
4040
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
4141
</PackageReference>
42-
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.55.0.65544">
42+
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.0.0.0000" >
4343
<PrivateAssets>all</PrivateAssets>
4444
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
4545
</PackageReference>

APIMatic.Core/Request/Parameters/Parameter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public abstract class Parameter
2222

2323
private string GetName() => key == "" ? typeName : key;
2424

25-
private string IdentifierKey => string.IsNullOrEmpty(key) ? $"_{nameof(Parameter)}_{Guid.NewGuid()}" : key;
25+
private string IdentifierKey => string.IsNullOrEmpty(key) ? $"_{typeName}_{Guid.NewGuid()}" : $"_{typeName}_{key}";
2626

2727
public Parameter Setup(string key, object value)
2828
{

APIMatic.Core/Utilities/CoreHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ internal static bool TryGetInnerValueForContainer(object value, out dynamic inne
262262
var valueType = value?.GetType();
263263
if (valueType?.Namespace?.EndsWith(".Containers") == true)
264264
{
265-
innerValue = valueType.GetFields()[0].GetValue(value);
265+
innerValue = valueType?.GetFields()[0].GetValue(value);
266266
return true;
267267
}
268268
innerValue = null;

0 commit comments

Comments
 (0)