Closed
Bug 661937
Opened 14 years ago
Closed 14 years ago
Flag executable code in themes
Categories
(addons.mozilla.org Graveyard :: Admin/Editor Tools, defect, P2)
addons.mozilla.org Graveyard
Admin/Editor Tools
Tracking
(Not tracked)
VERIFIED
FIXED
6.1.3
People
(Reporter: kmag, Assigned: basta)
Details
(Whiteboard: [patch][needs review])
Attachments
(2 files)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110513 Firefox/6.0a1
Build Identifier:
The old validator had tests for executable code in themes. Since themes are generally not allowed to contain executable code and are often reviewed as if they have none, this is incredibly important.
Among things that need to be flagged are:
XBL:
• xbl:constructor/xbl:destructor elements
• xbl:field elements with any contents
• xbl:property elements with onget/onset attributes
• xbl:getter/xbl:setter elements
• Any script, xul:script, or on* attributes under xbl:contents elements
Filetypes:
• *.js
• *.xul with any script contents
• *.html with any script contents
Anything I might be missing. When we're clear on everything that needs to be flagged, I'll create a test add-on if need be.
Reproducible: Always
| Reporter | ||
Comment 1•14 years ago
|
||
Looking at the Remora validator, the following are also flagged:
• xbl:implementation, xul:browser, iframe, embed, object elements
• javascript: and data: anywhere. I'm not entirely sure where these should be flagged, but certainly the latter should be in -moz-binding values.
• *.jsm files
• Any declaration other than skin or style in chrome.manifest
Comment 2•14 years ago
|
||
The remora patch is at bug 539064. If you need access to this bug, just let me know.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P2
Whiteboard: [required amo-editors]
Target Milestone: --- → 6.1.1
Updated•14 years ago
|
Assignee: nobody → mbasta
| Assignee | ||
Comment 3•14 years ago
|
||
For XUL/HTML files, would it be enough to ban any element with the XBL xml namespace?
Also, we currently throw a warning if -moz-binding is used in any CSS (no matter what file it's found in). Is this sufficient?
Comment 4•14 years ago
|
||
(In reply to comment #3)
> For XUL/HTML files, would it be enough to ban any element with the XBL xml
> namespace?
XBL declarations are normally done in .xbl or .xml files. There's no hint of a binding being used by inspecting the XUL or HTML files where the binding is included.
> Also, we currently throw a warning if -moz-binding is used in any CSS (no
> matter what file it's found in). Is this sufficient?
Do you mean this warning already exists for themes? I think that should be good enough to detect custom binding usage.
| Assignee | ||
Comment 5•14 years ago
|
||
As for bug 539064, I don't have access. I can apply whatever they've got as soon as I can get access.
> Do you mean this warning already exists for themes? I think that should be good enough to detect
> custom binding usage.
It already exists for everything.
| Reporter | ||
Comment 6•14 years ago
|
||
Matt: It looks like the current test flags https?, ftp, or data: URLs in -moz-binding. That's probably sufficient, although the test should probably flag any URL that starts with any protocol other than chrome: or resource:. We shouldn't need anything special for themes.
| Assignee | ||
Comment 7•14 years ago
|
||
Updated•14 years ago
|
Whiteboard: [required amo-editors] → [patch][needs review]
Target Milestone: 6.1.1 → 6.1.2
| Reporter | ||
Comment 8•14 years ago
|
||
There are still some problems with this. Testcase attached.
• It doesn't take into account namespace when testing for XBL elements, thus failing for the common case in XBL files where XBL is the default namespace.
• It doesn't catch on* event listeners, which leaves a trivial code path to exploit.
I also noticed, accidentally, that the lack of locale lines is flagged in chrome.manifest, but I'm not bothered enough by it to file a bug.
| Assignee | ||
Comment 9•14 years ago
|
||
I'll work on getting the default namespace passed down, didn't think of that.
As for on* even listeners, I'm not sure what you mean. You can't addEventListener, since that's JS and all JS is flagged. on* attributes should be flagged because they pass their values to test_js_snippet, which will then throw an error for containing JS.
I just patched the message about locale lines in chrome.manifest.
| Reporter | ||
Comment 10•14 years ago
|
||
Re on* attributes, hm, I'm not sure what's going on, then, because the test XPI contains an iframe with an onload attribute that isn't flagged. I'll have to test with regular XUL and HTML files.
Also, are the XBL tags above run through text_js_snippet? If so, they should be automatically flagged. If not, that's another critical bug that needs to be filed.
| Assignee | ||
Comment 11•14 years ago
|
||
Check this out, it should address your concerns:
https://github.com/mattbasta/amo-validator/commit/dab3d4a8bf108dd93822995cc0ac3e9de5cf956c
| Reporter | ||
Comment 12•14 years ago
|
||
Seems to be mostly readme updates, which are quite nice granted, but don't really bear on the bug.
| Assignee | ||
Comment 13•14 years ago
|
||
My bad, I suck at multitasking:
https://github.com/mattbasta/amo-validator/commit/4e8efb0a44971b96e22c8f33e42defff57e311e8
Updated•14 years ago
|
Target Milestone: 6.1.2 → 6.1.3
| Assignee | ||
Comment 14•14 years ago
|
||
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Comment 15•14 years ago
|
||
(In reply to comment #8)
> There are still some problems with this. Testcase attached.
>
> • It doesn't take into account namespace when testing for XBL elements, thus
> failing for the common case in XBL files where XBL is the default namespace.
This is now a warning. verified at https://addons.allizom.org/en-US/developers/upload/dcee9ec607fd4dd2ac5f49d7c4171ec0 . Also, see post-fix screenshot.
> • It doesn't catch on* event listeners, which leaves a trivial code path to
> exploit.
I am not sure what was decided regarding this. Is this is still an issue, feel free to reopen.
>
> I also noticed, accidentally, that the lack of locale lines is flagged in
> chrome.manifest, but I'm not bothered enough by it to file a bug.
I don't see any locale-related errors anymore.
Kris, thanks for attaching the test file. That helped a lot.
Status: RESOLVED → VERIFIED
Comment 16•14 years ago
|
||
Updated•9 years ago
|
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•