Skip to content
Myr

Added a security section to the foreword and a footnote to the g

Before adoption: this commit came in with the history the project adopted, so no landing records it.

variable

authored by Armin Ronacher · committed by Armin Ronacher · parent 4e7aa9e · Browse files · 4 files+48 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+48 added−3 removed

  • other:+48 added−3 removed

4 files+48 added−3 removed

modified:docs/_themes/flasky/static/flasky.css_t+11 added-1 removed
241 unmodified lines
242 border: 1px solid #888;243 padding: 0.25em 0.7em;244}245246table.field-list {246table.field-list, table.footnote {247 border: none;248 -webkit-box-shadow: none;249 -moz-box-shadow: none;250}251252table.footnote {253 border: 1px solid #eee;254 -webkit-box-shadow: 1px 1px 1px #d8d8d8;255 -moz-box-shadow: 1px 1px 1px #d8d8d8;256}257258table.field-list th {259 padding: 0 0.8em 0 0;260}261262table.field-list td {263 padding: 0;264}265266table.footnote td {267 padding: 0.5em;268}269 270pre {271 background: #FDFDFD;272 padding: 10px;
31 unmodified lines
modified:docs/foreword.rst+28 added
43 unmodified lines
44framework. Flask itself is just one way to implement a framework on top45of existing libraries. Unlike many other microframeworks Flask does not46try to implement anything on its own, it reuses existing code.4748Web Development is Dangerous49----------------------------5051I'm not even joking. Well, maybe a little. If you write a web52application you are probably allowing users to register and leave their53data on your server. The users are entrusting you with data. And even if54you are the only user that might leave data in your application, you still55want that data to be stored in a secure manner.5657Unfortunately there are many ways security of a web application can be58compromised. Flask protects you against one of the most common security59problems of modern web applications: cross site scripting (XSS). Unless60you deliberately mark insecure HTML as secure Flask (and the underlying61Jinja2 template engine) have you covered. But there are many more ways to62cause security problems.6364Whenever something is dangerous where you have to watch out, the65documentation will tell you so. Some of the security concerns of web66development are far more complex than one might think and often we all end67up in situations where we think "well, this is just far fetched, how could68that possibly be exploited" and then an intelligent guy comes along and69figures a way out to exploit that application. And don't think, your70application is not important enough for hackers to take notice. Depending71ont he kind of attack, chances are there are automated botnets out there72trying to figure out how to fill your database with viagra adverisments.7374So always keep that in mind when doing web development.7576Target Audience77---------------7879Is Flask for you? Is your application small-ish (less than 4000 lines of
15 unmodified lines
modified:docs/patterns.rst+2 added
14 unmodified lines
15:meth:`~flask.Flask.request_shutdown` decorators in combination with the16special :class:`~flask.g` object.171819.. _database-pattern:2021Using SQLite 3 with Flask22-------------------------2324So here a simple example how you can use SQLite 3 with Flask::
226 unmodified lines
modified:docs/quickstart.rst+7 added-2 removed
311 unmodified lines
312 <h1>Hello World!</h1>313 {% endif %}314315Inside templates you also have access to the :class:`~flask.request`,316:class:`~flask.session` and :class:`~flask.g` objects as well as the317:func:`~flask.get_flashed_messages` function.316:class:`~flask.session` and :class:`~flask.g` [#]_ objects317as well as the :func:`~flask.get_flashed_messages` function.318319Templates are especially useful if inheritance is used. If you want to320know how that works, head over to the :ref:`template-inheritance` pattern321documentation. Basically template inheritance makes it possible to keep
15 unmodified lines
337Markup(u'&lt;blink&gt;hacker&lt;/blink&gt;')338>>> Markup('<em>Marked up</em> &raquo; HTML').striptags()339u'Marked up \xbb HTML'340341.. [#] Unsure what that :class:`~flask.g` object is? It's something you342 can store information on yourself, check the documentation of that343 object (:class:`~flask.g`) and the :ref:`database-pattern` for more344 information.345346347Accessing Request Data348----------------------349350For web applications it's crucial to react to the data a client sent to
246 unmodified lines