diff --git a/.buildkite/pipeline.full.yml b/.buildkite/pipeline.full.yml index 78310a520..0669c7f46 100644 --- a/.buildkite/pipeline.full.yml +++ b/.buildkite/pipeline.full.yml @@ -2,7 +2,7 @@ aliases: - &2020 "2020.3.48f1" - &2021 "2021.3.36f1" - &2022 "2022.3.22f1" - - &2023 "2023.2.17f1" + - &2023 "2023.2.19f1" agents: @@ -186,8 +186,6 @@ steps: - label: Run WebGL e2e tests for Unity 2020 timeout_in_minutes: 30 depends_on: "cocoa-webgl-2020-fixtures" - agents: - queue: opensource-mac-cocoa-11 env: UNITY_VERSION: *2020 plugins: @@ -221,8 +219,6 @@ steps: - label: Run WebGL e2e tests for Unity 2022 timeout_in_minutes: 30 depends_on: 'cocoa-webgl-2022-fixtures' - agents: - queue: opensource-mac-cocoa-11 env: UNITY_VERSION: *2022 plugins: @@ -238,8 +234,6 @@ steps: - label: Run WebGL e2e tests for Unity 2023 timeout_in_minutes: 30 depends_on: 'cocoa-webgl-2023-fixtures' - agents: - queue: opensource-mac-cocoa-11 env: UNITY_VERSION: *2023 plugins: diff --git a/CHANGELOG.md b/CHANGELOG.md index 2876d0c1a..f55e525f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,19 @@ # Changelog -### TBD +## TBD () + +### Enhancements + +- Added the `Bugsnag-Integrity` header to outgoing Bugsnag requests. [#797](https://github.com/bugsnag/bugsnag-unity/pull/797) + +### Bug Fixes - Added more null reference checking to the Bugsnag client to prevent crashes when accessing the client before it has been initialised [#788](https://github.com/bugsnag/bugsnag-unity/pull/788) +## 7.7.6 (2024-05-17) + +- Fixed issue where meta files for the MacOS bundle were not generated. [#802](https://github.com/bugsnag/bugsnag-unity/pull/802) + ## 7.7.5 (2024-05-02) ### Bug Fixes diff --git a/build.cake b/build.cake index 327ccfa42..f85a1a27f 100644 --- a/build.cake +++ b/build.cake @@ -5,7 +5,7 @@ var target = Argument("target", "Default"); var solution = File("./BugsnagUnity.sln"); var configuration = Argument("configuration", "Release"); var project = File("./src/BugsnagUnity/BugsnagUnity.csproj"); -var version = "7.7.5"; +var version = "7.7.6"; Task("Restore-NuGet-Packages") .Does(() => NuGetRestore(solution)); diff --git a/features/fixtures/maze_runner/Assets/Scripts/Scenario.cs b/features/fixtures/maze_runner/Assets/Scripts/Scenario.cs index cb70f5e41..f124b5a58 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Scenario.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Scenario.cs @@ -38,6 +38,10 @@ public virtual void PrepareConfig(string apiKey, string host) Configuration.DotnetScriptingRuntime = FindDotnetScriptingRuntime(); Configuration.DotnetApiCompatibility = FindDotnetApiCompatibility(); Configuration.AutoTrackSessions = false; + if (Application.platform == RuntimePlatform.IPhonePlayer) + { + Configuration.EnabledErrorTypes.OOMs = false; + } } public void AddSwitchConfigValues(SwitchCacheType switchCacheType, int switchCacheIndex, string switchMountName) diff --git a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/CorruptedCacheFile.cs b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/CorruptedCacheFile.cs index 3f5df4a53..161f20241 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/CorruptedCacheFile.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/CorruptedCacheFile.cs @@ -9,10 +9,6 @@ public class CorruptedCacheFile : Scenario public override void PrepareConfig(string apiKey, string host) { base.PrepareConfig(apiKey, host); - if (Application.platform == RuntimePlatform.IPhonePlayer) - { - Configuration.EnabledErrorTypes.OOMs = false; - } } public override void Run() diff --git a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/MaxPersistEvents.cs b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/MaxPersistEvents.cs index 9023134f6..6e744c32a 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/MaxPersistEvents.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/MaxPersistEvents.cs @@ -9,10 +9,6 @@ public override void PrepareConfig(string apiKey, string host) { base.PrepareConfig(apiKey, host); Configuration.MaxPersistedEvents = 3; - if (Application.platform == RuntimePlatform.IPhonePlayer) - { - Configuration.EnabledErrorTypes.OOMs = false; - } } public override void Run() diff --git a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistDeviceId.cs b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistDeviceId.cs index 49fc9f75a..fe3bdb812 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistDeviceId.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistDeviceId.cs @@ -5,10 +5,6 @@ public class PersistDeviceId : Scenario public override void PrepareConfig(string apiKey, string host) { base.PrepareConfig(apiKey, host); - if (Application.platform == RuntimePlatform.IPhonePlayer) - { - Configuration.EnabledErrorTypes.OOMs = false; - } } public override void Run() diff --git a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEvent.cs b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEvent.cs index 039d3c9b9..02f553ed8 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEvent.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEvent.cs @@ -6,10 +6,6 @@ public override void PrepareConfig(string apiKey, string host) { base.PrepareConfig(apiKey, host); Configuration.Context = "Error 1"; - if (Application.platform == RuntimePlatform.IPhonePlayer) - { - Configuration.EnabledErrorTypes.OOMs = false; - } } public override void Run() diff --git a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEventReport.cs b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEventReport.cs index 8f7206ce3..b55201d45 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEventReport.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEventReport.cs @@ -6,10 +6,6 @@ public override void PrepareConfig(string apiKey, string host) { base.PrepareConfig(apiKey, host); Configuration.Context = "Error 2"; - if (Application.platform == RuntimePlatform.IPhonePlayer) - { - Configuration.EnabledErrorTypes.OOMs = false; - } } public override void Run() diff --git a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEventReportCallback.cs b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEventReportCallback.cs index 1764b9297..cc7397822 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEventReportCallback.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEventReportCallback.cs @@ -26,10 +26,6 @@ public override void PrepareConfig(string apiKey, string host) return true; }); - if (Application.platform == RuntimePlatform.IPhonePlayer) - { - Configuration.EnabledErrorTypes.OOMs = false; - } } public override void Run() diff --git a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/ReportMaxPersistedEvents.cs b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/ReportMaxPersistedEvents.cs index 7a22bdbda..474a28579 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/ReportMaxPersistedEvents.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/ReportMaxPersistedEvents.cs @@ -10,10 +10,6 @@ public override void PrepareConfig(string apiKey, string host) { _eventsCorrect = CheckForEvents(); base.PrepareConfig(apiKey, host); - if (Application.platform == RuntimePlatform.IPhonePlayer) - { - Configuration.EnabledErrorTypes.OOMs = false; - } } private bool CheckForEvents() diff --git a/features/ios/ios_native_errors.feature b/features/ios/ios_native_errors.feature index 9d6ed2a8e..1a1ebd2fc 100644 --- a/features/ios/ios_native_errors.feature +++ b/features/ios/ios_native_errors.feature @@ -8,8 +8,7 @@ Feature: iOS Native Errors And I wait for 2 seconds And On Mobile I relaunch the app And I run the game in the "StartSDKDefault" state - And I wait to receive an error - And the exception "message" equals "The app was likely terminated by the operating system while in the foreground" + And I should receive no errors Scenario: Last Run Info When I run the game in the "IosNativeException" state diff --git a/features/support/env.rb b/features/support/env.rb index 7f55fd1b7..dc450ff05 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -64,8 +64,6 @@ BeforeAll do $api_key = 'a35a2a72bd230ac0aa0f52715bbdc6aa' - Maze.config.enforce_bugsnag_integrity = false - if Maze.config.os&.downcase == 'macos' # The default macOS Crash Reporter "#{app_name} quit unexpectedly" alert grabs focus which can cause tests to flake. # This option, which appears to have been introduced in macOS 10.11, displays a notification instead of the alert. @@ -113,6 +111,14 @@ end end +Before do |scenario| + # Detect if we're running the webgl tests + if Maze.config.farm.to_s.eql?('local') + # Allows each scenario to auto retry once due to instability in the local browser + scenario.tags << Cucumber::Core::Test::Tag.new(nil, '@retry') + end +end + After do |scenario| next if scenario.status == :skipped diff --git a/src/BugsnagUnity/Delivery.cs b/src/BugsnagUnity/Delivery.cs index 2057f387f..55b8601fd 100644 --- a/src/BugsnagUnity/Delivery.cs +++ b/src/BugsnagUnity/Delivery.cs @@ -9,6 +9,7 @@ using BugsnagUnity.Payload; using UnityEngine; using UnityEngine.Networking; +using System.Security.Cryptography; namespace BugsnagUnity { @@ -187,6 +188,8 @@ IEnumerator PushToServer(IPayload payload) { req.SetRequestHeader("Content-Type", "application/json"); req.SetRequestHeader("Bugsnag-Sent-At", DateTimeOffset.Now.ToString("o", CultureInfo.InvariantCulture)); + req.SetRequestHeader("Bugsnag-Integrity", "sha1 " + Hash(body)); + foreach (var header in payload.Headers) { req.SetRequestHeader(header.Key, header.Value); @@ -278,6 +281,20 @@ private byte[] PrepareEventBodySimple(IPayload payload) return serialisedPayload; } + private string Hash(byte[] input) + { + using (SHA1Managed sha1 = new SHA1Managed()) + { + var hash = sha1.ComputeHash(input); + var sb = new StringBuilder(hash.Length * 2); + foreach (byte b in hash) + { + sb.Append(b.ToString("x2")); + } + return sb.ToString(); + } + } + private bool TruncateBreadcrumbs(Dictionary @event, int bytesToRemove) { var breadcrumbsList = (@event[EVENT_KEY_BREADCRUMBS] as Dictionary[]).ToList(); diff --git a/upm-tools/build-upm-package.sh b/upm-tools/build-upm-package.sh index 521631964..7fa5c334b 100755 --- a/upm-tools/build-upm-package.sh +++ b/upm-tools/build-upm-package.sh @@ -16,13 +16,22 @@ fi VERSION=$1 -if [ -z "$UNITY_VERSION" ] +if [ -z "$UNITY_UPM_VERSION" ] then - echo "UNITY_VERSION must be set" + echo "UNITY_UPM_VERSION must be set" exit 1 fi -UNITY_PATH="/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/MacOS" +#There is a bug in some versions of unity 2020, 2021 and 2022 where macos bundles will not be imported as a single plugin file. +#In which case all sub dirs and files must have .meta files to work with UPM. +#Building the UPM package with unity 2019 ensures that the meta files are created + +if [[ "$UNITY_UPM_VERSION" != *"2019"* ]]; then + echo "ERROR: UNITY_UPM_VERSION must be a version of Unity 2019. See script comments for details." + exit 1 +fi + +UNITY_PATH="/Applications/Unity/Hub/Editor/$UNITY_UPM_VERSION/Unity.app/Contents/MacOS" @@ -72,4 +81,4 @@ sed -i '' "s/VERSION_STRING/$VERSION/g" "$PACKAGE_DIR/package.json" sed -i '' "s/VERSION_STRING/v$VERSION/g" "$PACKAGE_DIR/README.md" -echo "complete, ready to deploy" +echo "complete, ready to deploy" \ No newline at end of file