From ff15157fc0b091a69c385aea3037bdadadf980c4 Mon Sep 17 00:00:00 2001 From: "0m.ax" Date: Fri, 6 Nov 2026 12:45:22 +0100 Subject: [PATCH] inital commit --- flake.lock | 24 ++++++++++++++ flake.nix | 56 +++++++++++++++++++++++++++++++++ navigator-webdriver-false.patch | 20 ++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 navigator-webdriver-false.patch diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..37bd263 --- /dev/null +++ b/flake.lock @@ -0,0 +1,24 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1790769526, + "narHash": "sha256-6j4yqqBUvIbBn29k0y/2jqlv/YJd8CRkTBYhfm5Z/8c=", + "rev": "c9fe7d12cd78d1adcd12dd15e24432dde5b155a0", + "type": "tarball", + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.11pre1082837.c9fe7d12cd78/nixexprs.tar.zst" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..099ac36 --- /dev/null +++ b/flake.nix @@ -0,0 +1,56 @@ +{ + description = "Covert Firefox for the firefox-devtools MCP: navigator.webdriver always false"; + + inputs.nixpkgs.url = "nixpkgs"; + + outputs = + { self, nixpkgs }: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + forAllSystems = nixpkgs.lib.genAttrs systems; + in + { + packages = forAllSystems ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + rec { + # Firefox built from source with dom/base/Navigator.cpp patched so + # Navigator::Webdriver() never reports automation. Marionette and + # WebDriver BiDi keep working; only the JS-visible flag is false. + firefox-covert = pkgs.wrapFirefox ( + pkgs.firefox-unwrapped.overrideAttrs (old: { + patches = (old.patches or [ ]) ++ [ ./navigator-webdriver-false.patch ]; + }) + ) { }; + default = firefox-covert; + } + ); + + devShells = forAllSystems ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + # Shell where `firefox` is the patched build. The firefox-devtools + # MCP auto-detects its browser via PATH, so running it from here + # picks up the covert build with no extra flags: + # nix develop .#mcp --command npx -y @mozilla/firefox-devtools-mcp@latest --autoProfile + mcp = pkgs.mkShellNoCC { + packages = [ + self.packages.${system}.firefox-covert + pkgs.nodejs + ]; + shellHook = '' + echo "firefox-devtools MCP devshell: firefox -> $(command -v firefox)" + ''; + }; + } + ); + }; +} diff --git a/navigator-webdriver-false.patch b/navigator-webdriver-false.patch new file mode 100644 index 0000000..c03002c --- /dev/null +++ b/navigator-webdriver-false.patch @@ -0,0 +1,20 @@ +--- a/dom/base/Navigator.cpp ++++ b/dom/base/Navigator.cpp +@@ -2356,7 +2356,7 @@ + bool isBrowserAutomationRunning = false; + marionette->GetIsBrowserAutomationRunning(&isBrowserAutomationRunning); + if (isBrowserAutomationRunning) { +- return true; ++ return false; // firefox-covert: never report automation + } + } + +@@ -2365,7 +2365,7 @@ + bool isBrowserAutomationRunning = false; + agent->GetIsBrowserAutomationRunning(&isBrowserAutomationRunning); + if (isBrowserAutomationRunning) { +- return true; ++ return false; // firefox-covert: never report automation + } + } + #endif