]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/finer_control_over___60__object___47____62__s.mdwn
review
[ikiwiki.git] / doc / todo / finer_control_over___60__object___47____62__s.mdwn
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:
2
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 --
7
8 It seems that the following attributes are, OTOH, safe:
9
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 --
19
20 Should the former attributes be *scrubbed* while the latter left intact, the use of the `object` tag would seemingly become safe.
21
22 Note also that allowing `object` (either restricted in such a way or not) automatically solves the [[/todo/svg]] issue.
23
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.
25
26 — [[Ivan_Shmakov]], 2010-03-12Z.
27
28 [[wishlist]]
29
30 > SVG can contain embedded javascript.
31
32 >> Indeed.
33
34 >> So, a more general tool (`XML::Scrubber`?) will be necessary to
35 >> refine both [XHTML][] and SVG.
36
37 >> … And to leave [MathML][] as is (?.)
38
39 >> — [[Ivan_Shmakov]], 2010-03-12Z.
40
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
45 > attacks.
46 > --[[Joey]]
47
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.
51
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`.
58
59 >>> But with local data, one could not embed youtube videos, which surely
60 >>> is the most obvious use case?
61
62 >>>> Allowing a “remote” object to render on one's page is a
63      security issue by itself.
64      Though, of course, having an explicit whitelist of URI's may make
65      this issue more tolerable.
66      — [[Ivan_Shmakov]], 2010-03-12Z.
67
68 >>> Note that youtube embedding uses an
69 >>> object element with no classid. The swf file is provided via an
70 >>> enclosed param element. --[[Joey]]
71
72 >>>> I've just checked a random video on YouTube and I see that the
73      `.swf` file is provided via an enclosed `embed` element.  Whether
74      to allow those or not is a different issue.
75      — [[Ivan_Shmakov]], 2010-03-12Z.
76
77 >> (Though it certainly won't solve the [[SVG_problem|/todo/SVG]] being
78 >> restricted in such a way.)
79
80 >> Of the remaining issues I could only think of recursive
81 >> `object` — the one that references its container document.
82
83 >> — [[Ivan_Shmakov]], 2010-03-12Z.
84
85 ## See also
86
87 * [Objects, Images, and Applets in HTML documents][objects-html]
88 * [[plugins/htmlscrubber|/plugins/htmlscrubber]]
89 * [[todo/svg|/todo/svg]]
90 * [RFC 2397: The “data” URL scheme. L. Masinter. August 1998.][RFC 2397]
91 * [Uniform Resource Identifier — the free encyclopedia][URI]
92
93 [HTML::Scrubber]: http://search.cpan.org/~podmaster/HTML-Scrubber-0.08/Scrubber.pm
94 [MathML]: http://en.wikipedia.org/wiki/MathML
95 [objects-html]: http://www.w3.org/TR/1999/REC-html401-19991224/struct/objects.html
96 [RFC 2397]: http://tools.ietf.org/html/rfc2397
97 [URI]: http://en.wikipedia.org/wiki/Uniform_Resource_Identifier
98 [XHTML]: http://en.wikipedia.org/wiki/XHTML