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

sentry.properties not added on .gitignore for React Native #586

Open
lucas-zimerman opened this issue Jun 11, 2024 · 6 comments
Open

sentry.properties not added on .gitignore for React Native #586

lucas-zimerman opened this issue Jun 11, 2024 · 6 comments

Comments

@lucas-zimerman
Copy link
Contributor

lucas-zimerman commented Jun 11, 2024

Environment

What version are you running
3.23.1

npx @sentry/wizard@latest -s -i reactNative

Steps to Reproduce

I have opened this issue to discuss if it's ideal or not to add sentry.properties to git ignore since it contains an authentication token.

After running the wizard and building the app, I noticed that sentry.property was created under both iOS/Android and that no git ignore rule was applied for it, so users could commit it without noticing it.

This file contains the user auth token:

auth.token=sntryu_375nnn10182qsr46s6r78s725q224rr2ao679120r3no33p9n496s6828o86q2nr // Invalid token.

defaults.org=sentry-sdks
defaults.project=sentry-react-native

defaults.url=https://sentry.io/

Expected Result

This file should be included on gitignore and sentry.properties not tracked by git.

What you thought would happen.

Actual Result

sentry.properties is tracked by git.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Jun 11, 2024
@Lms24
Copy link
Member

Lms24 commented Jun 12, 2024

Good catch! I agree that whatever file we create that contains a secret should be .gitignore'd. This is in line with our SDK wizard specification.

Are you interested in opening a PR for this? cc @krystofwoldrich thoughts?

@lucas-zimerman
Copy link
Contributor Author

Sure thing, I could open a PR for it.

Also for more context, when pushing a project with sentry.properties on github an application emailed me with the following message
image

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Jun 12, 2024
@Lms24
Copy link
Member

Lms24 commented Jun 13, 2024

Let's do it, thanks!

@zubko
Copy link

zubko commented Aug 2, 2024

I've just tried the new Sentry integration with "@sentry/react-native": "5.26.0" and the integration wizard.
if I .gitignore sentry.properties then the build will fail on CI with:

Sentry Source Maps upload will include the release name and dist.
Sentry-CLI arguments: [/bitrise/src/packages/mobile/node_modules/@sentry/cli/bin/sentry-cli, react-native, gradle, --bundle, /bitrise/src/packages/mobile/android/app/build/generated/assets/createBundleP4hStagingReleaseJsAndAssets/index.android.bundle, --sourcemap, /bitrise/src/packages/mobile/android/app/build/generated/sourcemaps/react/p4hStagingRelease/index.android.bundle.map, --release, [email protected]+574175233, --dist, 574175233]
  WARN    2024-08-01 15:27:53.022331510 +00:00 Failed to find file referenced by SENTRY_PROPERTIES (/bitrise/src/packages/mobile/android/sentry.properties)
error: A project slug is required (provide with --project)

so far I've removed the auth token from the file and checked it in Git.
I think this is not a good strategy to keep both the auth token (security sensitive but optional info) and some Sentry project identifiers (not so sensitive, but required) in the same file, then the file cannot be ignored that easily and then some other developer can accidentally Git push the auth token if they login on their machine and don't check their Git diff.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Aug 2, 2024
@Lms24
Copy link
Member

Lms24 commented Aug 2, 2024

@zubko I'm lacking a bit of context in ReactNative land but I agree that having all paramers in one file isn't ideal. IIRC we discussed this before @krystofwoldrich do you remember specifics?
Generally, the Sentry CLI also works with the SENTRY_AUTH_TOKEN environment variable so depending on your setup you can declare this env variable, for example in a .env file. Again, I'm not an RN expert, so Krystof knows more here.

@krystofwoldrich
Copy link
Member

Thank you @zubko for the message, as @Lms24 mentioned we are aware of this, and will improve the experience in the future.

The best is to set SENTRY_AUTH_TOKEN env, but we can't do that automatically in the wizard due to security. Sadly the .env files behave differently across the RN build environments Xcode, Gradle, Expo...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

4 participants