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

Fix: Validate PrivacyInfo.xcprivacy and warn users of required missing privacy parameters. #152

Merged
merged 49 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
f77363d
fix break changes
lucas-zimerman Feb 8, 2024
fc75313
update changelog
lucas-zimerman Feb 8, 2024
1c37348
bump andorid api minimum version
lucas-zimerman Feb 8, 2024
0628c32
update readme
lucas-zimerman Feb 8, 2024
55869ac
workflow changes
lucas-zimerman Feb 8, 2024
8de6ecc
test old version
lucas-zimerman Feb 8, 2024
b58f047
wrong action order
lucas-zimerman Feb 8, 2024
bf19359
install java on both machines
lucas-zimerman Feb 8, 2024
aebb0ac
add privacyinfo script
lucas-zimerman Apr 26, 2024
29cc5b6
add changelog
lucas-zimerman Apr 26, 2024
6414254
proper name for the privacy info from the sample
lucas-zimerman Apr 26, 2024
7b74418
code cleanup
lucas-zimerman Apr 29, 2024
39f5a65
add install step for xamarin
lucas-zimerman Apr 29, 2024
da76c5e
correct branch number
lucas-zimerman Apr 29, 2024
5b41df9
remove uwp action
lucas-zimerman Apr 30, 2024
a951b6e
typo install ios on ios step
lucas-zimerman Apr 30, 2024
f659eb5
test
lucas-zimerman Apr 30, 2024
2ea7675
try previous VM
lucas-zimerman Apr 30, 2024
5ea41aa
ignore uwp projects
lucas-zimerman Apr 30, 2024
9382c42
ignore uwp projects
lucas-zimerman Apr 30, 2024
8271055
test
lucas-zimerman Apr 30, 2024
d4b189f
try install xamarin mac from dotnet
lucas-zimerman Apr 30, 2024
6d3813f
remove UWP projects build from AnyCPU
lucas-zimerman Apr 30, 2024
1d49a77
remove dotnet install
lucas-zimerman Apr 30, 2024
4267dc7
add ios
lucas-zimerman Apr 30, 2024
a4fc42d
install new SDK for sample
lucas-zimerman Apr 30, 2024
86e7bb7
test restore x64
lucas-zimerman Apr 30, 2024
1ca14df
Update .gitignore
lucas-zimerman Apr 30, 2024
bb1bf68
Add Xamarin setup for macos
lucas-zimerman Apr 30, 2024
afe0097
test
lucas-zimerman Apr 30, 2024
7cf647f
Check if it is working on macos 13
lucas-zimerman Apr 30, 2024
aef5b25
Create Skip.UWP.MacOs.props
lucas-zimerman Apr 30, 2024
04e1bf9
Update Directory.Build.props
lucas-zimerman Apr 30, 2024
f3dc391
Update build.yaml
lucas-zimerman Apr 30, 2024
5910c4b
manually include builds
lucas-zimerman Apr 30, 2024
3fd6c49
only build uwp on windows
lucas-zimerman Apr 30, 2024
af34131
use full path
lucas-zimerman Apr 30, 2024
7404ae7
dont load scripts on other levels than root
lucas-zimerman Apr 30, 2024
9b17fcf
let all projects know the targets but only run them on the root folder
lucas-zimerman Apr 30, 2024
40c0f80
use same method that sentry dotnet uses for different platforms
lucas-zimerman Apr 30, 2024
3c0e4cd
nit
lucas-zimerman Apr 30, 2024
bfece98
fix format
lucas-zimerman Apr 30, 2024
7c58628
remove another uwp project from macos
lucas-zimerman Apr 30, 2024
152d2c9
remove junk
lucas-zimerman Apr 30, 2024
16efe24
rebase to patch branch
lucas-zimerman Apr 30, 2024
4566779
Update .gitignore
lucas-zimerman Apr 30, 2024
bd55e94
Merge branch 'lucas-zimerman-patch-1' of https://github.com/getsentry…
lucas-zimerman Apr 30, 2024
108f1e0
Merge branch 'feat/xamarin-privacy-info' of https://github.com/getsen…
lucas-zimerman Apr 30, 2024
a1c66ea
add NSPrivacyCollectedDataTypes
lucas-zimerman Apr 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 18 additions & 20 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest]
os: [windows-latest, macos-13]
steps:
- uses: actions/checkout@v4
- uses: microsoft/setup-msbuild@v1.1
Expand All @@ -27,8 +27,21 @@ jobs:
run:
pwsh ./scripts/install-win-sdk.ps1 16299
if: startsWith(matrix.os, 'windows')
- name: Setup Java SDK

