Close phase 0 review findings: stricter policy scans, property generator, hook
ci / test (postgres) (push) Successful in 1m24s
ci / test (sqlite) (push) Successful in 1m35s
ci / image (push) Successful in 16s
ci / test (postgres) (pull_request) Successful in 1m11s
ci / test (sqlite) (pull_request) Successful in 1m24s
ci / image (pull_request) Successful in 14s

The independent review found that the policy tests could be bypassed:
Microsoft-named direct packages and GlobalPackageReference slipped past
the dependency check, the live-money scan missed the JSON, Dockerfile
and Unraid template forms, the secret scan missed short project
secrets but would have failed on the user's own ignored .env. The
scans now read only the files git would commit and cover those cases.

Also adds the fixed-seed generator for property tests, the REGISTRY
variables reserved for phase 9 in the CI, a git pre-commit hook in
place of the pre-commit tool (tasks hooks), the missing SPEC 4 facts
in API-NOTES (Fed/ECB/BLS times, USDC depth on OKX) and the full list
of today's indirect packages.

refs #3 refs #5 refs #6

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-10 10:05:10 +01:00
1 parent b4bf864f74
commit 52550ee6d1
15 files changed
+400 -83

No files matched your search

+45 -9
View File
@@ -19,11 +19,15 @@ public sealed partial class LiveSafetyTests
public void NoConfigurationFileEnablesRealMoney()
{
// Configuration-like files only: the documentation quotes the switches to forbid them.
string[] extensions = [".toml", ".env", ".yml", ".yaml", ".json", ".xml", ".ps1", ".sh", ".props"];
string[] extensions =
[
".toml", ".env", ".yml", ".yaml", ".json", ".xml", ".ps1", ".sh", ".props", ".targets", ".csproj",
".runsettings", ".config", ".ini", ".conf",
];
var offenders = Repo.Files()
.Where(f => extensions.Contains(f.Extension, StringComparer.OrdinalIgnoreCase)
|| f.Name.StartsWith(".env", StringComparison.OrdinalIgnoreCase)
|| f.Name.Equals("Dockerfile", StringComparison.OrdinalIgnoreCase))
|| f.Name.StartsWith("Dockerfile", StringComparison.OrdinalIgnoreCase))
.Where(f => LiveSwitch().IsMatch(File.ReadAllText(f.FullName)))
.Select(Repo.Relative)
.ToList();
@@ -33,15 +37,47 @@ public sealed partial class LiveSafetyTests
[TestMethod]
[TestCategory(Category.Unit)]
public void PatternRecognisesBothSwitches()
public void PatternRecognisesBothSwitchesInEveryFormat()
{
Assert.IsTrue(LiveSwitch().IsMatch("ANUBIS_ALLOW_LIVE=1"));
Assert.IsTrue(LiveSwitch().IsMatch(" ANUBIS_ALLOW_LIVE: \"1\""));
Assert.IsTrue(LiveSwitch().IsMatch("allow_live = true"));
Assert.IsFalse(LiveSwitch().IsMatch("ANUBIS_ALLOW_LIVE=0"));
Assert.IsFalse(LiveSwitch().IsMatch("allow_live = false"));
string[] active =
[
"ANUBIS_ALLOW_LIVE=1",
" ANUBIS_ALLOW_LIVE: \"1\"",
"\"ANUBIS_ALLOW_LIVE\": \"1\"",
"\"ANUBIS_ALLOW_LIVE\": 1",
"ENV ANUBIS_ALLOW_LIVE 1",
"$env:ANUBIS_ALLOW_LIVE = '1'",
"<Config Name=\"Soldi veri\" Target=\"ANUBIS_ALLOW_LIVE\" Default=\"0|1\" Type=\"Variable\">1</Config>",
"<Config Target=\"ANUBIS_ALLOW_LIVE\" Default=\"1|0\" Type=\"Variable\">0</Config>",
"allow_live = true",
"\"allow_live\": true",
];
string[] inactive =
[
"ANUBIS_ALLOW_LIVE=0",
"ANUBIS_ALLOW_LIVE: \"0\"",
"ENV ANUBIS_ALLOW_LIVE 10",
"<Config Name=\"Soldi veri\" Target=\"ANUBIS_ALLOW_LIVE\" Default=\"0|1\" Description=\"1: abilita\" Type=\"Variable\">0</Config>",
"allow_live = false",
];
foreach (var line in active)
{
Assert.IsTrue(LiveSwitch().IsMatch(line), "Non riconosciuto: " + line);
}
foreach (var line in inactive)
{
Assert.IsFalse(LiveSwitch().IsMatch(line), "Falso allarme: " + line);
}
}
[GeneratedRegex("""ANUBIS_ALLOW_LIVE\s*[:=]\s*["']?1\b|allow_live\s*=\s*true\b""", RegexOptions.IgnoreCase)]
// Assignments (=, :, JSON, ENV with a space, PowerShell) and the Unraid template's value or default.
[GeneratedRegex(
"""ANUBIS_ALLOW_LIVE["']?\s*(?:[:=]|\s)\s*["']?1\b"""
+ """|Target=["']ANUBIS_ALLOW_LIVE["'][^>]*>\s*1\s*<"""
+ """|Target=["']ANUBIS_ALLOW_LIVE["'][^>]*\bDefault=["']1\b"""
+ """|allow_live["']?\s*[:=]\s*["']?true\b""",
RegexOptions.IgnoreCase)]
private static partial Regex LiveSwitch();
}