Skip to content

Commit 045e954

Browse files
authored
Merge branch 'main' into signing_with_cosign
2 parents 2df4a32 + 9b08508 commit 045e954

File tree

6 files changed

+64
-18
lines changed

6 files changed

+64
-18
lines changed

.github/workflows/stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
close-pr-message: 'Closed as inactive. Feel free to reopen if this PR is still being worked on.'
1919
operations-per-run: 400
2020
days-before-pr-stale: 7
21-
days-before-issue-stale: 600
21+
days-before-issue-stale: 450
2222
days-before-pr-close: 7
2323
days-before-issue-close: 7
2424
exempt-all-issue-milestones: true

Directory.Packages.props

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
<PropertyGroup>
44
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
55
<OTelLatestStableVer>1.9.0</OTelLatestStableVer>
6+
7+
<!-- Mitigate https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-43485. -->
68
<SystemTextEncodingsWebOutOfBandMinimumCoreAppVer>8.0.0</SystemTextEncodingsWebOutOfBandMinimumCoreAppVer>
7-
<SystemTextJsonOutOfBandMinimumCoreAppVer>8.0.4</SystemTextJsonOutOfBandMinimumCoreAppVer>
9+
<SystemTextJsonOutOfBandMinimumCoreAppVer>8.0.5</SystemTextJsonOutOfBandMinimumCoreAppVer>
810
</PropertyGroup>
911

1012
<!--
@@ -59,6 +61,11 @@
5961
</ItemGroup>
6062

6163
<ItemGroup>
64+
<!--
65+
Note: See TargetFrameworksRequiringSystemTextJsonDirectReference for the
66+
list of targets where System.Text.Json direct reference is applied.
67+
-->
68+
6269
<!--
6370
We use conservative versions of these packages for older runtimes where
6471
an upgrade might introduce breaking changes. For example see:
@@ -67,7 +74,7 @@
6774
<PackageVersion Include="System.Text.Encodings.Web" Version="4.7.2" />
6875
<PackageVersion Include="System.Text.Json" Version="4.7.2" />
6976

70-
<!-- Bump System.Text.Json on NETCoreApp targets to mitigate https://github.com/advisories/GHSA-hh2w-p6rv-4g7w. -->
77+
<!-- Newer NETCoreApp runtimes need to be redirected to safe versions. -->
7178
<PackageVersion Update="System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebOutOfBandMinimumCoreAppVer)" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'" />
7279
<PackageVersion Update="System.Text.Json" Version="$(SystemTextJsonOutOfBandMinimumCoreAppVer)" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'" />
7380
</ItemGroup>

src/OpenTelemetry.Exporter.Console/CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ Notes](../../RELEASENOTES.md).
77
## Unreleased
88

99
* Added direct reference to `System.Text.Json` for the `net8.0` target with
10-
minimum version of `8.0.4` in response to
11-
[CVE-2024-30105](https://github.com/advisories/GHSA-hh2w-p6rv-4g7w).
12-
([#5874](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5874))
10+
minimum version of `8.0.5` in response to
11+
[CVE-2024-30105](https://github.com/advisories/GHSA-hh2w-p6rv-4g7w) &
12+
[CVE-2024-43485](https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-43485).
13+
([#5874](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5874),
14+
[#5891](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5891))
1315

1416
## 1.10.0-beta.1
1517

src/OpenTelemetry.Exporter.Zipkin/CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ Notes](../../RELEASENOTES.md).
77
## Unreleased
88

99
* Added direct reference to `System.Text.Json` for the `net8.0` target with
10-
minimum version of `8.0.4` in response to
11-
[CVE-2024-30105](https://github.com/advisories/GHSA-hh2w-p6rv-4g7w).
12-
([#5874](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5874))
10+
minimum version of `8.0.5` in response to
11+
[CVE-2024-30105](https://github.com/advisories/GHSA-hh2w-p6rv-4g7w) &
12+
[CVE-2024-43485](https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-43485).
13+
([#5874](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5874),
14+
[#5891](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5891))
1315

1416
## 1.10.0-beta.1
1517

src/OpenTelemetry/Internal/SelfDiagnosticsConfigParser.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,21 @@ public bool TryGetConfiguration(
6666
this.configBuffer = buffer;
6767
}
6868

69-
// TODO: Fix CA2022 - Avoid inexact read with 'System.IO.FileStream.Read(byte[], int, int)'
70-
// Added _ = as a workaround to suppress the warning
71-
_ = file.Read(buffer, 0, buffer.Length);
72-
string configJson = Encoding.UTF8.GetString(buffer);
69+
int bytesRead = 0;
70+
int totalBytesRead = 0;
71+
72+
while (totalBytesRead < buffer.Length)
73+
{
74+
bytesRead = file.Read(buffer, totalBytesRead, buffer.Length - totalBytesRead);
75+
if (bytesRead == 0)
76+
{
77+
break;
78+
}
79+
80+
totalBytesRead += bytesRead;
81+
}
82+
83+
string configJson = Encoding.UTF8.GetString(buffer, 0, totalBytesRead);
7384

7485
if (!TryParseLogDirectory(configJson, out logDirectory))
7586
{

test/OpenTelemetry.Tests/Internal/SelfDiagnosticsEventListenerTest.cs

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,20 @@ public void SelfDiagnosticsEventListener_EmitEvent_OmitAsConfigured()
125125
using FileStream file = File.Open(LOGFILEPATH, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete);
126126
var buffer = new byte[256];
127127

128-
// Suppress CA2022 error: Avoid inexact read with 'System.IO.FileStream.Read(byte[], int, int)'
129-
_ = file.Read(buffer, 0, buffer.Length);
128+
int bytesRead = 0;
129+
int totalBytesRead = 0;
130+
131+
while (totalBytesRead < buffer.Length)
132+
{
133+
bytesRead = file.Read(buffer, totalBytesRead, buffer.Length - totalBytesRead);
134+
if (bytesRead == 0)
135+
{
136+
break;
137+
}
138+
139+
totalBytesRead += bytesRead;
140+
}
141+
130142
Assert.Equal('\0', (char)buffer[0]);
131143
}
132144

@@ -259,9 +271,21 @@ private static void AssertFileOutput(string filePath, string eventMessage)
259271
using FileStream file = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete);
260272
var buffer = new byte[256];
261273

262-
// Suppress CA2022 error: Avoid inexact read with 'System.IO.FileStream.Read(byte[], int, int)'
263-
_ = file.Read(buffer, 0, buffer.Length);
264-
string logLine = Encoding.UTF8.GetString(buffer);
274+
int bytesRead = 0;
275+
int totalBytesRead = 0;
276+
277+
while (totalBytesRead < buffer.Length)
278+
{
279+
bytesRead = file.Read(buffer, totalBytesRead, buffer.Length - totalBytesRead);
280+
if (bytesRead == 0)
281+
{
282+
break;
283+
}
284+
285+
totalBytesRead += bytesRead;
286+
}
287+
288+
string logLine = Encoding.UTF8.GetString(buffer, 0, totalBytesRead);
265289
string logMessage = ParseLogMessage(logLine);
266290
Assert.StartsWith(eventMessage, logMessage);
267291
}

0 commit comments

Comments
 (0)