# Setup Xamarin SDK that got removed on the latest MacOS VM
- name: Setup Xamarin MacOS SDK
if: startsWith(matrix.os, 'macos')
run: |
brew tap homebrew/cask-versions
brew install --cask xamarin-mac
- name: Setup Xamarin Android SDK
if: startsWith(matrix.os, 'macos')
run: brew install --cask xamarin-android
- name: Setup Xamarin iOS SDK
if: startsWith(matrix.os, 'macos')
run: brew install --cask xamarin-ios

- name: Setup Java SDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
Expand All @@ -40,24 +53,9 @@ jobs:
packages: 'platforms;android-30'

- run: msbuild Sentry.Xamarin.sln -p:Configuration=Release -t:restore

- name: Build Solution with MSBuild
run: msbuild Sentry.Xamarin.sln -p:Configuration=Release
- name: Restore iOS Sample app NuGet
run: msbuild Samples/Sample.Xamarin.iOS/Sample.Xamarin.iOS.csproj -p:Configuration=Release -t:restore
if: startsWith(matrix.os, 'macos')
- name: Build iOS Sample app
run: msbuild Samples/Sample.Xamarin.iOS/Sample.Xamarin.iOS.csproj -p:Configuration=Release
if: startsWith(matrix.os, 'macos')
- name: Build Android Sample app
run: msbuild Samples/Sample.Xamarin.Droid/Sample.Xamarin.Droid.csproj -p:Configuration=Release
if: startsWith(matrix.os, 'windows')
- name: Build UWP Sample app
run: msbuild Samples/Sample.Xamarin.UWP/Sample.Xamarin.UWP.csproj /p:Platform=x64 /p:Configuration=Release
if: startsWith(matrix.os, 'windows')
- name: Build UWP Test Project
run: msbuild Tests/Sentry.Xamarin.Forms.UWP.Tests/Sentry.Xamarin.Forms.UWP.Tests.csproj /p:Platform=x64 /p:Configuration=Release
if: startsWith(matrix.os, 'windows')
- name: Build SDK, Sample and Tests
run: msbuild Sentry.Xamarin-CI-Build-${{ runner.os }}.slnf -p:Configuration=Release

- name: Setup VS Test
uses: darenm/Setup-VSTest@v1
if: startsWith(matrix.os, 'windows')
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -345,4 +345,4 @@ healthchecksdb
/Tests/Sentry.Xamarin.Forms.Tests.UWP/Sentry.Xamarin.Forms.Tests.UWP.GeneratedMSBuildEditorConfig.editorconfig

#Do not include tokens to external sources.
*.sentryclirc
*.sentryclirc
77 changes: 76 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,80 @@
# Changelog

## Unreleased

### Fixes

