Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Conversation

@joseph-sentry
Copy link
Contributor

No description provided.

@joseph-sentry joseph-sentry requested a review from a team January 20, 2025 17:43

repoid = models.IntegerField()
test_id = models.BinaryField()
flags_id = models.BinaryField(null=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

BinaryField. What kind of data do you plan to put there? Also noticing now that test_id is also a BinaryField. Will these hold (non-base16-encoded) hash values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, they're both has values. I think i can probably indicate it somehow with some sort of max length in the binary field but the test_id is meant to be 16 bytes and the flags_id is meant to be 8 bytes. they're both generated using mmh3 and they don't have any particular encoding hence: BinaryField. In BQ they're defined as BYTES fields

Copy link
Contributor

Choose a reason for hiding this comment

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

we have a normal index on repo_id and test_id, but are you planning on having any kind of uniqueness constraint based on the test_id or the flags_id?

it should be fine if both are still also dependent on the repo_id.

just thinking of that as I recently read https://orlp.net/blog/breaking-hash-functions/ which is a very well written post about how to trivially cause collisions of mmh3 and similar non cryptographic hash functions.
it would be really bad if one customer could mess with another customers data based on such trivially breakable hash values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think the uniqueness constraint should be on (repoid, test_id, flags_id) so that will isolate test_id collisions to a single customer. The mistake I made with the Test model previously is that the primary key was the test_id, which was all around a bad idea.

At least this strategy of isolating unique (test_id, flags_id) combinations to the repo means that one customer can't mess with another, however this still leaves an opening for open source repos (or any repo that doesn't protect its uploads) to be polluted. I'm not sure how to fix that problem.

@codecov
Copy link

codecov bot commented Jan 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.91%. Comparing base (09d69db) to head (c16e8bc).
Report is 24 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #484      +/-   ##
==========================================
- Coverage   90.30%   89.91%   -0.40%     
==========================================
  Files         435      324     -111     
  Lines       12977     9132    -3845     
  Branches     2113     1621     -492     
==========================================
- Hits        11719     8211    -3508     
+ Misses       1143      858     -285     
+ Partials      115       63      -52     
Flag Coverage Δ
shared-docker-uploader ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joseph-sentry joseph-sentry added this pull request to the merge queue Feb 11, 2025
Merged via the queue into main with commit 1f0a5e6 Feb 11, 2025
6 checks passed
@joseph-sentry joseph-sentry deleted the joseph/add-flags-id branch February 11, 2025 17:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants