addons icon indicating copy to clipboard operation
addons copied to clipboard

Addon Validation Error

Open ImprovedTube2 opened this issue 5 months ago • 8 comments

improvedtube_firefox.zip

few feature updates, didn't change the manifest, no errors running it unpacked

  • The URL where you submitted the add-on.

https://addons.mozilla.org/en-US/developers/upload/953cfb75bd8340c2bd3463be0bf7ec73

https://addons.mozilla.org/en-US/firefox/addon/youtube-addon/

┆Issue is synchronized with this Jira Task

ImprovedTube2 avatar Jun 29 '26 23:06 ImprovedTube2

Likely https://mozilla.sentry.io/issues/7583175139/. Need to investigate further what's going on, the attached zip should help, let's see if we can reproduce locally.

diox avatar Jun 30 '26 13:06 diox

Hey. It looks like your zip file has a problem. When I try to unzip it locally (macOS), I am getting this:

checkdir error:  /private/tmp/wip/_locales/bn_BD exists but is not directory
                 unable to process _locales/bn_BD/.
checkdir error:  /private/tmp/wip/_locales/bn_BD exists but is not directory
                 unable to process _locales/bn_BD/messages.json.
unzip -l -v ~/Downloads/improvedtube_firefox.zip |grep bn_BD
   31647  Defl:N     5808  82% 05-30-2026 02:02 aca13cf9  _locales/bn_BD
       0  Stored        0   0% 06-30-2026 00:12 00000000  _locales/bn_BD/
   31647  Defl:N     5808  82% 06-30-2026 00:12 aca13cf9  _locales/bn_BD/messages.json

Looks like your archive has both a bn_BD/ folder and a bn_BD text file in _locales/, which does not seem to be valid?

willdurand avatar Jun 30 '26 13:06 willdurand

Looks like your archive has both a bn_BD/ folder and a bn_BD text file in _locales/, which does not seem to be valid?

That helped.


It could mention the detail and/or allow to refuse the strictness. Image

ImprovedTube2 avatar Jun 30 '26 15:06 ImprovedTube2

We should raise an error if we find symlinks - we're already validating each individual member of the zipfile, so something like stat.S_ISLNK(member.external_attr) in that. We should probably still allow that for source uploads though?

diox avatar Jun 30 '26 16:06 diox

From what I've read, the zip format doesn't preserve symlinks so I am not sure we can determine whether a file is a symlink or not when reading the archive.

willdurand avatar Jul 01 '26 07:07 willdurand

It's definitely possible (though I would imagine not well supported), the zip command on my linux machine has a -y option for that:

% zip --help | fgrep -- -y  
  -y   store symbolic links as the link instead of the referenced file
% ln -s foo bar
'bar' -> 'foo'
% zip -y lol.zip bar
  adding: bar (stored 0%)
% unzip -t lol.zip
Archive:  lol.zip
    testing: bar                      OK

And then in Python (according to a bit of googling, we need to add an obscure bit shift to get the info from external_attr (*)):

>>> z = zipfile.ZipFile('lol.zip')
>>> z.infolist()
[<ZipInfo filename='bar' filemode='lrwxrwxrwx' file_size=3>]
>>> i = z.infolist()[0]
>>> stat.S_ISLNK(i.external_attr >> 16)
True

However, looking at this zip, it's not exactly what happened here - here bn_BD is not stored as a link, but as an extra file with the same name as a directory (which I imagine did come from a link originally). At the cost of looping around the members of the zip an extra time, we could see if there are any clashes between files and directories to catch that.

(*) From zipfile's ZipInfo.__repr__():

hi = self.external_attr >> 16
lo = self.external_attr & 0xFFFF
if hi:
    result.append(' filemode=%r' % stat.filemode(hi))

diox avatar Jul 01 '26 08:07 diox

Thank you for caring. Left such .zip for review as our Chrome Web Store Testing Version, just out of curiosity, resulting in a later "Rejection notification" ... "Could not unzip extension " - So Mozilla still wins this time (as of no delay)

ImprovedTube2 avatar Jul 04 '26 17:07 ImprovedTube2

May we¹ join your team?😃 While serving 850k+ users, i'm more motivated contributing to more complex code with more usage and it is strange that FOSS has no global coordinated priority To-Do list, is it? (Like the biggest repo² does have https://en.wikipedia.org/wiki/Special:WantedPages)
¹ 176 People joined this Github Org with no money. Several awesome contributors are in very poor places, rural West Bengal and Africa. ² Wikpedia is also a repo, even if largely backwards compatible to real brain processing.

ImprovedTube2 avatar Jul 04 '26 18:07 ImprovedTube2