- Validate PrivacyInfo.xcprivacy and warn users of required missing privacy parameters ([#152](https://github.com/getsentry/sentry-xamarin/pull/152))

Due to a requirement by apple, all Projects will require a ([Privacy Manifest file](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files)). Sentry will automatically patch your project with the required fields by Sentry if no privacy manifest file is provided. Otherwise, it will validate your privacy manifest file for the required fields by Sentry and warn you during the build time if the required keys are present or not when building an iOS project.

Choose a reason for hiding this comment

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

Suggested change
Due to a requirement by apple, all Projects will require a ([Privacy Manifest file](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files)). Sentry will automatically patch your project with the required fields by Sentry if no privacy manifest file is provided. Otherwise, it will validate your privacy manifest file for the required fields by Sentry and warn you during the build time if the required keys are present or not when building an iOS project.
Due to new Apple requirements, all Projects will require a ([Privacy Manifest file](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files)). Sentry will automatically patch your project with the fields required by Sentry, if no privacy manifest file is provided. Otherwise, it will validate your privacy manifest file and warn during the build if the required keys are not when building an iOS project.

Below you can find a snippet of the minimum required privacy manifest required by Sentry Xamarin:

Choose a reason for hiding this comment

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

Suggested change
Below you can find a snippet of the minimum required privacy manifest required by Sentry Xamarin:
Below you can find a snippet of the minimum privacy manifest required by Sentry Xamarin:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyCollectedDataTypes</key>
<array>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypeCrashData</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypePerformanceData</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypeOtherDiagnosticData</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>
</array>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
</array>
</dict>
</array>
</dict>
</plist>
```

## 2.0.0

### Sentry Self-hosted Compatibility
Expand Down Expand Up @@ -411,4 +486,4 @@ Also available via NuGet:

[Sentry](https://www.nuget.org/packages/Sentry/)
[Sentry.Xamarin](https://www.nuget.org/packages/Sentry.Xamarin)
[Sentry.Xamarin.Forms](https://www.nuget.org/packages/Sentry.Xamarin.Forms)
[Sentry.Xamarin.Forms](https://www.nuget.org/packages/Sentry.Xamarin.Forms)
1 change: 1 addition & 0 deletions Samples/Sample.Xamarin.Core/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<!--Automatic upward search ends when first file found. From here we need to manually import parent props/targets
https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build -->
<Import Project="..\..\Directory.Build.props" />
<Import Project="..\..\Src\Sentry.Xamarin\buildTransitive\Sentry.Xamarin.targets" />

</Project>
1 change: 1 addition & 0 deletions Samples/Sample.Xamarin.Droid/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<!--Automatic upward search ends when first file found. From here we need to manually import parent props/targets
https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build -->
<Import Project="..\..\Directory.Build.props" />
<Import Project="..\..\Src\Sentry.Xamarin\buildTransitive\Sentry.Xamarin.targets" />

</Project>
1 change: 1 addition & 0 deletions Samples/Sample.Xamarin.Mac/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<!--Automatic upward search ends when first file found. From here we need to manually import parent props/targets
https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build -->
<Import Project="..\..\Directory.Build.props" />
<Import Project="..\..\Src\Sentry.Xamarin\buildTransitive\Sentry.Xamarin.targets" />

</Project>
1 change: 1 addition & 0 deletions Samples/Sample.Xamarin.UWP/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<!--Automatic upward search ends when first file found. From here we need to manually import parent props/targets
https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build -->
<Import Project="..\..\Directory.Build.props" />
<Import Project="..\..\Src\Sentry.Xamarin\buildTransitive\Sentry.Xamarin.targets" />

</Project>
1 change: 1 addition & 0 deletions Samples/Sample.Xamarin.iOS/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<!--Automatic upward search ends when first file found. From here we need to manually import parent props/targets
https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build -->
<Import Project="..\..\Directory.Build.props" />
<Import Project="..\..\Src\Sentry.Xamarin\buildTransitive\Sentry.Xamarin.targets" />

</Project>
49 changes: 49 additions & 0 deletions Samples/Sample.Xamarin.iOS/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Some Key Group</key>
<array>
<dict>
<key>test</key>
<string>test</string>
</dict>
<dict>
<key>test</key>
<string>test</string>
</dict>
</array>

<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
</array>
</dict>
</array>

<key>Another Key Group</key>
<array>
<dict>
<key>test</key>
<string>test</string>
</dict>
<dict>
<key>test</key>
<string>test</string>
</dict>
</array>
</dict>
</plist>
39 changes: 21 additions & 18 deletions Samples/Sample.Xamarin.iOS/Sample.Xamarin.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,28 @@
<MtouchDebug>true</MtouchDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<!-- Configure Sentry org and project -->
<!-- for more information: https://docs.sentry.io/platforms/dotnet/guides/xamarin/configuration/msbuild-->
<SentryOrg>sentry-sdks</SentryOrg>
<SentryProject>sentry-xamarin</SentryProject>
<!--
<!-- Configure Sentry org and project -->
<!-- for more information: https://docs.sentry.io/platforms/dotnet/guides/xamarin/configuration/msbuild-->
<SentryOrg>sentry-sdks</SentryOrg>
<SentryProject>sentry-xamarin</SentryProject>
<!--
Each of the below features are opt-in.
Enable the features you wish to use.
-->
<!-- Sends symbols to Sentry, enabling symbolication of stack traces. -->
<SentryUploadSymbols>true</SentryUploadSymbols>
<!-- Sends sources to Sentry, enabling display of source context. -->
<SentryUploadSources>true</SentryUploadSources>
<SentryCLIUploadOptions>--wait</SentryCLIUploadOptions>
<!-- Sends symbols to Sentry, enabling symbolication of stack traces. -->
<SentryUploadSymbols>true</SentryUploadSymbols>
<!-- Sends sources to Sentry, enabling display of source context. -->
<SentryUploadSources>true</SentryUploadSources>
<SentryCLIUploadOptions>--wait</SentryCLIUploadOptions>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchLink>None</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
<!-- Configure Sentry org and project -->
<!-- for more information: https://docs.sentry.io/platforms/dotnet/guides/xamarin/configuration/msbuild-->
<!-- Configure Sentry org and project -->
<!-- for more information: https://docs.sentry.io/platforms/dotnet/guides/xamarin/configuration/msbuild-->
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -76,9 +76,9 @@
Each of the below features are opt-in.
Enable the features you wish to use.
-->
<!-- Sends symbols to Sentry, enabling symbolication of stack traces. -->
<SentryUploadSymbols>true</SentryUploadSymbols>
<!-- Sends sources to Sentry, enabling display of source context. -->
<!-- Sends symbols to Sentry, enabling symbolication of stack traces. -->
<SentryUploadSymbols>true</SentryUploadSymbols>
<!-- Sends sources to Sentry, enabling display of source context. -->
<SentryUploadSources>true</SentryUploadSources>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
Expand All @@ -88,8 +88,8 @@
<MtouchArch>ARM64</MtouchArch>
<CodesignKey>iPhone Developer</CodesignKey>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<!-- Configure Sentry org and project -->
<!-- for more information: https://docs.sentry.io/platforms/dotnet/guides/xamarin/configuration/msbuild-->
<!-- Configure Sentry org and project -->
<!-- for more information: https://docs.sentry.io/platforms/dotnet/guides/xamarin/configuration/msbuild-->
</PropertyGroup>
<PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
<AppExtensionDebugBundleId />
Expand All @@ -101,6 +101,9 @@
<None Include="Entitlements.plist" />
<None Include="Info.plist" />
<Compile Include="Properties\AssemblyInfo.cs" />
<BundleResource Include="PrivacyInfo.xcprivacy">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</BundleResource>
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />
Expand Down Expand Up @@ -193,4 +196,4 @@
<UserProperties TriggeredFromHotReload="False" />
</VisualStudio>
</ProjectExtensions>
</Project>
</Project>
17 changes: 17 additions & 0 deletions Sentry.Xamarin-CI-Build-Windows.slnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"solution": {
"path": "Sentry.Xamarin.sln",
"projects": [
"Src\\Sentry.Xamarin\\Sentry.Xamarin.csproj",
"Src\\Sentry.Xamarin.Forms\\Sentry.Xamarin.Forms.csproj",
"Samples\\Sample.Xamarin.Core\\Sample.Xamarin.Core.csproj",
"Samples\\Sample.Xamarin.UWP\\Sample.Xamarin.UWP.csproj",
"Samples\\Sample.Xamarin.Mac\\Sample.Xamarin.Mac.csproj",
"Samples\\Forms\\com.sentry.ovenlibrary\\com.sentry.ovenlibrary.csproj",
"Samples\\Sample.Xamarin.Droid\\Sample.Xamarin.Droid.csproj",
"Tests\\Sentry.Xamarin.Forms.Testing\\Sentry.Xamarin.Forms.Testing.csproj",
"Tests\\Sentry.Xamarin.Tests\\Sentry.Xamarin.Tests.csproj",
"Tests\\Sentry.Xamarin.Forms.UWP.Tests\\Sentry.Xamarin.Forms.UWP.Tests.csproj"
]
}
}
15 changes: 15 additions & 0 deletions Sentry.Xamarin-CI-Build-macOS.slnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"solution": {
"path": "Sentry.Xamarin.sln",
"projects": [
"Src\\Sentry.Xamarin\\Sentry.Xamarin.csproj",
"Src\\Sentry.Xamarin.Forms\\Sentry.Xamarin.Forms.csproj",
"Samples\\Sample.Xamarin.Core\\Sample.Xamarin.Core.csproj",
"Samples\\Sample.Xamarin.Mac\\Sample.Xamarin.Mac.csproj",
"Samples\\Forms\\com.sentry.ovenlibrary\\com.sentry.ovenlibrary.csproj",
"Samples\\Sample.Xamarin.Droid\\Sample.Xamarin.Droid.csproj",
"Tests\\Sentry.Xamarin.Forms.Testing\\Sentry.Xamarin.Forms.Testing.csproj",
"Tests\\Sentry.Xamarin.Tests\\Sentry.Xamarin.Tests.csproj"
]
}
}
1 change: 1 addition & 0 deletions Src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<!--Automatic upward search ends when first file found. From here we need to manually import parent props/targets
https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build -->
<Import Project="..\Directory.Build.props" />
<Import Project="..\Src\Sentry.Xamarin\buildTransitive\Sentry.Xamarin.targets" />

<PropertyGroup>
<!--Generate xml docs for all projects under 'src'-->
Expand Down