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

ref(common): Make the DSN public key Copy #795

Merged
merged 2 commits into from
Oct 5, 2020
Merged

Conversation

jan-auer
Copy link
Member

@jan-auer jan-auer commented Oct 5, 2020

Creates a type for DSN public keys that implements copy. Every public key is a 32-character hexadecimal string. Storage requirements could be halved by parsing the hexadecimal contents of the key, however this is currently not enforced anywhere in Sentry. For this reason, we're taking the conservative approach using 32 bytes.

The type is called ProjectKey to distinguish it from Relay's own public key.

#skip-changelog

@jan-auer jan-auer requested review from untitaker and a team October 5, 2020 11:55
@jan-auer jan-auer self-assigned this Oct 5, 2020

/// Data scoping information.
///
/// This structure holds information of all scopes required for attributing an item to quotas.
#[derive(Clone, Debug)]
#[derive(Clone, Copy, Debug)]
Copy link
Member

Choose a reason for hiding this comment

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

since this is now Copy theoretically you can put it into ItemScoping without a lifetime

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point!

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, I'll leave it like this. The ItemScoping type is quite large, and since one should only temporarily hold an item scoping, it's probably fine to keep it with a reference.

@jan-auer jan-auer merged commit 79ebd1e into master Oct 5, 2020
@jan-auer jan-auer deleted the ref/dsn-key-copy branch October 5, 2020 12:08
jan-auer added a commit that referenced this pull request Oct 5, 2020
* master:
  ref(common): Make the DSN public key Copy (#795)
  ref(server): Bring back upstream response transformer (#794)
  ref(server): Upstream request retries & re-authentication (#788)
untitaker added a commit that referenced this pull request Sep 6, 2021
We should be able to represent all DSNs with half the bytes. I validated
that we don't have non-hex DSNs in prod, this returns 0:

select count(*) from sentry_projectkey where encode(decode(public_key, 'hex'), 'hex') != public_key

This should solve the concern voiced by Jan in #795
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