cross-posted from: https://lemmy.ml/post/12744832

As I updated the version to 1.4.0 , adding the ‘import’ feature I am sharing this here.

I made this extension because I couldn’t find one that wouldn’t ask for too much permissions (such as accessing all websites data).

Eventually I found it nice to have a TOTP that can really be audited, the code is 649 lines of JS, 214 CSS and 52 HTML. Feel free to fork, copy part of it, contribute or just request fix/features.

I have used it for more than a year every day and it works nicely.

  • mox@lemmy.sdf.org
    link
    fedilink
    arrow-up
    39
    arrow-down
    3
    ·
    edit-2
    9 months ago

    I struggle to think of a situation where I would willingly undermine TOTP security by storing the secrets in my web browser.

    Before using this for anything you can’t afford to lose, I suggest thinking twice. And then twice again.


    Edit to elaborate:

    Web browsers are probably the single most targeted component in a desktop computer, have an enormous attack surface, and suffer from an unending stream of vulnerabilities and exploits discovered practically every month. Storing your 2FA secrets there is akin to putting a second lock on your door and hiding the key under the doormat.

    And no, encrypting the secrets in the browser for storage-at-rest does not solve this problem, because it also delegates decryption to the browser. That means an exploited browser can access all of your secrets as soon as you request a TOTP from any of them. Closing it won’t help, because an exploited browser can trivially save or give away a copy of the password you entered, or the decryption key that was generated from it, or the secrets themselves, so your secrets are then compromised forever.

    2FA generators are generally built as stand-alone programs for good reason. Even the ones that offer a browser extension don’t let it access the secret storage.

    Really, think twice before depending on this design for anything important.

    • CameronDev@programming.dev
      link
      fedilink
      arrow-up
      9
      arrow-down
      3
      ·
      9 months ago

      It’s also an extension with 1 review, by a no-name developer, with only 12 installs… definitely would trust that…

      • AYO_Official@lemmy.mlOP
        link
        fedilink
        arrow-up
        15
        arrow-down
        2
        ·
        9 months ago

        Well this is 600 lines of code, if you cannot audit that you can indeed ignore it for now. Once again this is the only auditable code out there and not asking for unrelated permissions.

        • CameronDev@programming.dev
          link
          fedilink
          arrow-up
          4
          ·
          9 months ago

          With all due respect, it doesnt matter what the code is right now. This is an extension that you can update at any point in the future to replace with something malicious.

          Trust is near impossible to build in todays internet.

          https://www.kaspersky.com.au/blog/dangerous-chrome-extensions-87-million/32170/

          Note that a plugin’s malicious functionality can evolve over time in line with its owners’ goals. And the owners themselves may change: there have been cases when malicious features appeared in a previously safe extension after its creators sold the plugin to someone else.

          • AYO_Official@lemmy.mlOP
            link
            fedilink
            arrow-up
            4
            ·
            9 months ago

            This is were the manifest/permission is important. I cannot emphasize enough that I had to code this myself because, at the time, nothing else would be OK with me. This was because of 1- way too big of a code base, 2- way too many permissions.

            It is indeed a problem that extensions are not as well maintained as Linux distribution packages but in this specific instance the extension has no right to read any information nor send requests to any server.

            • CameronDev@programming.dev
              link
              fedilink
              arrow-up
              4
              arrow-down
              1
              ·
              9 months ago

              I appreciate you have put effort into this, and you have gone out of your way to make it safer, but if the extension were to become malicious at a later date, expanding permissions (and relying on users brainlessly-clicking accept) or using an exploit or sidechannel would undo any of that.

              The downside of browser extensions is that they are operating within a massive codebase, and thus have a huge attack surface if they decide to become malicious.

              For what its worth, I commend your efforts here, its just near impossible to trust any peice of software not backed by the reputation of an established company/developer.

      • lemmyreader@lemmy.ml
        link
        fedilink
        English
        arrow-up
        6
        arrow-down
        1
        ·
        9 months ago

        Every software started with 0 reviews, by a no-name developer, with only 1 installs.

        • CameronDev@programming.dev
          link
          fedilink
          arrow-up
          12
          arrow-down
          1
          ·
          9 months ago

          This is a privacy community. Half the posters here think their toaster is listening to their thoughts. Browser extensions are a serious and known vector for malware, installing one from a no-name developer and handing it your tfa codes is a high level of blind trust.

          • lemmyreader@lemmy.ml
            link
            fedilink
            English
            arrow-up
            2
            ·
            9 months ago

            So, are you saying you would use an add-on for OTP by a well known developer (Think about the well-known developers of No-Script and Ghostery and their history) ?

            I see no issue with the add-on of the OP being advertised because some people simply do not use phones at all, so TOTP app is not an option for them. And attack vectors via the browser only apply when the user visits shady web links.

            • CameronDev@programming.dev
              link
              fedilink
              arrow-up
              1
              ·
              9 months ago

              Essentially, yeah? Unless you calculate the OTPs by pen and paper, you have to use some kind of software, and therefore you have to trust that it is safe. Writing your own like OP is actually a very safe option, because you can trust yourself, but everyone else needs to trust OP.

              Attack vectors apply to the add-on itself, it is (potentially) the shady site. OP has the potential to update the add-on later with its own malicious code. This is true of all addons, hence the trust issue.

              I dont have any problem with OP advertising their addon, but potential users should be aware of the risks.