paretosecurity: 0.2.39 -> 0.3.2

Test for linking had to be removed because now the linking is more
complex and it would take too much mocking to test it.

The test in question was moved to the dashboard codebase that is
closed-source, if that helps in any way.
This commit is contained in:
Neyts Zupan 2025-08-04 13:38:08 +00:00
parent 4c23f3cd2c
commit a667834a5f
2 changed files with 9 additions and 47 deletions

View File

@ -8,37 +8,10 @@
{ {
imports = [ ./common/user-account.nix ]; imports = [ ./common/user-account.nix ];
networking.firewall.enable = true; services.paretosecurity.enable = true;
services.paretosecurity = {
enable = true;
# Create a patched version of the package that points to the local dashboard
# for easier testing
package = pkgs.paretosecurity.overrideAttrs (oldAttrs: {
postPatch = oldAttrs.postPatch or "" + ''
substituteInPlace team/report.go \
--replace-warn 'const reportURL = "https://cloud.paretosecurity.com"' \
'const reportURL = "http://cloud"'
'';
});
};
}; };
nodes.cloud = {
networking.firewall.allowedTCPPorts = [ 80 ];
services.nginx = {
enable = true;
virtualHosts."cloud" = {
locations."/api/v1/team/".extraConfig = ''
add_header Content-Type application/json;
return 200 '{"message": "Linked device."}';
'';
};
};
};
nodes.xfce = nodes.xfce =
{ pkgs, ... }: { pkgs, ... }:
{ {
@ -70,9 +43,8 @@
testScript = '' testScript = ''
# Test setup # Test setup
terminal.succeed("su - alice -c 'mkdir -p /home/alice/.config'") terminal.succeed("su - alice -c 'mkdir -p /home/alice/.config'")
for m in [terminal, cloud]: terminal.systemctl("start network-online.target")
m.systemctl("start network-online.target") terminal.wait_for_unit("network-online.target")
m.wait_for_unit("network-online.target")
# Test 1: Test the systemd socket is installed & enabled # Test 1: Test the systemd socket is installed & enabled
terminal.succeed('systemctl is-enabled paretosecurity.socket') terminal.succeed('systemctl is-enabled paretosecurity.socket')
@ -91,17 +63,7 @@
+ "'" + "'"
) )
# Test 3: Test linking # Test 3: Test the tray icon
terminal.succeed("su - alice -c 'paretosecurity link"
+ " paretosecurity://enrollTeam/?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9."
+ "eyJ0b2tlbiI6ImR1bW15LXRva2VuIiwidGVhbUlEIjoiZHVtbXktdGVhbS1pZCIsImlhdCI6"
+ "MTcwMDAwMDAwMCwiZXhwIjoxOTAwMDAwMDAwfQ.WgnL6_S0EBJHwF1wEVUG8GtIcoVvK5IjWbZpUeZr4Qw'")
config = terminal.succeed("cat /home/alice/.config/pareto.toml")
assert 'AuthToken = "dummy-token"' in config
assert 'TeamID = "dummy-team-id"' in config
# Test 4: Test the tray icon
xfce.wait_for_x() xfce.wait_for_x()
for unit in [ for unit in [
'paretosecurity-trayicon', 'paretosecurity-trayicon',
@ -115,7 +77,7 @@
xfce.succeed("xdotool click 1") xfce.succeed("xdotool click 1")
xfce.wait_for_text("Run Checks") xfce.wait_for_text("Run Checks")
# Test 5: Desktop entry # Test 4: Desktop entry
xfce.succeed("xdotool mousemove 10 10") xfce.succeed("xdotool mousemove 10 10")
xfce.succeed("xdotool click 1") # hide the tray icon window xfce.succeed("xdotool click 1") # hide the tray icon window
xfce.succeed("xdotool click 1") # show the Applications menu xfce.succeed("xdotool click 1") # show the Applications menu
@ -123,7 +85,7 @@
xfce.succeed("xdotool click 1") xfce.succeed("xdotool click 1")
xfce.wait_for_text("Pareto Security") xfce.wait_for_text("Pareto Security")
# Test 6: paretosecurity:// URL handler is registered # Test 5: paretosecurity:// URL handler is registered
xfce.succeed("su - alice -c 'xdg-open paretosecurity://foo'") xfce.succeed("su - alice -c 'xdg-open paretosecurity://foo'")
''; '';
} }

View File

@ -17,16 +17,16 @@ buildGoModule (finalAttrs: {
webkitgtk_4_1 webkitgtk_4_1
]; ];
pname = "paretosecurity"; pname = "paretosecurity";
version = "0.2.39"; version = "0.3.2";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "ParetoSecurity"; owner = "ParetoSecurity";
repo = "agent"; repo = "agent";
rev = finalAttrs.version; rev = finalAttrs.version;
hash = "sha256-goINqrt4ZEC5/WklC4D35wMTpjfJ0dZWfGU3vLWTLjM="; hash = "sha256-TXKymCFr2lrbgmbCxI3vIKx61nbOaRmuUTwNn7k0Hm0=";
}; };
vendorHash = "sha256-tYpTXCx0vp+JX7keu+m5ePrPlGVJZen38HSfQHS4f7s="; vendorHash = "sha256-DlCGCheJHa4HPM7kfX/UbOfLukAiaoP7QZnabkZVASM=";
proxyVendor = true; proxyVendor = true;
# Skip building the Windows installer # Skip building the Windows installer