Skip to content

Commit 999d47f

Browse files
Fix vulnerable dependencies
1 parent f855f5a commit 999d47f

File tree

7 files changed

+19
-36
lines changed

7 files changed

+19
-36
lines changed

CloudinaryDotNet.IntegrationTests/CloudinaryDotNet.IntegrationTests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net452;net7.0</TargetFrameworks>
4+
<TargetFrameworks>net452;net8.0</TargetFrameworks>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
@@ -16,7 +16,7 @@
1616
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
1717
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
1818
<PackageReference Include="Moq" Version="4.16.1" />
19-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.2" />
19+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
2020
<PackageReference Include="NUnit" Version="3.13.3" />
2121
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
2222
</ItemGroup>

CloudinaryDotNet.Tests/CloudinaryDotNet.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net452;net7.0</TargetFrameworks>
4+
<TargetFrameworks>net452;net8.0</TargetFrameworks>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
@@ -15,7 +15,7 @@
1515
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
1616
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
1717
<PackageReference Include="Moq" Version="4.16.1" />
18-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.2" />
18+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
1919
<PackageReference Include="NUnit" Version="3.13.3" />
2020
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
2121

CloudinaryDotNet.Tests/Transformations/Image/ImageTransformationTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void TestOverlayHelpers()
9898
{
9999
var expected = layerTest.Value;
100100
var actual = layerTest.Key.ToString();
101-
Assert.IsTrue(expected.Equals(actual, StringComparison.CurrentCultureIgnoreCase));
101+
StringAssert.AreEqualIgnoringCase(expected, actual);
102102
}
103103
}
104104

