Earlier quoted context omitted.
What I don't understand about this viewpoint is, don't all of these caveats also apply to native apps?
Would you be OK with having every website you visit run native byte-code on your computer !? At least for me, it takes some trust to install a native app. I don't trust some companies and would never let them run a binary blob on my computer, still I sometimes visit their web sites, with JavaScript turned off of course. Some sites require JavaScript though, but I can turn on selective parts (using NoScript plugin) an…
WebAssembly 101: A developer’s first steps
141–150 of 153 posts
Re: WebAssembly 101: A developer’s first steps
#142Earlier quoted context omitted.
Well I'm in favor of things running in a sandbox, especially random code delivered over the internet and run automatically in my browser. But aside from that, WebASM has a flat memory model and (so far) no built-in garbage collection. It has very few features, it's very fast to parse and it runs fast too. Even the asm.js version was fast back in 2013 https://hacks.mozilla.org/2013/12/gap-between-asm-js-and-nat... As…
We used to have that back in the day. It was called...installing, I think it was? Then the app...'program'? That was It! Program! Ran at native speed. Amazing how we ever got anything done without carting around an entire browser as an attack surface.
Re: WebAssembly 101: A developer’s first steps
#143Earlier quoted context omitted.
1. is identical on linux distros. How many licenses are you using right now? Probably 20+ distinct licenses as a lowball guess. It's not easy to figure this out, and if it's something you and others really want, i'm sure a standard could be thought up to be able to on-demand get a list of software licenses used in a project which could then be built into browsers similar to sourcemaps. 2. might be more possible with…
1. Eh, if I'm running, say, Ubuntu and haven't turned on the non-free stuff I can make some reasonable assumptions about my baseline rights. 2. I don't think anyone is claiming minified JS is awesomely transparent. WASM is certainly worse than the unobfuscated, unminified JS, which until not long ago was the norm.
The bigger problem, which is also a problem with web scripts in general, is that browsers and script distributors generally make no effort to inform users about what scripts are running, whether they are proprietary or free software, etc.
Mozilla should fix this!
Re: WebAssembly 101: A developer’s first steps
#144Earlier quoted context omitted.
You may like browsing through comments by @nickpsecurity (e.g. https://news.ycombinator.com/threads?id=nickpsecurity&next=1... , etc.). He's really knowledgeable about this stuff, and tries to popularize it as much as he can.
On display in the bottom of a locked filing cabinet stuck in a disused lavatory with a sign on the door saying ‘Beware of the Leopard.”, is this mailing list: https://groups.google.com/forum/#!forum/cap-talk
Re: WebAssembly 101: A developer’s first steps
#145Earlier quoted context omitted.
Would you be OK with having every website you visit run native byte-code on your computer !? At least for me, it takes some trust to install a native app. I don't trust some companies and would never let them run a binary blob on my computer, still I sometimes visit their web sites, with JavaScript turned off of course. Some sites require JavaScript though, but I can turn on selective parts (using NoScript plugin) an…
Not to disagree with you, but native apps are extremely popular and well-accepted on smartphones.
Re: WebAssembly 101: A developer’s first steps
#146Re: WebAssembly 101: A developer’s first steps
#147Earlier quoted context omitted.
> It sounds like it has to prompt users to get permissions: Well, in some sense, yes, but really no: The idea of a PowerBox is that the very action of opening a file already demonstrates the user's intent to grant access. Normally one does not conceive of opening a file as a prompt for permission, because it is necessary to designate a file in the first place. As long as the thing that is being granted access is isol…
Thanks for the video, I'll give it a watch when I'm not at work, so apologies if any of the below is covered by the video. > Well, in some sense, yes, but really no: The idea of a PowerBox is that the very action of opening a file already demonstrates the user's intent to grant access. Normally one does not conceive of opening a file as a prompt for permission, because it is necessary to designate a file in the first…
I can't call myself a capability programmer, but I can take a stab at that:
First, and this sounds glib, but it isn't: one has to decide what the program needs, and arrange that users can grant it that, but not more (of course this is an ideal not a reached endpoint, but I don't want to apologize for an under-applied principle). This is the principle of least authority. Programs, and objects, can't operate without the authority they need. According to cap adherents, most of the work in designing and implementing more-secure systems should be in the detailed working out of what is needed and how objects and programs talk to each other, passing authority to and fro in the process.
To apply the powerbox UI pattern and similar patterns, it isn't necessary for there to be a literal dialog, and in fact a good place to start is: 'what is the UI now, if I were to remove all UI associated with "security"'? So for vim, why not :e? A goal could be to drop the parts where you have to run sudo and type in your password (or maybe there are parts of vim where vim prompts for your password so vim can do that for you, using the resulting ambient authority). Powerbox-like principles have been applied to the command line (e.g. plash; there are more recent systems). That is UI too.
UI patterns, access granularity (e.g. your example: directory cap or file cap?) and access control patterns have to match the problems you want to solve in all their product-/domain-specific detail, like any other part of software engineering. So, if say all you are concerned with is constraining read access on the file level, "opening many files" one at a time and then subsequently "switching between files", there is nothing more to do, and "granting directory access" is not necessary (though it wouldn't imply creeping ambient authority, just coarser-grained access). Only the powerbox needs access to the directory. If you're writing an IDE, there will of course be parts of the IDE that deal with directories. The task of applying object capabilities pervasively to systems like that involves going a long way past the powerbox, and expressing in language-level objects what each part of the system needs and how it obtains and passes on that access (with dramatically lower friction than we commonly have easy access to today). The task of getting the software industry to the the point where that is commonplace involves creative shortcuts that are both useful and feasible, like Google Caja and SES, sandstorm, plash, capdesk, etc (Caja and SES is unusual in advancing both these tasks). How to do that well starting with existing IDEs is a project for an inspired person, not an HN comment, but I sketched some ways below :-)
If it's necessary to provide only temporary access, use patterns like membrane.
While "omit the 'security UI" is a good place to start, Mark Miller (Google Caja, ECMAScript committee, etc.) has said that software security took a wrong turn some time around 1960 (I may be out by a decade or so). If you take that seriously, you should expect that capability security is behind in finding UI patterns that are well-optimized to a parallel world in which obj cap UI and the infrastructure that supports it has been hammered on by creative people for 60 years. ACL UI has been through that process of enormous effort and talent applied to this world in which almost everything is done using ACL security. So, if one wants to find the truth of whether obj caps can provide objectively better UI and security, I'd say the only way to answer those questions is to invent the answers, and see how they hold up. Of course it's made more of a challenge by the need to find the right small steps, and not rewrite all software! But there are plenty of projects that have shown that's possible technically. If you want a path where you don't have to invent new stuff just to stay afloat: of course don't use capabilities.
You may well appreciate this already, but there's an irony to hearing "windows store apps already work this way" (same for iPhone I believe: that's what I was referring to) when for the longest time, a few people knew how to solve the problem, even that was not implemented in real systems. We still don't apply the same lessons in most of software engineering. In fact, I don't know if most of the people who applied it to those mobile systems even knew that what they were doing is called capability security. For me the lesson to take from mobile phone use of powerbox-style UI is that capability-style security patterns work, and that if we applied it, knowing that's what we're up to, I bet that there is much more progress to be had in that direction.
How would you change vim to support just :e-as-powerbox, in a not-yet-cap-friendly world? That's a challenge! Maybe you'd take a heavy, sandboxing approach that tries to cut out the work to make vim use capabilities internally. So perhaps process-level sandbox gvim, pull out the ex line handling into a library, and dynamically link an unsandboxed process that provides an X window that replaces the ex line. Obviously there would be plenty of things to work out there! Similar things have been done before however: e.g. I recall plash also supported sandboxing firefox with a powerbox injected dynamically via LD_PRELOAD (with limited isolation: sandboxing has moved on since then) -- but I would expect vim to be hard. But on past history I am probably missing a trick.
Perhaps more ambitious (I'm not sure), but much more powerful and scalable, maybe you'd choose to start with spacemacs instead of vim, and design an object-capability subset of elisp that still leaves it feasible to port enough elisp to get the project off the ground. Workable obj cap subsets like this, that can interoperate with old code, have been done for other languages (notably JavaScript).
> What happens when I want to install an a different file browser that needs global read/write abilities?
How would you swap out file browsers? In general a good answer is dependency injection. More detail would be getting into detailed software engineering and very specific choices, not to mention the current software landscape (again, the LD_PRELOAD hack is an example). I don't think there is anything intrinsically harder about that with caps than non-cap techniques: in fact the opposite, because capability discipline requires good separation of concerns, and therefore at least encourages dependency injection.
Global read/write abilities? Not sure I follow what you are thinking: A plain-old powerbox typically has global read/write abilities (or only read, if that's what you want). The objects or programs that use the powerbox do not, because they have no means to do so except through the user granting that, using the powerbox. Of course a particular cap system might restrict that further if that was appropriate in the domain.
> How does that work with something like an IDE? You have to pass the compiler a bunch of files names and you'd have to pass the access permission with them, then compiler has to create a new executable with the ability to run and pass the access back to the IDE. And that's just for the simple case. For that matter, how does it work with command line tools that pipe file names between them?
It isn't necessary for compilers to use file names to get access to files, and in fact that's a clear violation of capability discipline: it involves ambient authority. In fact this very example with compilers and file paths happens to be historically the original example of a general situation that causes a whole category of bugs that can be prevented by use of capabilities: see the "confused deputy problem", and the wikipedia entry on ambient authority. For command lines, take a look at plash (or more recent related efforts if that's not on the web any more... if you can't find them, reply and I'll dig). Or just consider this simple example from plain old shell, sans capabilities (from David Wagner):
$ cp foo.txt bar.txt # cp must run with all of the user's authority
$ cat bar.txt # cat needs no authority other than what's given to it
(this doesn't imply that compilers need be ignorant of file names, by the way)
Re: WebAssembly 101: A developer’s first steps
#148Earlier quoted context omitted.
Thanks for the video, I'll give it a watch when I'm not at work, so apologies if any of the below is covered by the video. > Well, in some sense, yes, but really no: The idea of a PowerBox is that the very action of opening a file already demonstrates the user's intent to grant access. Normally one does not conceive of opening a file as a prompt for permission, because it is necessary to designate a file in the first…
> what about something like an IDE where you want to open many files? I can't call myself a capability programmer, but I can take a stab at that: First, and this sounds glib, but it isn't: one has to decide what the program needs, and arrange that users can grant it that, but not more (of course this is an ideal not a reached endpoint, but I don't want to apologize for an under-applied principle). This is the princip…
The answer is: it is a capability system -- or would be, except that something has been ADDED to that clean cap system, which is the ambient authority provided by the open() system call. If not for that (and similar), cp in that second example would be unable to access other files than those.
plash implemented a shell lacking that ambient authority (with limitations due to limited sandboxing at the time) by means of sandboxing at the command level. If I recall correctly you could use it with commands like the first one above, but the resulting semantics were more like the second command: cp could only read foo.txt, and only write bar.txt. In a capability OS (like Google Magenta?) that sandboxing would not be necessary (but OS-level caps are only part of the cap story).
Re: WebAssembly 101: A developer’s first steps
#149Earlier quoted context omitted.
Slightly disconcerted that the first thing webdevs are rushing to do with wasm is to port massive language runtimes to it, continuing the web tradition of piling shit upon shit upon shit. Personally believe that this is totally the wrong idea; compilation or transpilation from intermediate forms is far more interesting and sensible in my view
It's not like people are planning on using these in production. It's just some fun hobby projects that are useful for, say, online Python tutorials and stuff.
There's a fairly large class of scientific computing oriented apps where having a widely deployed and fast VM with CPython compatibility would be fantastic. Python (for better or worse) has a large library of open source computational libraries, but shipping an embedded CPython VM is a pain. As an example, I helped advise an undergrad working on a program to calculate collagen fiber orientation for biomedical research labs. Figuring out cxfreeze or other Python packaging systems took longer than writing the actual app.
Unfortunately JavaScript doesn't have broad scientific library support and grad students in non-CS fields don't always have the time to become versed enough in C/C++ to create a usable app. So CPython & associated C libraries ported to wasm could be quite useful... This could apply to R programs as well.
Re: grandparent, just because a project offends your sense of purity doesn't mean it isn't surprisingly valuable for others.
Re: WebAssembly 101: A developer’s first steps
#150I'm trying to use asm.js to port Python to JS as a shared library, which would allow us to load and run arbitrary CPython modules (compiled for JS) in the browser. I generate code using emscripten, which is also able to generate WASM (which I'm not using at the moment though). My experience so far: Emscripten is quite mature and compiles even very complex C/C++ code without complaining. Statically linking code works…
Slightly disconcerted that the first thing webdevs are rushing to do with wasm is to port massive language runtimes to it, continuing the web tradition of piling shit upon shit upon shit. Personally believe that this is totally the wrong idea; compilation or transpilation from intermediate forms is far more interesting and sensible in my view
BTW a lot of the power of Python, Ruby and JS comes from the interface these languages provide to existing C/C++ codebases, and I assure you that the binding code to make this work is often far from pretty. As end users we don't care about this though as long as it works.