10 ms·
Google, Mozilla Close to Finalizing Sanitizer API for Chrome and Firefox Browse
- nsonha 5y agoso web USB is a thing and this only gets worked on NOW?
- encryptluks2 5y agoSounds like a positive... although, at this point, what looks good may end up actually being bad, like FLoC. Although, I don't understand the uproar over people saying adblock was being removed from Chrome, which still works for me. I think this is a sign that Chromium is actually willing to work with developers to improve APIs.
- Semaphor 5y ago> what looks good may end up actually being bad, like FLoC. FLoC was a google project (this is FF and Google + library author), and it looked bad from the start. > adblock was being removed from Chrome, which still works for me. Adblock, in a way, will still work. Just even worse than now (where uBlock Origin on FF is better than on Chrome). The Manifest V3 change was postponed by google, currently [0] they plan to stop supporting V2 in January 2023 [0]: https://developer.chrome.com/docs/extensions/mv3/mv2-sunset/ https://developer.chrome.com/docs/extensions/mv3/mv2-sunset/
- encryptluks2 5y agohttps://developer.chrome.com/blog/mv2-transition/ https://developer.chrome.com/blog/mv2-transition/ > In the meantime, we will continue to add new capabilities to Manifest V3 based on the needs and voices of our developer community. Even in the last few months, there have been a number of exciting expansions of the extension platform. I have yet to see where Chrome is explicitly telling anyone they plan to phase out support for adblockers, nor where they are making it clear that is their intention. V3 is not yet completed, and is actively being worked on. If they actually do disable adblockers then that is a different story.
- Arnavion 5y ago>I have yet to see where Chrome is explicitly telling anyone they plan to phase out support for adblockers, nor where they are making it clear that is their intention. That was never their intention, not what the uproar was about, so it's to be expected that you're not seeing any evidence of it. The problem with Manifest V3 is not that it disables adblockers; not sure where you got that idea from. The problem is that it severely restricts how effective they can be. Many of the things uBO does cannot be done in v3. That's what the uproar is about. https://github.com/uBlockOrigin/uBlock-issues/issues/338#issuecomment-456171375 https://github.com/uBlockOrigin/uBlock-issues/issues/338#iss... https://github.com/uBlockOrigin/uBlock-issues/issues/338#issuecomment-873602429 https://github.com/uBlockOrigin/uBlock-issues/issues/338#iss...
- encryptluks2 5y agoAgain, these changes aren't taking place until 2023. They are still accepting new features. Yes, everyone is aware that the developer of uBlock threw a fit. It was all over the news, and it was portrayed by the media as Chrome is disabling adblock, because that is essentially the message from Raymond Hill at the time. I think it is good to be aware of these changes, and contribute feedback and try to get compatible or comparable APIs implemented. At no point has Google or Chromium said they are unwilling. If anything, it looked like a prime opportunity for them to scream fire when there was no fire.
- rndgermandude 5y ago>I have yet to see where Chrome is explicitly telling anyone they plan to phase out support for adblockers Why would they ever want to do that? It would be a PR nightmare if they came out and explicitly said "fuck you". Instead they opted to take away capabilities from their APIs with the result of severely limiting adblocker capabilities, under the guise that this improves security and performance, which is not entirely wrong, but at the same time hides the fact that there would have been easy enough alternatives that preserve the capabilities of adblockers and some other API users while making sure the security threats they stated they are concerned about can be prevented[0]. Yet they didn't even really look at what was proposed and insisted on crippling their API in a way it cripples adblockers. I can only conclude that improving security and performance is just one of the engineering goals of their solution, while the other (unstated) goal is to fuck with adblockers. [0] They were particularly worried about extensions being able to intercept requests, examine requests and exfiltrate sensitive data. One way this can be easily solved is by adding a special sandbox for request blocking that has no accessible output to the extension or anywhere else (no backchannel, no access to the network or file system). You can load scripts (and data) into it, but it may only ever talk to the browser itself during request handling. This breaks the "exfiltrate" part.
- tmikaeld 5y agoThis is good of course, however, it will probably take at least 5+ years until a majority of users use eventual browsers that has this feature built-in.
- lloydatkinson 5y agoWhy would it take five years for Chrome to implement it?
- fabiospampinato 5y agoIt's already implemented in Chrome latest, available under a flag. Although support for <svg> and <math> elements is not in yet.
- skrebbel 5y agoIt won't, but it will take a while (not sure about five years) for everybody to be on the latest version. Chrome has nice auto-update but not everybody has it enabled, for all kinds of good and bad reasons.
- wongarsu 5y agoAccording to statcounter.com any new Chrome version is adopted by a large majority of users within 30 days [1]. Sure, some cooperate users hold out much longer, but those seem to be a tiny minority. 1: https://gs.statcounter.com/browser-version-market-share https://gs.statcounter.com/browser-version-market-share
- codedokode 5y agoThere are other browsers except for Chrome. For example there are built-in browsers in smartphones that will never be updated. It is wrong to rely on everyone using a latest version of a browser. Every site should support at least 5 years old browsers and a good site will be usable in 10 years old browser including builtin browser of Windows. Sadly, in reality most sites are made so poorly that they don't open on 5-years old smartphone. It shows how low qualified became modern web developers.
- 0xy 5y agoAlmost every new web API throws a bone to the ad companies who use it for fingerprinting. The AudioContext API dishes out sensitive and specific audio device latency information that can be used to identify you to a high degree of accuracy, even if the web page in question never plays audio. If you're ever bored one day, have a go reverse engineering some adware JS code to see what they're up to. AudioContext for a static ad? Canvas fingerprinting? DRM fingerprinting? All of this has been enabled by both Google and Mozilla, who serve the same ad masters. Mozilla is entirely dependent on ad money, as is Google. So they turn a blind eye to the security disasters being rolled out every month -- which Google's customers subsequently abuse. This will be no different, it's yet another datapoint to identify you when perfectly good userspace solutions have existed forever.
- prox 5y agoYeah I would love to hear someone from Mozilla or Google respond to this.
- hoten 5y agoThere's literally nothing to respond to. There's no sensitive information exposed by this API...or any information, for that matter.
- jiggawatts 5y agoI don't think the fingerprinting capabilities are caused by malice on the behalf of Mozilla or Google. Even if they made $0.00 from ad revenue, they would still be on the losing side of the battle against tracking. You can't have many features without exposing something about the client. As soon as you have things like multiple versions, optional features, plugins, and UI metrics, you've lost the battle already. Just your fonts alone can identify you to a reasonable accuracy. How would you solve this problem? Have everyone run the exact same browser in a virtual machine sandbox, with all traffic running through a common VPN? No plugins, ever? No i18n? No preferences of any type? Upscale a fixed-sized image to your screen's physical resolution and just learn to live with the blur? That's where you'd have to begin, but I guarantee the ad people would find a way around it. Key press cadence timing. Mouse movement patterns. Something. They'll find a way.
- fabiospampinato 5y agoI'm pretty excited about this for two reasons: - First of all it makes sense that this feature is provided by the browser itself and they take some responsibility if it doesn't work right. - Currently the best library for sanitization is probably DOMPurify, and the native Sanitizer API is around 100x faster than DOMPurify, so that would speed up some things dramatically. I just hope it won't take years for Safari to implement this.
- pimterry 5y ago> I just hope it won't take years for Safari to implement this. 1000%. Safari likes to talk big about rejecting new APIs to protect security & privacy, but there's a long list of APIs they haven't implemented just like this, that are strictly beneficial for users. That both Firefox & Chrome have shipped working implementations of this (a serious fix to solve a top 10 OWASP security issue) before Safari has even shown any intent in look at it says a lot imo.
- krono 5y agoOr in april 2021 they finally decide to implement a date input field with picker, but then half-arse and not support min and max properties [0]. A feature not being supported is clear-cut and workable. This current mess where a feature might be supported, with different parts of the spec available only to Safari 14.1 Bug Sur and up but not 14.1 on Catalina is just tiresome. [0] https://caniuse.com/input-datetime https://caniuse.com/input-datetime
- tehbeard 5y agoNo minmax, thanks Apple... Aren't we overdue for another indexedDB fuck up by the Safari Dev team?
- jessaustin 5y agoSshhhh! Don't remind them!
- 5y ago
- tinus_hn 5y agoThis is solving an issue in the browser that should be solved server side. Where is this data they are sanitizing coming from? Why would you want every browser treating this differently?
- dobin 5y agoIt doesnt matter where the data is coming from, it matters what it is able to do. As always with security, if the server attempts to protect the client app by emulating its behaviour, it will go wrong (as the server is never able to emulate the client perfectly). This is a problem in most of the magic black security boxes (WAF, IPS, DLP etc.). The browser knows if a certain piece of data will perform execution or not, as it is the software implementing the functionality. It is the correct app to ask, as it is the one being exploited.
- masa331 5y agoThis is for sanitizing content generated client-side which might not touch server at all. You can create HTML and put it into the DOM on the client
- silon42 5y agoIf you are generating, you should have a whitelist of safe html/css.. Apart from performance this smells of not using a whitelist mechanism (I hope this is not the case).
- masa331 5y agoWhat? Whitelisting is one technique which you can use in sanitizing content generated from unknown sources. If you need to generated such content then it's a probably a special feature of your software and no smell
- kapep 5y ago> this smells of not using a whitelist mechanism What makes you think that? I just skimmed the draft and it seems to use a sensible whitelist as default. Developers can allow or deny additional elements/attributes as they like.
- tannhaeuser 5y agoHave they addressed the points we've discussed 4 months ago [1] (eg where they're reinventing SGML, badly and hard-coded to HTML): [1]: https://news.ycombinator.com/item?id=27061020 https://news.ycombinator.com/item?id=27061020
- nightpool 5y agoSeeing as [nobody seems to have brought it up to them](https://github.com/WICG/sanitizer-api/issues?q=sgml https://github.com/WICG/sanitizer-api/issues?q=sgml), I'm not surprised that they haven't addressed it. But, as always, specific & easy-to-use APIs are going to win out over more "fully general" ones. Are you suggesting that everybody learn DSSSL and write queries like ((match-element? nd '(section title)) (format-number-list (hierarchical-number '("chapter" "section") nd) "1" ".")) Simply to be able to safely display some markup? I for one would much rather work on an AST with normal javascript instead of having to learn another DSL.
- ampdepolymerase 5y agoThe Lisp evangelism team on HN will burn you for that comment :)
- deleted 5y ago[deleted]
- floatingatoll 5y agoThe Lisp evangelism team can speak for themselves :)
- tannhaeuser 5y ago> Are you suggesting that everybody learn DSSSL [...]? Hell, no ;) Just that they pickup SGML insertion contexts as a concept where to escape what chars when that was known in the late 1970s already (ISO 8879 was published in 1986, but took a loong time through the committees). It's incredibly lame they haven't figured DTD/markup grammars and can only handle hard-coded HTML insertion contexts - one more thing to fall off the cliff as HTML evolves, and unnecessarily so. OTOH, it always is fun to show HNers what could've would've been using DSSSL/Scheme in browsers ...
- danShumway 5y agoThis is good. All of this stuff is possible to do already with 3rd-party frameworks with varying levels of performance/reliability, and there may be other methods you use to sanitize your output. If you're a responsible developer, if you have experience trying to guard against XSS, or if you're working with a framework like React/Vue/whatever, this may not change much about your life. However, I think it's understated how many sites struggle with this, and how many of them do sanitization poorly, and it is much better to be able to point them towards a single API and say, "look, just call this function." One of the bigger vulnerabilities I've ever found in a website (https://danshumway.com/blog/gamasutra-vulnerabilities/ https://danshumway.com/blog/gamasutra-vulnerabilities/) was in part a problem directly caused by bad sanitization. When I reported that vulnerability, I didn't advise them to fix their sanitizer because I didn't feel confident it would really fix the problem or that there wouldn't be other issues in the future. I could have pointed them towards something like DOMPurify, but instead I advised that they start embedding posts in iFrames with reduce permissions so any scripts that did run wouldn't be able to get at user data. I wonder if there was more of a standard around this stuff if some engineer on their team might not have caught the problem earlier. Similar to the SameSite changes to cookies, getting a native sanitizer isn't about forcing you to stop doing serverside sanitization or even changing your workflow much at all. It's about making the defaults safer and making it easier for hobby developers (and companies too) to avoid messing up because they don't understand the risks of calling otherwise innocuous functions. What's even more exciting is some of the work going into trusted types (https://web.dev/trusted-types/ https://web.dev/trusted-types/). The sanitizer API gives you a function you can call to get reasonably safe output without a lot of configuration or a 3rd-party framework or knowing what to download. The trusted types API is designed to make it harder to accidentally go outside of that sanitizer. It's not a silver bullet, but it's a big deal for companies where you're trying to set org-wide policies and avoid XSS attacks sneaking in through a random feature by a team that you're not watching closely enough. It's promising to see Firefox/Google working together on this stuff, I hope they continue with other APIs. The ideas are good, they just need iteration and more input, and these kinds of API areas are imo where Google/Mozilla tend to work together pretty well. I'm fairly optimistic about them.
- xeyownt 5y agoThe day Google and Mozilla will merge, they will make Goozilla, even more frightnening than Godzilla.
- chrisweekly 5y agoMods: Title typo - last word should be "Browsers" not "Browse"
- floatingatoll 5y agoOnly way the mods will see that in a timely manner is if you or someone emails them, using the footer Contact link. Otherwise they might not ever realize you posted this.
- lordgrenville 5y ago80 char title limit https://github.com/wting/hackernews/blob/master/news.arc#L1464 https://github.com/wting/hackernews/blob/master/news.arc#L14...
- codedokode 5y agoThere is something wrong with this idea. Sanitizing HTML should be done on the server, not on the client side. Looks like absolutely useless feature that will just make bloated browsers more bloated.
- mftb 5y agoThe article states a couple times in the opening paragraphs that the API is about sanitizing dynamically generated HTML, "Many websites rely on dynamically generated content in the browser. Often, the generated markup includes content provided by outside sources, such as user-provided input, which can include malicious JavaScript code.". So the server would never see this HTML.
- codedokode 5y agoThis is absolutely unclear. If the user enters HTML and that HTML never gets to the server then why sanitize it? To protect user from hacking themselves?
- oh_sigh 5y agoSure, why not? Most users expect that if they paste something into a textbox on a site, that their browser won't send their cookies and browsing history to some random 3rd party
- alanfranz 5y agoGoogle for "reflected XSS". Sometimes a parameter in the URL can be rendered in the user's browser.
- playpause 5y agoUsers may 'hack themselves' when an attacker persuades them to paste something into a website, for example. These are very basic XSS questions by the way, you don't seem to know enough about the subject to be this incredulous.
- dzaima 5y ago
- alanfranz 5y agoRisky. How can you distinguish between an intentionally set script and an attack? Why can't HTML be composed client-side using proper, contextual APIs instead of "sanitizing" it afterwards? It won't work. It reminds me of PHP magic quotes - they didn't work. We'd still need a sanitizer for URLs, of course, those are one of the pesky parts of the web specs.
- wccrawford 5y agoBecause far, far too many web apps need to display user-entered data, and it needs to be sanitized. When markdown is converted to HTML, as it is on this form, it still should be sanitized afterwards to deal with any vulnerabilities that were discovered after the user entered the data, even years later.
- alanfranz 5y ago"and it needs to be sanitized..." clarify your point. If I need to display user-controlled data, I can use a proper API - e.g. var x = document.createElement(); x.textContent = "<script></script>". You can put anything inside textContent. It works because it is contextual; you're creating an element and telling the browser what to do with it (display as text). If you needed better formatting, you would compose the various html elements, you would NOT use innerHTML. DOMPurify performs a string->string conversion, so it's got no context information. I don't understand how this can work. It didn't work for PHP magic quotes. It doesn't work for SQL queries. Why can and should it work for HTML? Remember that "work" implies not just "safe". It implies "it must show what the user wanted to see". Otherwise var sanitize = function(input){ return "<p>";} Would "just work" perfectly.
- wccrawford 5y agoThe output from a markdown to HTML converter is not text content. It's HTML. And it needs to be sanitized before it is added to the DOM. That's just a quick example. There are plenty of other conversions of user data that can't simply be displayed as plain text and need to be converted to HTML. That conversion doesn't always happen in the browser. Sometimes it's actually just straight HTML that needs to be displayed, but because it came from a user, it needs to be sanitized.