Unverified Commit add63bd0 authored by Colin's avatar Colin Committed by GitHub
Browse files

firefox_decrypt: 1.1.1 -> 1.1.3 (#493279)

parents befcd4f0 48ba48c3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -584,6 +584,7 @@ in
    _module.args.firefoxPackage = pkgs.firefox-esr-140;
  };
  firefox-syncserver = runTest ./firefox-syncserver.nix;
  firefox_decrypt = runTest ./firefox_decrypt.nix;
  firefoxpwa = runTest ./firefoxpwa.nix;
  firejail = runTest ./firejail.nix;
  firewall = runTest {
+73 −0
Original line number Diff line number Diff line
{ lib, ... }:
{
  name = "firefox_decrypt";

  meta = {
    maintainers = with lib.maintainers; [ schnusch ];
  };

  nodes.machine =
    { pkgs, ... }:
    {
      imports = [ ./common/x11.nix ];
      programs.firefox.enable = true;
      environment.systemPackages = [ pkgs.firefox_decrypt ];
    };

  enableOCR = true;

  testScript = ''
    import csv
    import io
    import random
    import string

    machine.wait_for_x()

    expected: dict[str, str] = {
        "url": "http://localhost",
        "user": "user",
        "password": "".join(random.choices(string.ascii_letters + string.digits, k=32)),
    }

    machine.execute("firefox about:logins >&2 &")

    # press "Add password" button
    # "Search Passwords" is not found by OCR, probably due to too low contrast.
    machine.wait_for_text("No passwords saved")
    for c in ("tab", "\n"):
        machine.send_key(c)

    # add a new password entry
    machine.wait_for_text("Add password")
    for text, control in [
        (expected["url"], "tab"),
        (expected["user"], "tab"),
        (expected["password"], "\n"),
    ]:
        with machine.nested(f"typing {repr(text)}"):
            for c in text:
                machine.send_key(c, log=False)
        machine.send_key(control)

    # "Remove" button for our new entry appeared
    machine.wait_for_text("Remove")

    # close Firefox
    machine.send_key("ctrl-q")
    machine.wait_for_text(r"Quit Firefox or close current tab\?")
    machine.send_key("\n")

    # extract Firefox logins
    credentials = list(
        csv.DictReader(
            io.StringIO(
                machine.succeed("firefox-decrypt -f csv ~/.config/mozilla/firefox"),
                newline="",
            ),
            delimiter=";",
        )
    )
    assert expected in credentials, f"expected {expected!r} in {credentials!r}"
  '';
}
+21 −4
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  lib,
  fetchFromGitHub,
  nss,
  nixosTests,
  nix-update-script,
  stdenv,
  python3Packages,
@@ -9,14 +10,14 @@

python3Packages.buildPythonApplication (finalAttrs: {
  pname = "firefox_decrypt";
  version = "1.1.1";
  version = "1.1.3";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "unode";
    repo = "firefox_decrypt";
    tag = finalAttrs.version;
    hash = "sha256-HPjOUWusPXoSwwDvW32Uad4gFERvn79ee/WxeX6h3jY=";
    hash = "sha256-Y958qXGpkNgMBYiM80OKQYkO7EdqH7T5FfINELAB9CY=";
  };

  build-system = with python3Packages; [
@@ -32,12 +33,28 @@ python3Packages.buildPythonApplication (finalAttrs: {
    (lib.makeLibraryPath [ nss ])
  ];

  passthru.updateScript = nix-update-script { };
  checkPhase = ''
    runHook preCheck

    patchShebangs tests
    (cd tests && ${
      if stdenv.hostPlatform.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH"
    }=${lib.makeLibraryPath [ nss ]} ./run_all)

    runHook postCheck
  '';

  passthru = {
    tests = {
      inherit (nixosTests) firefox_decrypt;
    };
    updateScript = nix-update-script { };
  };

  meta = {
    homepage = "https://github.com/unode/firefox_decrypt";
    description = "Tool to extract passwords from profiles of Mozilla Firefox and derivates";
    mainProgram = "firefox_decrypt";
    mainProgram = "firefox-decrypt";
    license = lib.licenses.gpl3Plus;
    maintainers = with lib.maintainers; [
      schnusch
+2 −0
Original line number Diff line number Diff line
@@ -6338,6 +6338,8 @@ with pkgs;
    fmt_12
    ;

  firefox_decrypt = callPackage ../by-name/fi/firefox_decrypt/package.nix { nss = nss_latest; };

  fmt = fmt_12;

  fontconfig = callPackage ../development/libraries/fontconfig { };