• 1 Post
  • 33 Comments
Joined 1 year ago
cake
Cake day: June 17th, 2023

help-circle






  • Thank you for making an informative and non-alarmist website around the topic of Web Environment Integrity.

    I’ve seen (and being downvoted for arguing against) so many articles, posts, and comments taking a sensationalized approach to the discussion around it, and it’s nice to finally see some genuine and wholly factual coverage of it.

    I really can’t understate how much I appreciate your efforts towards ethical reporting here. You guys don’t use alarm words like “DRM,” and you went through the effort of actually explaining both what WEI does and how it poses a risk for the open web. Nothing clickybaity, ragebaity, and you don’t frame it dishonesty. Just a good, objective description of what it is in its current form and how that could be changed to everything people are worried about.

    Is there anything that someone like me could help contribute with? It seems like our goals (informing users without inciting them, so they can create useful feedback without FUD and misinformation) align, and I’d love to help out any way I can. I read the (at the time incomplete) specs and explainer for WEI, and I could probably write a couple of paragraphs going over what they promised or omitted. If you check my post history, I also have a couple of my own example of how the WEI spec could be abused to harm users.




  • In other posts, I’ve tried to point out how some of the articles and comments around WEI are more speculative than factual and received downvotes and accusations of boot-licking for it. Welcome to the club, I guess.

    The speculation isn’t baseless, but I’m concerned about the lack of accurate information about WEI in its current form. If the majority of people believe WEI is immediately capable of enforcing web page integrity, share that incorrect fact around, and incite others, it’s going to create a very good excuse for dismissing all dissenting feedback of WEI as FUD. The first post linking to the GitHub repository brought in so many pissed off/uninformed people that the authors of the proposal actually locked the repo issues, preventing anyone else from voicing their concerns or providing examples of how implementing the specification could have unintended or negative consequences.

    Furthermore, by highlighting the DRM and anti-adblock aspect of WEI, it’s failing to give proper attention to many of the other valid concerns like:

    • Discrimination against older hardware/software that doesn’t support system-level environment integrity enforcement (i.e. Secure Boot)
    • The ability for WEI to be used to discriminate between browsers and provide poor (or no) service to browsers not created by specific corporations.
    • The possibility of WEI being used in a way to force usage of browsers provided by hostile vendors
    • The ability for it to be used to lock out self-built browsers or forked browsers.
    • The potential for a lack in diversity of attesters allowing for a cartel of attesters to refuse validation for browsers they dislike.

    I very well could be wrong, but I think our (the public) opinions would have held more weight if they were presented in a rational, informed, and objective manner. Talking to software engineers as people generally goes down better than treating them like emotionless cogs in the corporate machine, you know?




  • And here’s a concern about the decentralized-but-still-centralized nature of attesters:

    From my understanding, attesting is conceptually similar to how the SSL/TLS infrastructure currently works:

    • Each ultimately-trusted attester has their own key pair (e.g. root certificate) for signing.

    • Some non-profit group or corporation collects all the public keys of these attesters and bundles them together.

    • The requesting party (web browser for TLS, web server for WEI) checks the signature sent by the other party against public keys in the requesting party’s bundle. If it matches one of them, the other party is trusted. If it doesn’t, they are not not trusted.

    This works for TLS because we have a ton of root certificates, intermediate certificates, and signing authorities. If CA Foo is prejudice against you or your domain name, you can always go to another of the hundreds of CAs.

    For WEI, there isn’t such an infrastructure in place. It’s likely that we’ll have these attesters to start with:

    • Microsoft
    • Apple
    • Google

    But hey, maybe we’ll have some intermediate attesters as well:

    • Canonical
    • RedHat
    • Mozilla
    • Brave

    Even with that list, though, it doesn’t bode well for FOSS software. Who’s going to attest to various browser forks, or for browsers running on different operating systems that aren’t backed by corporations?

    Furthermore, if this is meant to verify the integrity of browser environments, what is that going to mean for devices that don’t support Secure Boot? Will they be considered unverified because the OS can’t ensure it wasn’t tampered with by the bootloader?


  • Adding another issue to the pile:

    Even if it isn’t the intent of the spec, it’s dangerous to allow for websites to differentiate between unverified browsers, browsers attested to by party A, and browser attested to by party B. Providing a mechanism for cryptographic verification opens the door for specific browsers to be enforced for websites.

    For a corporate example:

    Suppose we have ExampleTechFirm, a huge investor in a private AI company, ShutAI. ExampleTechFirm happens to also make a web browser, Sledge. ExampleTechFirm could exert influence on ShutAI so that ShutAI adds rate limiting to all browsers that aren’t verified with ShutAI as the attester. Now, anyone who isn’t using Sledge is being given a degraded experience. Because attesting uses cryptographic signatures, you can’t bypass this user-hostile quality of service mechanism; you have to install Sledge.

    For a political example:

    Consider that I’m General Aladeen, the leader of the country Wadiya. I want to spy on my citizens and know what all of them are doing on their computers. I don’t want to start a revolt by making it illegal to own a computer without my spyware EyeOfAladeen, nor do I have the resources to do that.

    Instead, I enact a law that makes it illegal for companies to operate in Wadiya unless their web services refuse access to Wadiyan citizens that aren’t using a browser attested to by the “free, non-profit” Wadiyan Web Agency. Next, I have my scientists create and release a renamed versions of Chromium and Firefox with EyeOfAladeen bundled in them. Those are the only two browsers that are attested by the Wadiyan Web Agency.

    Now, all my citizens are being encouraged to unknowingly install spyware. Goal achieved!






  • Circular dependencies can be removed in almost every case by splitting out a large module into smaller ones and adding an interface or two.

    In your bot example, you have a circular dependency where (for example) the bot needs to read messages, then run a command from a module, which then needs to send messages back.

        v-----------\
      bot    command_foo
        \-----------^
    

    This can be solved by making a command conform to an interface, and shifting the responsibility of registering commands to the code that creates the bot instance.

        main <---
        ^        \
        |          \
        bot ---> command_foo
    

    The bot module would expose the Bot class and a Command instance. The command_foo module would import Bot and export a class implementing Command.

    The main function would import Bot and CommandFoo, and create an instance of the bot with CommandFoo registered:

    // bot module
    export interface Command {
        onRegister(bot: Bot, command: string);
        onCommand(user: User, message: string);
    }
    
    // command_foo module
    import {Bot, Command} from "bot";
    export class CommandFoo implements Command {
        private bot: Bot;
    
        onRegister(bot: Bot, command: string) {
            this.bot = bot;
        }
    
        onCommand(user: User, message: string) {
            this.bot.replyTo(user, "Bar.");
        }
    }
    
    // main
    import {Bot} from "bot";
    import {CommandFoo} from "command_foo";
    
    let bot = new Bot();
    bot.registerCommand("/foo", new CommandFoo());
    bot.start();
    

    It’s a few more lines of code, but it has no circular dependencies, reduced coupling, and more flexibility. It’s easier to write unit tests for, and users are free to extend it with whatever commands they want, without needing to modify the bot module to add them.


  • eth0p@iusearchlinux.fyitoAsklemmy@lemmy.ml*Permanently Deleted*
    link
    fedilink
    English
    arrow-up
    7
    ·
    edit-2
    1 year ago

    A couple years back, I had some fun proof-of-concepting the terrible UX of preventing password managers or pasting passwords.

    It can get so much worse than just an alert() when right-clicking.

    The codepen.

    A small note: It doesn’t work with mobile virtual keyboards, since they don’t send keystrokes. Maybe that’s a bug, or maybe it’s a security feature ;)

    But yeah, best tried with a laptop or desktop computer.

    How it detects password managers:

    • Unexpected CSS or DOM changes to the input element, such as an icon overlay for LastPass.

    • Paste event listening.

    • Right clicking.

    • Detecting if more than one character is inserted or deleted at a time.

    In hindsight, it could be even worse by using Object.defineProperty to check if the value property is manipulated or if setAttribute is called with the value attribute.


  • This may be an unpopular opinion, but I like some of the ideas behind functional programming.

    An excellent example would be where you have a stream of data that you need to process. With streams, filters, maps, and (to a lesser extent) reduction functions, you’re encouraged to write maintainable code. As long as everything isn’t horribly coupled and lambdas are replaced with named functions, you end up with a nicely readable pipeline that describes what happens at each stage. Having a bunch of smaller functions is great for unit testing, too!

    But in Java… yeah, no. Java, the JVM and Java bytecode is not optimized for that style of programming.

    As far as the language itself goes, the lack of suffix functions hurts readability. If we have code to do some specific, common operation over streams, we’re stuck with nesting. For instance,

    var result = sortAndSumEveryNthValue(2, 
                     data.stream()
                         .map(parseData)
                         .filter(ParsedData::isValid)
                         .map(ParsedData::getValue)
                    )
                    .map(value -> value / 2)
                    ...
    

    That would be much easier to read at a glance if we had a pipeline operator or something like Kotlin extension functions.

    var result = data.stream()
                    .map(parseData)
                    .filter(ParsedData::isValid)
                    .map(ParsedData::getValue)
                    .sortAndSumEveryNthValue(2) // suffix form
                    .map(value -> value / 2)
                    ...
    

    Even JavaScript added a pipeline operator to solve this kind of nesting problem.

    And then we have the issues caused by the implementation of the language. Everything except primitives are an object, and only objects can be passed into generic functions.

    Lambda functions? Short-lived instances of anonymous classes that implement some interface.

    Generics over a primitive type (e.g. HashMap<Integer, String>)? Short-lived boxed primitives that automatically desugar to the primitive type.

    If I wanted my functional code to be as fast as writing everything in an imperative style, I would have to trust that the JIT performs appropriate optimizations. Unfortunately, I don’t. There’s a lot that needs to be optimized:

    • Inlining lambdas and small functions.
    • Recognizing boxed primitives and replacing them with raw primitives.
    • Escape analysis and avoiding heap memory allocations for temporary objects.
    • Avoiding unnecessary copying by constructing object fields in-place.
    • Converting the stream to a loop.

    I’m sure some of those are implemented, but as far as benchmarks have shown, Streams are still slower in Java 17. That’s not to say that Java’s functional programming APIs should be avoided at all costs—that’s premature optimization. But in hot loops or places where performance is critical, they are not the optimal choice.

    Outside of Java but still within the JVM ecosystem, Kotlin actually has the capability to inline functions passed to higher-order functions at compile time.

    /rant