Nothing in this repository ever wrote the file the hard gate reads, so on any machine that had not hand-installed one the guard answered `RulesUnreadable` for every title. Correct fail-closed behaviour, and also the whole story: the first real injection's opening refusal was exactly this. Measured end to end: remove the file and the guard says `RulesUnreadable`; run the Agent and the guard reads its rules and reaches check 1. Four Agent branches exercised against the machine's real rules location, with its own file backed up and restored by hash — already-current, installed-from-nothing, idempotent second run, corrupt-file-replaced. ## Four decisions, each replacing something the design review disproved - **Provenance, not `rulesVersion`.** The first design replaced the installed file when the packaged seed was strictly newer. Measured against this repository's own history, `31825cf` and `ba5355e` both changed the `anticheat` block without touching `rulesVersion`, and `a4a2c63` — the only commit that bumped it — changed the block not at all. The rule would have delivered NONE of the two changes it existed for. The seeder records a hash of what it installed instead. - **`ReplaceFileW`, not `MoveFileEx`.** Measured: `MoveFileEx(REPLACE_EXISTING)` returns `ERROR_ACCESS_DENIED` against a reader holding the guard's exact share mode. Its backup parameter also makes `05_DETECTION`'s "the last valid copy is kept" a mechanism rather than a sentence. - **Validated by the guard's own parser.** `FlGuardCheckRules` — buffer in, `ParseResult` out, no path parameter, so §S3/§S21's "the rules source is not selectable" is untouched. `DetectionRulesFile` never reads the `anticheat` block (§S15), so validating with the managed reader would have checked everything except the half the hard gate consumes, and could have installed a document the guard then refuses for every title while the seeder logged success. - **A usable file we did not write is left alone.** Safe only because the floor is generated from the shipped blocklist: a rules file can ADD and cannot remove. Under the narrow floor the same rule would have handed permanent control of the blocklist to whoever created the file first. An UNUSABLE file is replaced whoever wrote it — there is nothing to clobber and nothing else repairs it. ## Mechanics Random temp name in the DESTINATION directory (same volume, and `%TEMP%` is the inherited-environment vector §S21 closed), opened `FileShare.None`, flushed through to disk before the swap, and a reparse-point check on the directory chain. ## The caller is real `FrameLedger.Agent/Program.cs` was `return 0`. It now runs the seeder and reports the outcome, and a no-op seeder fails 8 Application tests and 2 Infrastructure tests — proven by making it one. ## One regression caught by an existing test `RuleFixtureCorpusTests` walks up from the test binary looking for a directory called `rules`, and this puts one in the test's own output. The walk stopped immediately and every fixture went missing. Re-keyed on `FrameLedger.slnx`. ## §S20 does not close Rewritten to the residual rather than deleted: the HTTPS feed does not exist so FR-7.3 is unmet; the guard still reads no version so binary and data have no handshake, and `13_CI_CD`'s claim that rules-publish checks the bump was false and is corrected; `trustedSigners` is the one allow-widening field a foreign file still controls, inert until §S19(b) wires the signer half; and this is what makes the Vulkan layer's §S2 self-scan reachable for the first time. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
49 lines
2.1 KiB
XML
49 lines
2.1 KiB
XML
<Project>
|
|
|
|
<!--
|
|
Ships rules/detection-rules.json beside the importing project's output, as
|
|
`rules\detection-rules.json`.
|
|
|
|
§S20: the guard reads its blocklist from Local AppData and nothing in this
|
|
repository ever put a file there, so on any machine that has not hand-installed
|
|
one the guard answers RulesUnreadable for every title. The first half of fixing
|
|
that is having the seed in a build output at all — before this file, it was in
|
|
no csproj, no props and no targets.
|
|
|
|
Imported by exactly two projects:
|
|
- FrameLedger.Agent — the sole host (§S18 blocker 3, ratified),
|
|
and the only thing that seeds.
|
|
- FrameLedger.Infrastructure.Tests — asserts the shipped copy is the file CI
|
|
validated, and drives the seeder end to end.
|
|
|
|
NOT imported by FrameLedger.App, for the same reason it does not carry the
|
|
guard DLL.
|
|
-->
|
|
<PropertyGroup>
|
|
<FlSeedRules>$(MSBuildThisFileDirectory)rules\detection-rules.json</FlSeedRules>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<None Include="$(FlSeedRules)">
|
|
<Link>rules\detection-rules.json</Link>
|
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
</None>
|
|
</ItemGroup>
|
|
|
|
<!--
|
|
An ERROR, not a warning, and no Exists() condition on the item above.
|
|
|
|
FrameLedger.Guard.targets warns, because the native build may legitimately not
|
|
have run yet on a fresh clone. This file is different: rules/detection-rules.json
|
|
is checked in, so its absence is not a state anyone builds through — it means
|
|
the repository is wrong. Copying the Guard.targets warn-half here would be the
|
|
gate-that-cannot-fail shape: the seeder would ship, find nothing to seed, and
|
|
report success.
|
|
-->
|
|
<Target Name="FlErrorOnMissingSeedRules" BeforeTargets="Build"
|
|
Condition="!Exists('$(FlSeedRules)')">
|
|
<Error Text="rules/detection-rules.json is missing at $(FlSeedRules). It is checked in; a build without it would produce an Agent that seeds nothing and says it succeeded." />
|
|
</Target>
|
|
|
|
</Project>
|