CloudinaryDotNet/ApiShared.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ public Url ApiUrlVideoUpV
391391
public static string GetCloudinaryParam<T>(T e)
392392
{
393393
Type eType = typeof(T);
394-
FieldInfo fi = eType.GetField(e.ToString());
394+
FieldInfo fi = eType.GetRuntimeField(e.ToString());
395395
EnumMemberAttribute[] attrs = (EnumMemberAttribute[])fi.GetCustomAttributes(
396396
typeof(EnumMemberAttribute), false);
397397

@@ -412,7 +412,7 @@ public static string GetCloudinaryParam<T>(T e)
412412
public static T ParseCloudinaryParam<T>(string s)
413413
{
414414
Type eType = typeof(T);
415-
foreach (var fi in eType.GetFields())
415+
foreach (var fi in eType.GetRuntimeFields())
416416
{
417417
EnumMemberAttribute[] attrs = (EnumMemberAttribute[])fi.GetCustomAttributes(
418418
typeof(EnumMemberAttribute), false);

CloudinaryDotNet/CloudinaryDotNet.csproj

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<Description>Official client library for easily integrating with the Cloudinary service</Description>
1616
<PackageTags>Image Video Responsive Web Utility CDN Performance Resize Crop Rotate Quality Watermark Gif Jpg Jpeg Bitmap PNG Tiff Webp Webm mp4 avi Filter Effect</PackageTags>
1717
<PackageLicenseExpression>MIT</PackageLicenseExpression>
18-
<PackageProjectUrl>http://cloudinary.com</PackageProjectUrl>
18+
<PackageProjectUrl>https://cloudinary.com</PackageProjectUrl>
1919
<PackageReadmeFile>.\README.md</PackageReadmeFile>
2020
<PackageIcon>.\CloudinaryIcon.png</PackageIcon>
2121
<RepositoryUrl>https://github.com/cloudinary/CloudinaryDotNet/</RepositoryUrl>
@@ -26,47 +26,26 @@
2626
<GenerateDocumentationFile>true</GenerateDocumentationFile>
2727
</PropertyGroup>
2828
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
29-
<OutputPath></OutputPath>
3029
<DebugType>none</DebugType>
3130
<DebugSymbols>False</DebugSymbols>
3231
<DefineConstants>TRACE</DefineConstants>
3332
</PropertyGroup>
3433
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
3534
<DefineConstants>TRACE;DEBUG;NETSTANDARD1_0</DefineConstants>
36-
<OutputPath></OutputPath>
3735
</PropertyGroup>
3836
<PropertyGroup Condition=" '$(Sign)' == 'true' ">
3937
<SignAssembly>true</SignAssembly>
4038
<AssemblyOriginatorKeyFile>..\CloudinaryDotNet.snk</AssemblyOriginatorKeyFile>
4139
<DefineConstants>SIGN_ASSEMBLY</DefineConstants>
4240
</PropertyGroup>
4341
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
44-
<Reference Include="System.Net.Http" />
4542
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
46-
<PackageReference Include="System.Text.Encodings.Web" Version="4.5.1" />
47-
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
48-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
49-
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
5043
</ItemGroup>
51-
<ItemGroup Condition=" $(TargetFramework.StartsWith('netstandard1.')) ">
52-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
53-
<PackageReference Include="System.Text.Encodings.Web" Version="4.5.1" />
44+
<ItemGroup>
45+
<PackageReference Include="System.Net.Http" Version="4.3.4" />
5446
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
55-
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="1.0.3" />
56-
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="1.0.3" />
57-
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
58-
</ItemGroup>
59-
<ItemGroup Condition=" $(TargetFramework.StartsWith('netstandard2.')) ">
6047
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
61-
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="2.2.0" />
62-
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
6348
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
64-
</ItemGroup>
65-
<ItemGroup>
66-
<None Include=".\CloudinaryIcon.png" Pack="true" PackagePath="\" />
67-
<None Include="..\README.md" Pack="true" PackagePath="\" />
68-
</ItemGroup>
69-
<ItemGroup>
7049
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.2">
7150
<PrivateAssets>all</PrivateAssets>
7251
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@@ -75,6 +54,9 @@
7554
<PrivateAssets>all</PrivateAssets>
7655
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
7756
</PackageReference>
78-
<PackageReference Include="System.Net.Http" Version="4.3.4" />
57+
</ItemGroup>
58+
<ItemGroup>
59+
<None Include=".\CloudinaryIcon.png" Pack="true" PackagePath="\" />
60+
<None Include="..\README.md" Pack="true" PackagePath="\" />
7961
</ItemGroup>
8062
</Project>

CloudinaryDotNet/Url.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Globalization;
77
using System.Linq;
88
using System.Text;
9-
using System.Text.Encodings.Web;
109
using System.Text.RegularExpressions;
1110

1211
/// <summary>
@@ -1277,7 +1276,7 @@ private CSource UpdateSource(string source)
12771276
}
12781277
else
12791278
{
1280-
var targetSource = isSignedAndUnicode ? UrlEncoder.Default.Encode(source) : source;
1279+
var targetSource = isSignedAndUnicode ? Utils.Encode(source) : source;
12811280

12821281
src = new CSource(Encode(Decode(targetSource)));
12831282

CloudinaryDotNet/Utils.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
using System.Globalization;
77
using System.Linq;
88
using System.Linq.Expressions;
9+
using System.Net;
910
using System.Security.Cryptography;
1011
using System.Text;
11-
using System.Text.Encodings.Web;
1212
using System.Text.RegularExpressions;
1313

1414
/// <summary>
@@ -78,7 +78,9 @@ internal static bool IsRemoteFile(string filePath)
7878
/// <returns>Encoded string.</returns>
7979
internal static string Encode(string value)
8080
{
81-
return UrlEncoder.Default.Encode(value);
81+
// Convert to lowercase hex for backwards compatibility.
82+
var reg = new Regex(@"%[A-F0-9]{2}");
83+
return reg.Replace(Uri.EscapeDataString(value), m => m.Value.ToLowerInvariant());
8284
}
8385

8486
/// <summary>

0 commit comments

Comments
 (0)