mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-12-04 19:46:20 +01:00
* refactor(nixpak): split policy checks into per-app suites Make hardening/tests/policy.nix a small loader that auto-discovers one suite per app under hardening/tests/policy. Shared checks live in policy-lib.nix and common expectations are generated by mkAppPolicy; app files only declare differences and special cases. The loader also discovers wrappers from hardening/nixpaks and fails when wrapper/suite inventory or check names diverge. Assisted-by: DeepSeek Harness (deepseek-flash) * fix(nixpak): reject duplicate per-app policy checks mkAppPolicy merges generated and custom checks, so an extraChecks key could silently override a standard assertion. Fail explicitly when a per-app check name is defined twice. Assisted-by: DeepSeek Harness (deepseek-flash)
32 lines
933 B
Nix
32 lines
933 B
Nix
{
|
|
lib,
|
|
load,
|
|
mkAppPolicy,
|
|
withoutSecretPortal,
|
|
...
|
|
}:
|
|
let
|
|
firefox = load "firefox";
|
|
chromium = load "chromium";
|
|
in
|
|
mkAppPolicy "firefox" {
|
|
network = "host";
|
|
media = true;
|
|
mpris = true;
|
|
notifications = true;
|
|
personalFiles = true;
|
|
browserpass = true;
|
|
secretPortal = false;
|
|
extraChecks = {
|
|
capabilitiesMatchChromium =
|
|
firefox.browserPermissions.media == chromium.browserPermissions.media
|
|
&& firefox.browserPermissions.personalFiles == chromium.browserPermissions.personalFiles
|
|
&& firefox.browserPermissions.browserpass == chromium.browserPermissions.browserpass
|
|
&&
|
|
(removeAttrs firefox.portalGroups [ "secret" ]) == (removeAttrs chromium.portalGroups [ "secret" ])
|
|
&& firefox.desktopIntegration == chromium.desktopIntegration;
|
|
portalCallsMatchChromium =
|
|
withoutSecretPortal firefox.dbus.rules.call == withoutSecretPortal chromium.dbus.rules.call;
|
|
};
|
|
}
|