5 ms·
Slimium: Debloating the Chromium Browser with Feature Subsetting
- nikisweeting 6y agoWould love to use this for ArchiveBox so we can get smaller Docker image sizes while still including Chromium headless. Is there a docker POC anywhere I can check out? https://github.com/cxreet/chromium-debloating https://github.com/cxreet/chromium-debloating seems empty at the moment.
- graderjs 6y agoIsn't the image size mostly independent of chrome? Docker images are gigabytes, right? But chrome is only ~60 Mb.
- amarshall 6y agoImages can be quite small. Debian slim image is 25.9 MB compressed. Alpine image is 2.7 MB compressed. Meanwhile, Selenium’s standalone Chromium image is 348.1 MB compressed.
- josteink 6y ago> Meanwhile, Selenium’s standalone Chromium image is 348.1 MB compressed. Selenium implies you have quite a bit of a developer stack, runtimes and SDKs installed too. It would be unfair to attribute all that usage to Chrome alone.
- hiisukun 6y agoNot aware of the docker image in question, but a docker image starts empty (0 bytes). A full operating system (Ubuntu 20.04) base is is 75MB. You can probably slim that down a bit if you needed, but installing your software on top might only take a few MB. So cutting chrome down from 60MB could well be a good goal.
- nikisweeting 6y agoUnfortunately our image is ~450MB right now because we have install both Python and JS, Chrome, fonts, vido codecs, and a bunch of other software for all the extractors. Most of it is from this killer 266MB line, but unfortunately we need all these things: apt-get update -qq && \ apt-get install -qq -y --no-install-recommends \ wget curl chromium git ffmpeg youtube-dl \ fontconfig fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-symbola fonts-noto fonts-freefont-ttf && \ rm -rf /var/lib/apt/lists/* https://hub.docker.com/layers/nikisweeting/archivebox/latest/images/sha256-50c2ce319243c72124f29132ccb45410e64ec3c8ce6cab50a91160687a406358?context=explore https://hub.docker.com/layers/nikisweeting/archivebox/latest... Any 10MB here or there will help, whether it's from Chrome core or something else. If you have any suggestions I'm all ears!
- dflock 6y agoMaybe give this a try: https://github.com/docker-slim/docker-slim https://github.com/docker-slim/docker-slim
- graderjs 6y agoYeah the fonts take alot. Why do you need to slim the images down? Do you really need the fonts present to archive the content, I thought you were saving the HTML, wouldn't these fonts just be needed to render?
- nikisweeting 6y agoThe fonts are for PDF and screenshot rendering.
- graderjs 6y agoHave you considered doing the install at usage time? If you're trying to save on bandwidth of downloaded images....
- 6y ago
- javajosh 6y agoNeeds a "(PDF)", dang.
- LeifCarrotson 6y agoI understand that you're referring to the username, not the expletive...but who is still browsing HN on a machine where it's a problem when you click a link and it's unexpectedly a PDF? That mattered several years ago, but I exoect most users probably have embedded PDF viewers in their browsers today.
- qqii 6y agoIt's still not an especially pleasant experience on mobile.
- TheRealPomax 6y agoEvery mobile phone? You click the link expecting an article, and your phone starts downloading a large PDF instead (4MB, what the what?). This needs a (pdf) in the title, because it's a pdf file, not an web page.
- RandallBrown 6y agoiPhones handle PDFs just fine?
- paulirish 6y agoOk!
- codetrotter 6y ago> your phone starts downloading a large PDF instead (4MB, what the what?). I agree about the parent point of marking PDF as such but still feel compelled to point out that a 4 MB PDF is not significantly bigger than a lot of regular pages that are posted to HN. In this very moment the currently highest ranked link, which is just a regular web page, on the HN front page had a total network payload of 3,937 KiB according to Google PageSpeed. I sympathize with what you are saying though in general, and I think it is sad that so much mobile bandwidth is needed in order to read stuff. The way that I personally get around this is that when I am on mobile I mostly restrict myself to reading HN comments instead of clicking through on any of the featured links themselves. But depending on how you like to use your phone I realize this might not be feasible to switch habit into.
- nickodell 6y agoSo what happens if a removed function is called? Or can you guarantee that won't happen?
- LeifCarrotson 6y agoFor some, sure, if an API implements "new foo(), new foo(string), new foo(string, int), and new foo(string, int, int)" but the code that uses the library only uses "new foo()" and sets the other properties after creating the object then it would eliminate the extra constructors. Figuring out what stuff gets called is really hard in something as big as Chromium, where there are so many components that in some spots have their own domain-specific language to link stuff together. For others, no, they do allow the minifier to break some sites: they analyze the Alexa top 1000 and check which functions get called and how often by those sites.
- hcs 6y agoThey replace it with some illegal instruction, so the process crashes. With a lot of logic running in per-origin processes, this may only bring down one tab instead of the whole browser. Edit: Or maybe the error handling can avoid killing a process? This is what the paper says, but I feel like a child process would almost certainly be killed: > Code elimination is trivial because we nullify unused code with illegal instructions based on known binary function boundaries. Once the instructions triggers a Chromium’s error handling routine that catches an exception, an error page shows an “Aw, Snap!” message by default instead of crashing a whole Chromium process. (section 5, p467)
- johntb86 6y agoChromium displays an "Aw Snap!" message when a renderer process dies.
- high_priest 6y agoThere is a tremendous need for a minimalistic chromium project that would coexist well with the Linux Tiled Window Manager ecosystem. With downloads passed outside the browser, favorites stored in some sort of JSON and support for native WM tabbing.
- skizziepop 6y ago"tremendous" might be overstating the market of all 8 suckless surf users
- wffurr 6y agoThere's only 8 of them but they need it real bad.
- rnhmjoj 6y agoWhat about qutebrowser? It's based on QtWebEngine (a sort of ungoogled chromium), has a minimal UI, extremely customisable and can be extended with userscripts (nothing to do with js). You can do stuff like editing textareas in your editor by spawning a subprocess, open a video with mpv, pipe something to dmenu.
- octoberfranklin 6y agoIt's called qutebrowser. It is awesome.
- TheRealPomax 6y agoThis is definitely (pdf)
- tsjq 6y agoIs this UnGoogled or not ?
- dheera 6y agoI'd actually be interested in a Chromium browser that instead of removing HTML5 functionality, replaces it with simulated fake data. For example, allow access to the geolocation API, but give it a fake location. Allow access to third-party cookies, but shove garbage back at the server. Allow access to the camera and microphone but play a specified pre-recorded video back for both. This helps get past websites that evilly require access to these permissions to function. It also would help in the case of e.g. store websites that want your location permission to give you the closest store website, and in which I am okay with giving them a city-level accuracy (because I'd be entering the city name anyway in a manual search) but don't want my exact coordinates going to them.
- hedora 6y agoI’d love for this idea to be applied to tracking cookies. Just keep a pool of a hundred million of them, and send some at random with each request.
- dheera 6y agoHmm maybe I could use injected JavaScript and allow third party cookies in Chromium but use my injected JavaScript to randomly flip some bits in all third party cookies. And first party cookies for sites that I haven't explicitly whitelisted. I also wonder how many database backends this will trip up due to invalid IDs, though that's not really my intention.
- nikisweeting 6y agoThis is doable right now with some effort, which I kind of like because it keeps the cat-and-mouse game paused for a while. The moment someone makes a one-click browser that lets the average person spoof all these things, then sites are going to start building captcha-style verification mechanisms like having to "wink three times" in your video to get it to proceed.
- dheera 6y ago> mechanisms like having to "wink three times" in your video to get it to proceed Deepfakes are already here, we have that cat (or mouse) taken care of.
- systemvoltage 6y agoWe need to stop browser development besides security patches. No new features and start taking features off.
- octoberfranklin 6y agoand world peace and a pony
- RantyDave 6y agoWith the exception of reducing the exploitable surface, what is the point of debloating chrome? Code only gets pulled off disk and into memory, and out of memory and into the cache if it actually gets called yes? So the initialisation code for something like WebUSB would get called as the browser wakes up, but then never called again and the majority of it would never even make it off the disk. Are there really gains to be made here?
- Rebelgecko 6y agoProbably disk space. Saving webUSB once isn't a big deal, but if you have 30 copies of Chromium on your computer it could add up
- londons_explore 6y agoEven SSD's have appreciable latency. That means you typically read far more code into RAM than you need to run. Having said that, the executable size in RAM is tiny compared to the runtime ram usage.
- lern_too_spel 6y agoWhat debloating tools are there for the Android NDK? For any code that ends up dexed, R8 takes care of it, so it's not terrible if I add a library dependency with a lot of code I don't need. I haven't found anything similar for native libraries.
- chenxiaolong 6y agoOne thing I've done in a project before was statically linking all of my native library's dependencies into the library itself. Everything would be compiled with `-ffunction-sections -fdata-sections` and the final shared library linked with `-Wl,--gc-sections`. I'd call `strip` on the `.so` as well. This worked well because the JVM code only ever called the native API I exposed and did not need to access the dependencies' APIs.
- lern_too_spel 6y agoI'm specifically looking for what R8 calls "tree-shaking."
- tsjq 6y agoDoes it still have google's tracking after this debloating ?
- taneq 6y agoWere they deliberately going for a connotation of "slimy"? If not they might want to add an 'm' to make it "Slimmium".
- hnarn 6y agoEnglish is not nearly a consistent enough language to make the argument that “slimium” can’t be spelled as-is and still be pronounced like “slim” — and personally I think “slimmium” just looks weird.
- taneq 6y agoThe two-consonants-means-preceeding-vowel-is-short rule is pretty fundamental though.
- lifthrasiir 6y agoThat reminds me of .kkrieger, a 96KB FPS developed by the demoscene group Farbrausch which was aggressively subsetted in the same fashion at the very last minute [1]. This approach worked very well... until it didn't. It is interesting to see the history repeating itself---with the same caveat! [1] https://fgiesen.wordpress.com/2012/04/08/metaprogramming-for-madmen/ https://fgiesen.wordpress.com/2012/04/08/metaprogramming-for...
- asdfk-12 6y agoPlease add [PDF] to the title of this post.
- justaj 6y agoI've uploaded this PDF to archive.org [0] because I find it preposterous that acm.org _requires_ cookies despite them being blocked client-side. [0] https://archive.org/details/3372297.3417866 https://archive.org/details/3372297.3417866
- hilbert42 6y agoI've only just had time to glance at this paper and I've already found it to be very informative. There are types of web operations that I've not much need for so I've long advocated that it would be good if there were ways of either rendering them inoperative or depreciating certain aspects of their operation for the purposes of either improving user privacy/security or improving the browser's performance. In particular, the JavaScript engine could be modified in ways that would allow it to be tailored to the user's requirements such as to improve the speed of the rendering of web pages by having it ignore the huge amounts of dross/bloat that's now found in a large percentage of of web pages. Same would apply to user privacy, JS could be tweaked to either ignore certain requests for privacy-sapping info or where necessary spoof them with quasi-random junk ('quasi-random' here refers to data that's inaccurate but its format and structure still satisfies any validity checks the server may perform). The same philosophy applies to other aspects of browser operation that I won't bother to cover here. To do this clearly requires a detailed understanding of the browser's complex operations and that's not easy for someone—even a good programmer—who only approaches a browser's internal functions as a means to an end to quickly change some facet of its operation. It seems from what I've read so far, this paper could initiate new more detailed work and or lead to the development of tools that would make browser tailoring much easier and simpler.