5 ms·
JavaScript by itself isn't evil. A static web site that uses JavaScript to let the user do everything on the client provides more privacy than an old-school web
by bloak 6y ago
JavaScript by itself isn't evil. A static web site that uses JavaScript to let the user do everything on the client provides more privacy than an old-school web site with CGI scripts and forms.
I've been playing with this idea recently. If you want to provide access to a database which is infrequently updated and no bigger than a few megabytes (like the catalogue of a library with 30 000 books), then provide the database with the web page and implement the search function in JavaScript. If you avoid using a JavaScript "framework" then you may find that the web page responds to your typing so instantaneously that you feel like you're back in the 1980s using a Z80-based machine. (You remember those Z80-based word processors that could keep up with a competent typist?)
- clarry 6y agoHere's one live example: https://www.tujavortaro.net/ https://www.tujavortaro.net/
- bloak 6y agoThat's a great example. Instantaneous response to queries even on an ancient Chromebook.
- throwaway_pdp09 6y agoPoint is, it uses JS and how do I know I can trust it? Not this site but in general. As I say elsewhere, JS is not bad, it's an issue of trust that the JS delivered will not abuse your permission to run on your machine.
- bloak 6y agoThat particular site: the code is properly formatted with comments, there's a link to a GitLab repo with the source, you could check your network traffic while using it, ... But in general: I suppose what we need is a flexibly configurable JavaScript engine that stops and asks permission before any suspicious operation is performed. I don't know enough about JavaScript to know whether or how that might work. I note that the way tujavortaro.net downloads a dictionary is by adding a <script> element to the head of the document (https://gitlab.com/sstangl/tuja-vortaro/-/blob/master/app.js#L98 https://gitlab.com/sstangl/tuja-vortaro/-/blob/master/app.js...). HTML+JS is naturally self-modifying, so it's hard to do a static analysis.
- throwaway_pdp09 6y agoJS is a tool. It's not intrinsically evil, but it cannot easily be constrained to be good. I'll come back to that. Your book-search idea is interesting. Another way is simply to display the list on the web page, minimally marked up, and let the user search using the text search in all browsers - no JS needed. Might be a sizeable page though. There may be better ways that don't involve sucking bandwidth to deliver a huge list. Bloom filters? I dunno, needs thought and I'm busy - what do you reckon? But your idea still needs JS. I'm fine with JS if I knew it was doing something minimal and it was highly constrained. That's the problem, not so much running JS as trusting it when it comes from somewhere unknown. Keep up the good thinking though!
- boomlinde 6y ago> A static web site that uses JavaScript to let the user do everything on the client provides more privacy than an old-school web site with CGI scripts and forms. Of course, on the majority of websites I am not doing any interactions where that would be necessary to me in the first place, and on the majority of websites where JavaScript is used, it's used with little mind towards privacy. That it isn't inherently evil is a pretty toothless argument that fundamentally doesn't address the proposed solution you're responding to. The fact that the web is a cesspool of scripts ranging from completely useless to directly user-hostile isn't nullified by use cases that are so rare that you from the top of your head can apparently only hypothesize about them.
- deleted 6y ago[deleted]
- bloak 6y agoPerhaps you're right. Perhaps we need to replace JavaScript with something that can be more easily constrained. There seems to be something wrong with a world in which it is in some ways easier/safer to run an untrusted binary, by putting it in a container, than an untrusted web page. You can of course put the browser in a container, but it's crazy that we have to resort to that. Thanks to Spectre and Meltdown, if you want to be really safe when running untrusted code, you need separate hardware.