Skip to content

feat(distribution): Add dedicated distribution auth token property#1007

Merged
runningcode merged 3 commits into
mainfrom
no/distribution-auth-token
Oct 13, 2025
Merged

feat(distribution): Add dedicated distribution auth token property#1007
runningcode merged 3 commits into
mainfrom
no/distribution-auth-token

Conversation

@runningcode

@runningcode runningcode commented Oct 13, 2025

Copy link
Copy Markdown
Contributor

Summary

This PR adds a dedicated authToken property to DistributionExtension to decouple distribution authentication from the main org auth token. This provides better security separation by allowing distribution operations to use a separate token with potentially different permissions.

Changes

  • Add authToken property to DistributionExtension with SENTRY_DISTRIBUTION_AUTH_TOKEN environment variable as the default convention
  • Update GenerateDistributionPropertiesTask to use authToken from the distribution extension
  • Update all existing tests to use the new property
  • Add new tests for authToken property behavior and environment variable convention

Implementation Details

The implementation uses Gradle's convention mechanism to provide a clean fallback to the environment variable. The authToken property has System.getenv("SENTRY_DISTRIBUTION_AUTH_TOKEN") as its default convention, eliminating the need for explicit fallback logic in the task.

Usage

Users can configure the distribution auth token in two ways:

Via Gradle extension (overrides environment variable):

sentry {
  distribution {
    authToken.set("your-distribution-token")
  }
}

Via environment variable (used by default):

export SENTRY_DISTRIBUTION_AUTH_TOKEN=your-distribution-token

#skip-changelog

🤖 Generated with Claude Code

Add distributionAuthToken property to DistributionExtension to decouple distribution authentication from the main org auth token for improved security separation.

Changes:
- Add distributionAuthToken property to DistributionExtension
- Update GenerateDistributionPropertiesTask to use distributionAuthToken from extension
- Add fallback to SENTRY_DISTRIBUTION_AUTH_TOKEN environment variable
- Update all existing tests to use the new property
- Add tests for distributionAuthToken property and environment variable fallback

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 13, 2025

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 088ddc9

objects.setProperty(String::class.java).convention(emptySet())

/** Auth token used for distribution operations. */
val authToken: Property<String> =

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There’s also sentry.authToken (this is sentry.distribution.authToken). This could be confusing since the names may shadow each other. Open to naming suggestions.

Simplify the distribution auth token implementation by using Gradle's convention mechanism:
- Rename distributionAuthToken to authToken for simplicity
- Set convention to System.getenv("SENTRY_DISTRIBUTION_AUTH_TOKEN")
- Remove explicit fallback logic in GenerateDistributionPropertiesTask
- Update tests to reflect the simpler convention-based approach

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@runningcode runningcode force-pushed the no/distribution-auth-token branch from a1bbd20 to 93d2d6e Compare October 13, 2025 12:42

@chromy chromy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm w/ one comment re tests

Add tests to ensure:
- distribution.authToken takes precedence over main authToken
- No fallback to main authToken when distribution authToken is not set

This ensures proper security separation between distribution and main auth tokens.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@runningcode runningcode enabled auto-merge (squash) October 13, 2025 14:21
@runningcode runningcode requested a review from chromy October 13, 2025 14:39

@chromy chromy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@runningcode runningcode merged commit 252a908 into main Oct 13, 2025
17 checks passed
@runningcode runningcode deleted the no/distribution-auth-token branch October 13, 2025 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants