Skip to content

Conversation

@matt-codecov
Copy link

  • upgrades objectstore_client to 0.0.15
  • adds optional UploadServiceAuthConfig struct which can configure Objectstore signing key/token creation options
  • creates an Objectstore TokenGenerator if config is provided

two things to note:

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@matt-codecov matt-codecov requested a review from a team as a code owner January 8, 2026 23:04
@matt-codecov matt-codecov requested a review from lcian January 8, 2026 23:04
/// The permissions a token signed by this client should have.
///
/// TODO: Expose `Permission` type in `objectstore_client`
pub permissions: Option<HashSet<String>>,
Copy link
Member

Choose a reason for hiding this comment

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

Is there a difference between None and the empty set here? I.e. None means all permissions, empty set means no permissions at all? If not, we could remove the option.

Copy link
Member

Choose a reason for hiding this comment

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

Come to think of it, should the permissions of this client really be configurable? I assume that Relay would always need the same set of permissions to function correctly, so I would hard-code them instead of putting them in the config.

Copy link
Author

Choose a reason for hiding this comment

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

None is taken to mean "we don't set it, use the client default" whereas empty set means "create tokens with no permissions"

you are right that relay will generally use a single set of permissions, and if that changes it might be something that is overridden when creating a session. either way i need to expose the Permission type for y'all to reference, but if y'all are fine with hardcoding i can remove this permission config

Copy link
Member

Choose a reason for hiding this comment

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

Yes I'm fine with removing the config.

/// The permissions a token signed by this client should have.
///
/// TODO: Expose `Permission` type in `objectstore_client`
pub permissions: Option<HashSet<String>>,
Copy link
Member

Choose a reason for hiding this comment

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

nit: https://develop.sentry.dev/ingestion/relay/relay-best-practices/#data-structures

Suggested change
pub permissions: Option<HashSet<String>>,
pub permissions: Option<BTreeSet<String>>,

if let Some(auth) = auth {
let secret_key = ObjectstoreKey {
kid: auth.kid.clone(),
secret_key: std::fs::read_to_string(auth.key_file.clone())?,
Copy link
Member

Choose a reason for hiding this comment

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

Didn't test this but it must be possible to not clone here:

Suggested change
secret_key: std::fs::read_to_string(auth.key_file.clone())?,
secret_key: std::fs::read_to_string(&auth.key_file)?,

/// JWT private key ID that Objectstore must use to load a corresponding public key.
pub kid: String,

/// A file where the JWT private key content is located, in EdDSA PEM form.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// A file where the JWT private key content is located, in EdDSA PEM form.
/// Path of the JWT private key file, in EdDSA PEM form.

pub kid: String,

/// A file where the JWT private key content is located, in EdDSA PEM form.
pub key_file: String,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pub key_file: String,
pub key_file: PathBuf,

Copy link
Member

@Dav1dde Dav1dde left a comment

Choose a reason for hiding this comment

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

14 additional dependencies, but I guess that's not avoidable.

#[serde(default)]
pub struct UploadServiceAuthConfig {
/// JWT private key ID that Objectstore must use to load a corresponding public key.
pub kid: String,
Copy link
Member

@Dav1dde Dav1dde Jan 9, 2026

Choose a reason for hiding this comment

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

Is kid something objectstore uses a lot? If not for consistency I'd prefer key_id, key_file, key_{...}.

Copy link
Author

Choose a reason for hiding this comment

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

it's the name of the JWT header field. key_id is probably clearer in code, you're right

@Dav1dde
Copy link
Member

Dav1dde commented Jan 13, 2026

@matt-codecov With #5531 Relay's config can transparently load values from files, meaning you can just expect the config variable to contain the key as a String.

Example ${file:/path/objectstore.key}:

def test_variable_loaded_from_file(mini_sentry, relay):
tmp = tempfile.NamedTemporaryFile(delete_on_close=False)
tmp.write(b"1B")
tmp.close()
relay = relay(
mini_sentry,
options={
"limits": {"max_event_size": f"${{file:{tmp.name}}}"},
},
)
with pytest.raises(HTTPError, match="413 Client Error"):
relay.send_event(42)

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.

4 participants