1 IIUC, the current version of [HTML::Scrubber][] allows for the `object` tags to be either enabled or disabled entirely. However, while `object` can be used to add *code* (which is indeed a potential security hole) to a document, reading [Objects, Images, and Applets in HTML documents][objects-html] reveals that the “dangerous” are not all the `object`s, but rather those having the following attributes:
3 classid %URI; #IMPLIED -- identifies an implementation --
4 codebase %URI; #IMPLIED -- base URI for classid, data, archive--
5 codetype %ContentType; #IMPLIED -- content type for code --
6 archive CDATA #IMPLIED -- space-separated list of URIs --
8 It seems that the following attributes are, OTOH, safe:
10 declare (declare) #IMPLIED -- declare but don't instantiate flag --
11 data %URI; #IMPLIED -- reference to object's data --
12 type %ContentType; #IMPLIED -- content type for data --
13 standby %Text; #IMPLIED -- message to show while loading --
14 height %Length; #IMPLIED -- override height --
15 width %Length; #IMPLIED -- override width --
16 usemap %URI; #IMPLIED -- use client-side image map --
17 name CDATA #IMPLIED -- submit as part of form --
18 tabindex NUMBER #IMPLIED -- position in tabbing order --
20 Should the former attributes be *scrubbed* while the latter left intact, the use of the `object` tag would seemingly become safe.
22 Note also that allowing `object` (either restricted in such a way or not) automatically solves the [[/todo/svg]] issue.
24 For Ikiwiki, it may be nice to be able to restrict [URI's][URI] (as required by the `data` and `usemap` attributes) to, say, relative and `data:` (as per [RFC 2397][]) ones as well, though it requires some more consideration.
26 — [[Ivan_Shmakov]], 2010-03-12Z.
30 > SVG can contain embedded javascript.
34 >> So, a more general tool (`XML::Scrubber`?) will be necessary to
35 >> refine both [XHTML][] and SVG.
37 >> … And to leave [MathML][] as is (?.)
39 >> — [[Ivan_Shmakov]], 2010-03-12Z.
41 > The spec that you link to contains
42 > examples of objects that contain python scripts, Microsoft OLE
43 > objects, and Java. And then there's flash. I don't think ikiwiki can
44 > assume all the possibilities are handled securely, particularly WRT XSS
48 >> I've scanned over all the `object` examples in the specification and
49 >> all of those that hold references to code (as opposed to data) have a
50 >> distinguishing `classid` attribute.
52 >> While I won't assert that it's impossible to reference code with
53 >> `data` (and, thanks to `text/xhtml+xml` and `image/svg+xml`, it is
54 >> *not* impossible), throwing away any of the “insecure”
55 >> attributes listed above together with limiting the possible URI's
56 >> (i. e., only *local* and certain `data:` ones for `data` and
57 >> `usemap`) should make `object` almost as harmless as, say, `img`.
59 >>> But with local data, one could not embed youtube videos, which surely
60 >>> is the most obvious use case? Note that youtube embedding uses an
61 >>> object element with no classid. The swf file is provided via an
62 >>> enclosed param element. --[[Joey]]
64 >> (Though it certainly won't solve the [[SVG_problem|/todo/SVG]] being
65 >> restricted in such a way.)
67 >> Of the remaining issues I could only think of recursive
68 >> `object` — the one that references its container document.
70 >> — [[Ivan_Shmakov]], 2010-03-12Z.
74 * [Objects, Images, and Applets in HTML documents][objects-html]
75 * [[plugins/htmlscrubber|/plugins/htmlscrubber]]
76 * [[todo/svg|/todo/svg]]
77 * [RFC 2397: The “data” URL scheme. L. Masinter. August 1998.][RFC 2397]
78 * [Uniform Resource Identifier — the free encyclopedia][URI]
80 [HTML::Scrubber]: http://search.cpan.org/~podmaster/HTML-Scrubber-0.08/Scrubber.pm
81 [MathML]: http://en.wikipedia.org/wiki/MathML
82 [objects-html]: http://www.w3.org/TR/1999/REC-html401-19991224/struct/objects.html
83 [RFC 2397]: http://tools.ietf.org/html/rfc2397
84 [URI]: http://en.wikipedia.org/wiki/Uniform_Resource_Identifier
85 [XHTML]: http://en.wikipedia.org/wiki/XHTML