jducoeur: (Default)
[personal profile] jducoeur
Here's a bigger and more important question, that [livejournal.com profile] mindways just reminded me about in a comment. I'm looking for opinions: should Querki permit Javascript on pages?

The thing is, *preventing* Javascript has all sorts of costs. Not only does it mean that I can't let people put arbitrary HTML into pages, it means they can't use arbitrary CSS either. (There are more ways to get Javascript into a page than you may realize -- stripping it out reliably is *very* hard.) For Joe-in-the-street end user that doesn't matter, but for the folks with a little technical skill, trying to build cool and pretty shareable Apps, it's a very serious limitation.

So the question is, in the modern environment, with modern browsers, how *dangerous* is Javascript? I'm already planning that every Space will have its own subdomain, which I believe makes most easy XSS attacks fail. (Since browsers have gotten pretty strict about crossing domain lines.) It *does* mean that Apps will be able to load arbitrary Scripts, which means that they can build fairly arbitrary mash-ups, but that's potentially very powerful and not too terribly different from your average website. (I love the potential for mash-ups -- it means that users can, eg, build Apps that embed Google Maps without waiting for me to build that into the heart of the system.)

So I'm looking for opinions here -- some of you have done more security-wonkery than I, and I'm curious what your take is...

(no subject)

Date: 2012-10-25 05:39 pm (UTC)
ext_81047: (Default)
From: [identity profile] kihou.livejournal.com
One thing to keep in mind that came up with user-created sites at MIT: if your website is at foo.querki.com, and mine is at bar.querki.com, by default I can set a querki.com cookie that browsers will send all query.whatever websites. This can let me impersonate a cookie that foo.querki.com expect to only have been set by code running at foo.querki.com. (See http://publicsuffix.org/ and http://en.wikipedia.org/wiki/HTTP_cookie#Supercookie.)

(no subject)

Date: 2012-10-25 07:05 pm (UTC)
ext_81047: (Default)
From: [identity profile] kihou.livejournal.com
Some people were trying to get mit.edu on the Public Suffix list I linked to (there are already some private domains there), but I don't think that ever actually happened. One way people handle it in real life is to make sure that your cookies aren't forgeable by, e.g., signing them, but obviously that's not something you can enforce if people can write arbitrary javascript.

(no subject)

Date: 2012-10-25 07:08 pm (UTC)
ext_81047: (Default)
From: [identity profile] kihou.livejournal.com
Also, on a non-security tangent, allowing Javascript or other nontrivial HTML also makes it impossible to guarantee any sort of pretty PDF/ebook/email/RSS conversion. And people are going to C&P things they don't understand and then not understand why their pretty scrollbars broke some other feature. But, as an advanced user, I'd want to be able to specify spiffy Javascript things and provide some sort of fallback if I expected to be using multiple formats, so it's a thorny issue.

(no subject)

Date: 2012-10-25 07:38 pm (UTC)
ext_81047: (Default)
From: [identity profile] kihou.livejournal.com
I guess one way to do it would be to isolate Javascript into explicit widgets or something, so you could have explicit fallback for non-Javascript-supporting formats and wouldn't be able to use it without some understanding that you were doing something weird. But dunno.

(no subject)

Date: 2012-10-25 07:40 pm (UTC)
laurion: (Default)
From: [personal profile] laurion
Systems like LiveJournal have gone so far as to develop their own theme scripting setup separate from the big systems in part because of problems like this.

(no subject)

Date: 2012-10-27 02:15 pm (UTC)
From: [identity profile] crschmidt.livejournal.com
It essentially means that in the default model for security for webapps, the cookies for the main site can be stolen by anyone who has access to write Javascript in any page in any subdomain, which usually means (in my experience, at least?) that the attacker could then act as any user they could get to hit the page.

I'm sure there are ways to cope with this that aren't immediately apparent to me -- obviously, tying cookies to IPs would be one approach that might help, but then you break logins from different locations without more work, etc. (LiveJournal does this by a more complex login system, where when you want to login, you're redirected through the main site, which then redirects you back to the subdomain with a subdomain specific cookie... or something like that. The details are fuzzy :))

I think user security when content creators are allowed to write Javascript is a difficult, if not impossible, process. (Though I think you've come to largely the same conclusion anyway.)

(no subject)

Date: 2012-10-25 05:59 pm (UTC)
From: [identity profile] ilaine-dcmrn.livejournal.com
I run with javascript disabled via noscript, and only grudgingly allow scripts selectively when I have to. No love.

The BEAST exploit demo code is pure javascript, by way of example of what can go wrong.

Note that the risk of exploit is to your visitors, not to your server. You can't control your users configuration and lack of security, but people who keep a tight configuration would like to be able to use your site without being forced to step back their security posture.

If you are going to use it, and require the client to accept it for the site to function, be stringent with controls to protect the client. Use output encoding in addition to input validation, set all the available security bits on your cookies, check the OWASP page on XSS prevention.

(no subject)

Date: 2012-10-25 06:31 pm (UTC)
From: [identity profile] marphod.livejournal.com
I, likewise, disable Javascript by default. I have no particular desire to be executing arbitrary third party code.

The risk is huge, and current web technology doesn't allow for a secure way to sign the code or otherwise ensure its safety.

While disabling all Javascript would be hard, I'd start with readily achievable filtering. Yes, there are lots of ways to insert javascript into a webpage, but start with the low hanging fruit.

(no subject)

Date: 2012-10-25 07:00 pm (UTC)
dsrtao: (glasseschange)
From: [personal profile] dsrtao
It's a big hairy deal.

You can reduce the unintentional risks by adding a checkbox to the submission for any edit that could contain JavaScript:

[ ] This change includes JavaScript, please allow it.

and filtering it out otherwise.

That can help with people accidentally adding things that they don't understand. It doesn't help with people intentionally adding things beyond their ken, nor blackhats.

Most people do not want arbitrary HTML. Beginners want a point-and-click markup with all the obvious options available, and intermediate folk usually prefer MarkDown or a similar interpolation layer.

[Table]
| Column1 | Column 2 | Column3 |
| data | data | data |

is both as complex and as effective as most people need.

(no subject)

Date: 2012-10-26 01:48 am (UTC)
mindways: (Default)
From: [personal profile] mindways
intermediate folk usually prefer MarkDown or a similar interpolation layer [to HTML].

Really? When I started running a wiki, I had to gently remind a number of users that the markup language was generally easier for everyone to read when looking at the source. Not programmers, either.

(Admittedly, the plural of "anecdote" is not "data".)

(no subject)

Date: 2012-10-28 05:17 pm (UTC)
From: [identity profile] metahacker.livejournal.com
How long ago was that? This has shifted significantly in the past few years.

Actually nowadays people expect WYSIWYG editors on the web, since it's possible now...

(no subject)

Date: 2012-10-28 06:36 pm (UTC)
mindways: (Default)
From: [personal profile] mindways
Ah - this was about 5-6 years ago. And indeed - at the time I installed the wiki, there was minimal WYSIWYG editing (there was a plugin, but it was very flakey and very slow); the modern version has a much better one.

(no subject)

Date: 2012-10-25 07:40 pm (UTC)
From: [identity profile] ilaine-dcmrn.livejournal.com
As a user of a querki app, I may choose to trust the developer, but not necessarily all the other users.

You want your developers to be able to send javascript to the client, but users of the app should not be able to store and reflect javascript to other users. A datastore system that enforced output encoding would help -- the application itself can generate and emit script, but the database and any tainted storage should not be allowed to.

You are still subject to violations of the DOM model whereby scripts from other sites can steal session or other sensitive data from the client, such as described above.

(no subject)

Date: 2012-10-25 07:54 pm (UTC)
From: [identity profile] ilaine-dcmrn.livejournal.com
Another vector is system error messages reflecting user input - ie "I'm sorry I couldn't find the file: *data stealing javascript here*" which could be caused by me getting clickjacked from another window or frame.

If I'm running with script disabled I'm safe, but if I've enabled it to access your site, my session cookie or other data is now gone.

Supporting mashups mean sites in querki will be framed in other sites, wich means they are subject to clickjacking.

Profile

jducoeur: (Default)
jducoeur

October 2025

S M T W T F S
   12 34
567891011
12131415161718
19202122232425
262728293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags