Commit Graph

43 Commits

Author SHA1 Message Date
Javi Martín
7bf4e4d611 Sanitize descriptions in the views
Sanitizing descriptions before saving a record has a few drawbacks:

1. It makes the application rely on data being safe in the database. If
somehow dangerous data enters the database, the application will be
vulnerable to XSS attacks
2. It makes the code complicated
3. It isn't backwards compatible; if we decide to disallow a certain
HTML tag in the future, we'd need to sanitize existing data.

On the other hand, sanitizing the data in the view means we don't need
to triple-check dangerous HTML has already been stripped when we see the
method `auto_link_already_sanitized_html`, since now every time we use
it we sanitize the text in the same line we call this method.

We could also sanitize the data twice, both when saving to the database
and when displaying values in the view. However, doing so wouldn't make
the application safer, since we sanitize text introduced through
textarea fields but we don't sanitize text introduced through input
fields.

Finally, we could also overwrite the `description` method so it
sanitizes the text. But we're already introducing Globalize which
overwrites that method, and overwriting it again is a bit too confusing
in my humble opinion. It can also lead to hard-to-debug behaviour.
2019-10-21 21:32:02 +02:00
Javi Martín
928312e218 Use sanitize in translations with links
Sometimes we're interpolating a link inside a translation, and marking
the whole translations as HTML safe.

However, some translations added by admins to the database or through
crowdin are not entirely under our control.

Although AFAIK crowdin checks for potential cross-site scripting
attacks, it's a good practice to sanitize parts of a string potentially
out of our control before marking the string as HTML safe.
2019-10-08 18:46:21 +02:00
Javi Martín
2aabf79fb4 Rename methods to add auto links to HTML
The name `safe_html_with_links` was confusing and could make you think
it takes care of making the HTML safe. So I've renamed it in a way that
makes it a bit more intuitive that it expects its input to be already
sanitized.

I've changed `text_with_links` as well so now the two method names
complement each other.
2019-10-08 18:46:20 +02:00
Javi Martín
86a205c8fc Extract link to verify account to a mehtod
We were using the same text and the same route in many places.
2019-10-05 14:20:03 +02:00
Javi Martín
f8bd3d4f39 Extract links to signin and signup to methods 2019-10-05 14:07:24 +02:00
Javi Martín
2ccc283bb7 Use the same I18n key for "verify account" text
We were using several different keys, all of them having the same text.
2019-10-05 14:07:24 +02:00
Javi Martín
78c6f6f7e9 Use the same key for "signin" and "signup" texts
We were using the same texts in several places
2019-10-05 14:07:23 +02:00
Javi Martín
da59315530 Don't show links to budget results if disabled 2019-06-06 12:18:05 +02:00
Bertocq
6a46719ff8 Link to results without heading unless its on the results menu 2019-05-16 22:01:42 +02:00
Julian Herrero
c87267d34f Use double quotes in app/views/budgets 2019-03-19 12:16:50 +01:00
María Checa
2dd5fe22a8 Removes permissions for admins to access unfinished budget results 2018-07-26 11:07:19 +02:00
Bertocq
31956312bf Make use of new single_heading_group? on existing similar logic 2018-01-24 12:17:46 +01:00
Bertocq
986ee9c87d Correctly render budget description with html & links 2018-01-18 16:18:27 +01:00
iagirre
e90ac7e72d Admins can see the preview of the budgets' results before the balloting phase is finished.
Cambios para hacer commit:
	modificado:    app/models/abilities/administrator.rb
	modificado:    app/views/budgets/show.html.erb
	modificado:    spec/models/abilities/administrator_spec.rb
	modificado:    spec/models/abilities/everyone_spec.rb
2017-09-26 11:16:32 +02:00
decabeza
b42533062e Improves styles and i18n for budget results 2017-05-19 17:32:10 +02:00
rgarcia
0b68f3c619 cleans up 2017-05-19 14:07:30 +02:00
rgarcia
e7d92fda43 links results from budget's show 2017-05-19 14:04:46 +02:00
decabeza
d49b6e5aa4 adds rel canonical on show views 2017-05-17 14:10:38 +02:00
Juanjo Bazán
81c4a13305 shows links to unfeasible/selected only after budget is balloting 2017-05-09 17:36:42 +02:00
rgarcia
c0488c3b3c refactors investment filters 2017-05-06 04:57:06 +02:00
Alberto Garcia Cabeza
6ab6986d9e adds unselected investment link 2017-05-05 19:07:37 +02:00
Juanjo Bazán
f6989bbb55 Merge pull request #1358 from consul/budget-unfeasibles
Budget unfeasibles
2017-01-17 13:43:48 +01:00
Juanjo Bazán
68fc922fda autolinks budget description 2017-01-17 13:07:07 +01:00
Alberto Garcia Cabeza
45450d74ff improves styles for unfeasible investments 2017-01-16 18:45:42 +01:00
rgarcia
5f7269a070 displays unfeasible budgets link from home 2017-01-16 03:09:08 +01:00
rgarcia
fa9cb00c65 displays appropriate permission messages in accepting phase 2017-01-15 20:37:44 +01:00
Juanjo Bazán
bdb55805a1 uses back_link_helper all around 2017-01-11 13:03:12 +01:00
Alberto Garcia Cabeza
8722699cd8 fixes typos and spec for budgets investments 2017-01-08 22:17:14 +01:00
rgarcia
b4cd1ea9d7 merges with budgets 2017-01-08 19:58:53 +01:00
kikito
b7a0aa3b57 Fixes i18n errors now that they are detected by i18n-tasks 2017-01-06 19:55:23 +01:00
Alberto Garcia Cabeza
0171538a2d updates i18n 2017-01-05 17:23:50 +01:00
kikito
28e6a10382 Hides balloting controls when not in the balloting phase 2017-01-05 15:17:49 +01:00
Alberto Garcia Cabeza
e8dafde39f adds message for not logged users 2017-01-05 13:03:11 +01:00
Alberto Garcia Cabeza
8b1e8fed5b improves styles for budgets views 2017-01-04 19:18:41 +01:00
kikito
9d0e736878 budget description now returns html 2016-12-29 16:22:14 +01:00
kikito
979880f910 adds i18n for budget phases 2016-11-28 19:08:09 +01:00
rgarcia
16794c580c groups and headings navigation 2016-09-10 16:22:43 +02:00
rgarcia
85d70a2cc2 updates group's title 2016-09-10 16:22:41 +02:00
rgarcia
9d4f2d1aff Displays budget groups 2016-09-10 16:22:41 +02:00
rgarcia
6eab5d79a1 comments out budget for city proposals 2016-07-27 13:04:18 +02:00
Alberto Garcia Cabeza
aa1ed87725 Adds styles for budgets 2016-06-08 19:45:09 +02:00
Alberto Garcia Cabeza
0899a0ddb4 Improves styles for budget index and show views 2016-06-07 19:22:15 +02:00
kikito
fa6f34bf5c Adds basic Budget controller / views 2016-05-31 19:26:56 +02:00