-
Notifications
You must be signed in to change notification settings - Fork 41
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
Empty stashes can be created and published when a block is submitted for an unsigned file #15155
Comments
I can verify this as well. STR for me after following setup from olympia.blocklist.models import BlockType
from olympia.amo.tests import addon_factory, block_factory, version_factory
def _blocked_addon(block_type=BlockType.BLOCKED, **kwargs):
addon = addon_factory(**kwargs)
block = block_factory(
guid=addon.guid, updated_by=user, block_type=block_type
)
return addon, block
user = UserProfile.objects.first()
_blocked_addon(block_type=BlockType.BLOCKED, file_kw={'is_signed': False}) Then in a shell run ./manage.py cron upload_mlbf_to_remote_settings Expect the stash in the latest filter to be {"blocked": [<Your addon hash>], "unblocked": []} Actual: {"blocked": [], "unblocked": []} |
The root cause of this issue is here previous_filter.created_at < get_blocklist_last_modified_time() If a block is created for an unsigned addon, it is still makes the last modified time more recent than the previous filter.. this triggers an update with an empty stash. This PR fixes that issue, but maybe not in the right way. We could consider fixing by updating the query for blocks associated with signed files.. maybe searching for versions.. or even getting rid of this condition as it's not totally clear that it is valuable anymore as we will rely on the database state to determine if we should update the filter |
The fix from the PR is probably good, but we should prevent this from happening in the admin (and even model) in the first place: there is no need to block unsigned versions, that's kinda pointless as the signature is what makes blocklisting them reliable. |
STR
as the ones generated by default)
./manage.py cron upload_mlbf_to_remote_settings
Expected
No stash record is created/published.
Actual
An empty stash record is created/published in Remote Settings:
This is "easy" to reproduce in localdev, not sure how we'd reproduce this in our
hosted envs, especially in somewhat realistic conditions.
Note that re-running Step (3) will NOT create another empty stash. This only
happens once. I suppose some state/time is persisted somewhere. That might be
something to keep in mind when fixing this bug.
┆Issue is synchronized with this Jira Task
The text was updated successfully, but these errors were encountered: