Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
260736ea58 |
No files matched your search
+13
-17
@@ -92,25 +92,21 @@ jobs:
|
||||
# not part of `build.ps1 check`: it mutates HKCU, and a CI runner is the
|
||||
# wrong place to be registering machine-wide Vulkan layers.
|
||||
|
||||
# -SkipIntegration, and the reason is a MEASURED property of the hard gate
|
||||
# rather than CI being awkward.
|
||||
#
|
||||
# The drain end-to-end tests inject the Overlay into hook-harness, which
|
||||
# makes the TEST HOST the target's parent — and §S16 puts a target's
|
||||
# ancestors in the scan set. A .NET host can load
|
||||
# System.Security.Cryptography.ProtectedData.dll, whose name contains the
|
||||
# heuristic fragment `protect`, so the guard refuses our own harness with
|
||||
# SuspiciousUnsigned. Measured here on 2026-08-05; it passes on a dev box
|
||||
# whose test host happens not to load that assembly, which is why CI is the
|
||||
# machine that found it.
|
||||
#
|
||||
# That is the guard behaving as specified. The defect is §S19(b) — the
|
||||
# fragment matching a benign, widely-loaded Microsoft assembly — and fixing
|
||||
# it is a guard change with its own PR, not something to work around here.
|
||||
# Until then these run locally and CI says out loud that it skipped them.
|
||||
# NO -SkipIntegration, since 2026-09-06, and the reason it was here is worth
|
||||
# keeping: the drain end-to-end tests inject the Overlay into hook-harness,
|
||||
# which makes the TEST HOST the target's parent — §S16 puts ancestors in the
|
||||
# scan set — and a .NET host loads System.Security.Cryptography.ProtectedData.dll,
|
||||
# whose name carries the heuristic fragment `protect`. From 2026-08-05 the
|
||||
# guard refused our own harness here with SuspiciousUnsigned, and CI said out
|
||||
# loud that it skipped nine cases. §S19(b)'s signer half now verifies that
|
||||
# module's embedded signature offline and reads O=Microsoft Corporation, so
|
||||
# the refusal is gone for the reason 19_SAFETY always gave ("fragment AND not
|
||||
# signed by a known vendor"), and the nine cases are in the merge gate. The
|
||||
# switch still exists in build.ps1 for a developer who must, and it skips
|
||||
# loudly; CI is no longer a place it is passed.
|
||||
- name: Quality gate
|
||||
shell: pwsh
|
||||
run: ./build.ps1 check -SkipIntegration
|
||||
run: ./build.ps1 check
|
||||
env:
|
||||
CI: 'true'
|
||||
|
||||
|
||||
@@ -19,6 +19,25 @@ GitHub release body, so a missing section will mean an empty release note.
|
||||
|
||||
### Added
|
||||
|
||||
- **The guard's signer half — the other conjunct of "name fragment AND not signed by a known vendor" —
|
||||
and the nine integration cases in the merge gate (§S19(b) row G1; owner's bound decision 2026-09-06).**
|
||||
Since 2026-08-05 the guard refused FrameLedger's own test host on CI because a .NET host loads
|
||||
`System.Security.Cryptography.ProtectedData.dll` and `protect` is a heuristic fragment, and CI skipped
|
||||
the drain, pause, drop and capture-host end-to-end cases. `fl-probe-signer`'s three legs (dev box, CI,
|
||||
the owner's adapters-disabled run) all read the same: the embedded signature verifies offline with
|
||||
`O=Microsoft Corporation`, ~2–4 ms, no verdict changing without a network. So `Sources` gained
|
||||
`ModuleSignerOrganisation` — `WinVerifyTrust` under `WTD_REVOKE_NONE | WTD_CACHE_ONLY_URL_RETRIEVAL`,
|
||||
then the certificate's `O=` — and the module sink trusts a fragment-matching module only when that
|
||||
organisation is on the rules file's `trustedSigners` AND on the list compiled into the binary
|
||||
(`IsCompiledTrustedSigner`: the data may narrow, never widen). A trusted module keeps the scan
|
||||
looking; the target is judged like its ancestors; no signature, an invalid one, an unreadable `O=`, a
|
||||
null path or seam, a failing seam, one list without the other — all refuse. The catalog half stays
|
||||
deferred with its rationale. `hook-harness --load` proves both directions against the real seams
|
||||
(the NuGet blocker allowed; our own unsigned Overlay under a `protect` name refused, by name); nine
|
||||
fake-seam cases pin the decision. `ci.yml` runs `./build.ps1 check` with no switches; the switch stays
|
||||
in `build.ps1`, loud. `19_SAFETY`, §S19(b), §S29(a), `13_CI_CD`, `12_BUILD`, `HANDOFF` and the rules
|
||||
file's own comment carry it.
|
||||
|
||||
- **Rung 3 by elimination, and the executable file as the census's second witness (HANDOFF 7b / §H11,
|
||||
owner's choice 2026-09-06).** `frame generation: Active (technology not identified)` now prints every
|
||||
exclusion the session can make beside it — not DLSS-G when the NVIDIA driver's FG word reports no feature
|
||||
|
||||
@@ -29,18 +29,18 @@ param(
|
||||
# Excludes tests traited Category=Integration -- today, the drain end-to-end
|
||||
# cases, which inject the Overlay into hook-harness.
|
||||
#
|
||||
# CI PASSES THIS AND A DEVELOPER MUST NOT. The reason is a MEASURED property of
|
||||
# the hard gate, not flakiness: §S16 puts the injecting process's ancestors in
|
||||
# the scan set, so the test host is scanned, and a .NET host can load
|
||||
# System.Security.Cryptography.ProtectedData.dll -- which contains the
|
||||
# heuristic fragment `protect`. The guard then refuses our own harness with
|
||||
# SuspiciousUnsigned. That is the gate working exactly as specified;
|
||||
# 20_OPEN_QUESTIONS §S19(b) is the defect, and it is a guard change with its
|
||||
# own PR rather than something to paper over here.
|
||||
# NOBODY PASSES THIS ANY MORE, and it is kept so that the day someone must, the
|
||||
# skip is loud. CI passed it from 2026-08-05 to 2026-09-06 for a MEASURED reason:
|
||||
# §S16 puts the injecting process's ancestors in the scan set, a .NET test host
|
||||
# loads System.Security.Cryptography.ProtectedData.dll (heuristic fragment
|
||||
# `protect`), and the guard refused our own harness with SuspiciousUnsigned.
|
||||
# 20_OPEN_QUESTIONS §S19(b)'s signer half now verifies that module's embedded
|
||||
# signature offline (O=Microsoft Corporation, on the compiled-in bound), so the
|
||||
# refusal is gone for the reason the heuristic always stated, and CI runs
|
||||
# `./build.ps1 check` with no switches — the same command a developer runs.
|
||||
#
|
||||
# It skips LOUDLY, because a suite that quietly stops running one class is how
|
||||
# a gate rots. Whatever CI does, `./build.ps1 check` with no switches runs
|
||||
# everything.
|
||||
# a gate rots.
|
||||
[switch]$SkipIntegration
|
||||
)
|
||||
|
||||
|
||||
+4
-3
@@ -196,9 +196,10 @@ document the app displays for acceptance (FR-11) is a defect, not a template.
|
||||
> list of what `check` does was missing 40% of it, which is worse than having no list: a reader
|
||||
> plans against it. `13_CI_CD.md` repeats the struct-mirror claim and is corrected with it.
|
||||
|
||||
CI runs the identical script (`13_CI_CD`), **with `-SkipIntegration`** — so a green CI is not
|
||||
evidence for anything touching the managed drain, and `./build.ps1 check` with no switches is what a
|
||||
developer runs before pushing.
|
||||
CI runs the identical script (`13_CI_CD`) with no switches since 2026-09-06 — `-SkipIntegration` was
|
||||
CI's from 2026-08-05 until §S19(b)'s signer half removed the refusal behind it — so a green CI is now
|
||||
evidence for the managed drain too, and `./build.ps1 check` with no switches is what a developer runs
|
||||
before pushing.
|
||||
|
||||
**Gates skip loudly.** A gate whose tool is not installed (no `cl.exe`) or not
|
||||
yet written prints `SKIPPED`, is listed again in the summary, and the run ends
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@ FrameLedger uses the **`poli0981/.github` ops repo** where its templates fit, an
|
||||
|
||||
### `ci.yml` — push to `main` + all PRs · **repo-local**
|
||||
- `runs-on: windows-latest`, .NET SDK pinned by `global.json` via `actions/setup-dotnet`, MSVC via `ilammy/msvc-dev-cmd`, NuGet cached.
|
||||
- Single step of substance: **`./build.ps1 check -SkipIntegration`** — the same script a developer runs before pushing. The gate list lives in `12_BUILD` §Local quality gate, **once**, rather than being restated here where it goes stale.
|
||||
- **`-SkipIntegration` is the one place local and CI deliberately differ**, and the reason is a measured property of the hard gate rather than flakiness: §S16 puts the injecting process's ancestors in the scan set, a .NET test host can load `System.Security.Cryptography.ProtectedData.dll`, and the guard's `protect` fragment then refuses our own harness (§S19(b)). So a green CI is **not** evidence for anything touching the managed drain or the capture host's end-to-end behaviour.
|
||||
- Single step of substance: **`./build.ps1 check`** — the same script, with the same switches (none), a developer runs before pushing. The gate list lives in `12_BUILD` §Local quality gate, **once**, rather than being restated here where it goes stale.
|
||||
- ~~**`-SkipIntegration` is the one place local and CI deliberately differ**~~ — **gone since 2026-09-06.** From 2026-08-05 CI passed it for a measured reason: §S16 puts the injecting process's ancestors in the scan set, a .NET test host loads `System.Security.Cryptography.ProtectedData.dll`, and the guard's `protect` fragment refused our own harness (§S19(b)). The signer half now verifies that module's embedded signature offline and reads `O=Microsoft Corporation` on the compiled-in bound, so the nine `Category=Integration` cases run here, and a green CI IS evidence for the managed drain and the capture host's end-to-end behaviour. The switch remains in `build.ps1`, loud, for a developer who must.
|
||||
- **Signer probe step** (2026-09-06): `fl-probe-signer` runs as its own step after the gate — `continue-on-error`, a measurement and not a gate — because `ctest fl_signer_probe` passes on a regular expression and prints nothing, so §S19(b)'s CI leg was never readable from the log. Its answers are read off this step.
|
||||
- Uploads coverage artifacts.
|
||||
- **Changelog gate**, on pull requests only: the changed-file list comes from GitHub's own view of the PR — not `git diff`, so a shallow checkout cannot silently produce a short one — and an empty list is refused rather than read as "no `src/` changes". It is a **step of the required `check` job** and deliberately not a job of its own: `main`'s required contexts are exactly `check` and the two `analyze` jobs, so a new job would go red while the merge button stayed green, which is what already makes `Rules / validate` advisory (§S23-2).
|
||||
|
||||
@@ -502,6 +502,23 @@ the entire driver stack read as untrusted, and combined with the `guard` and
|
||||
theoretical one. A signature that is absent, invalid, or simply could not be
|
||||
checked stays untrusted and refuses — that direction is deliberate.
|
||||
|
||||
> **Wired 2026-09-06, the EMBEDDED half only, under a compiled-in bound** (`20_OPEN_QUESTIONS`
|
||||
> §S19(b), row G1: the CI leg and the owner's adapters-disabled leg both left every verdict
|
||||
> unchanged). `Sources::ModuleSignerOrganisation` verifies a fragment-matching module's embedded
|
||||
> Authenticode signature with `WinVerifyTrust` under `WTD_REVOKE_NONE | WTD_CACHE_ONLY_URL_RETRIEVAL`
|
||||
> — no CRL or OCSP fetch, measured rather than assumed — and only then reads the subject `O=`. The
|
||||
> guard trusts it only if the organisation is on the rules file's `trustedSigners` **and** on the list
|
||||
> compiled into the binary (`IsCompiledTrustedSigner`): the rules file may narrow that list and may
|
||||
> never widen it, so a rules push cannot widen the hard gate — the boundary of what the gate trusts is
|
||||
> code, as it is for the launcher list. A trusted module keeps the scan looking; it never stops it, so
|
||||
> an untrusted module loaded after it is still judged. It applies to the injection target as well as
|
||||
> to its ancestors — a game that loads a Microsoft-signed key-protection provider is the false refusal
|
||||
> this half exists to remove. **Fail-closed rows:** no embedded signature (catalog-only system
|
||||
> binaries such as `mskeyprotect.dll` — the `CryptCATAdmin*` half is deferred with its own rationale),
|
||||
> an invalid signature, an unreadable `O=`, a null path, a null or failing seam, an organisation on
|
||||
> one list but not the other — every one is untrusted and refuses. Cost: ~2–4 ms per verified module,
|
||||
> reached only on a fragment hit, inside the 30 s loop.
|
||||
|
||||
### During a session
|
||||
|
||||
Re-run **every pre-injection check** every 30 s, for **every Tier-1 session —
|
||||
|
||||
@@ -91,7 +91,7 @@ or it becomes the next stale status claim this file exists to record.
|
||||
| **S23-6** | ◐ **partly closed** | `license-check` now binds `THIRD_PARTY_NOTICES` bidirectionally — the first real gate over anything in `legal/`. The **accuracy blocks remain hand-maintained prose that nothing verifies**, and `DISCLAIMER.md`'s went stale a second time on 2026-08-05 |
|
||||
| **S23-2** | 🚫 **owner only — no PR can close it** | `Rules / validate` is **not** a required status check on `main`. **Re-verified against the live branch protection 2026-08-05**, not repeated from the entry: `required_status_checks.contexts` is exactly `["check", "analyze (csharp, none)", "analyze (cpp, manual)"]` (`strict: true`, `enforce_admins: true`, `required_linear_history: true`). The `validate` job is path-filtered and `pull_request`-only, so a red removal check does not block the merge button. **The gate that exists to make the anti-cheat blocklist un-removable is advisory.** This is a branch-protection setting |
|
||||
|
||||
| **S29** | 🔴 **open, new 2026-08-05 — five ✅ and two ◐, counted off the glyphs below on 2026-08-20** | (a) ◐ **CORRECTED**: the honesty assertion *is* in the merge gate, natively (`fl_guard`, 20.58 s on CI); only the **managed** drain is ungated, and §S19(b) is **not** a prerequisite of the feature hooks — the original claim was wrong and had been used to re-order the work. **Sharpened 2026-08-06:** fixing §S19(b) alone would still gate nothing, because `build.ps1`'s `-SkipIntegration` applies `--filter 'Category!=Integration'` and excludes the class *before* the guard is ever asked. Two independent mechanisms produce one absence, and `ci.yml` must drop the switch too; (b) ✅ `fl_vtable_indices` now pins the Overlay's indices through a shared header; (c) ✅ **closed 2026-08-06 by deleting `ShouldUnhookAsync`** — zero production callers, strictly weaker than `ScanOnceAsync`, and inverted in polarity; the gate's public instance surface is now pinned to `{StartAsync}`; (d) ◐ `vklayer-blastradius` case 3 is now an assertion, but the script still runs only by hand; (e) ✅ **closed 2026-08-06 host-side**, with a held process handle and a classifier that takes no elapsed-time parameter, so a frozen `writeIndex` can never end a session; (f) ✅ **closed 2026-08-20**: the normative contradiction between CLAUDE.md rule 7 and `03_METRICS` about inline RayQuery is settled the way the entry proposed — AS-build activity proves ray tracing is happening, *naming the technique* is what needs a DXIL scan — and rule 7 is amended in the PR that wrote the hooks. Its second half closes with it: `FL_MEASURED_RT` now has a producer (both command-list detours, installed off the game's own device), so all three conjuncts of the `No` branch are live and **`Yes` and `No` are both reachable for the first time**, proved by injection in both directions; (g) ✅ the present-only writer claimed `FL_MEASURED_OUTPUT_RES` unconditionally, including on records with no size |
|
||||
| **S29** | 🔴 **open, new 2026-08-05 — six ✅ and one ◐, counted off the glyphs below on 2026-09-06** | (a) ✅ **closed 2026-09-06**: the managed drain is in the merge gate — §S19(b)'s signer half removed the refusal and `ci.yml` dropped `-SkipIntegration` in the same PR, both mechanisms at once, as the sharpening below said they had to be. *(History: ◐ CORRECTED — the honesty assertion *was* in the merge gate natively (`fl_guard`, 20.58 s on CI); only the **managed** drain was ungated, and §S19(b) was **not** a prerequisite of the feature hooks. Sharpened 2026-08-06: fixing §S19(b) alone would still have gated nothing, because `build.ps1`'s `-SkipIntegration` applied `--filter 'Category!=Integration'` before the guard was ever asked.)* (b) ✅ `fl_vtable_indices` now pins the Overlay's indices through a shared header; (c) ✅ **closed 2026-08-06 by deleting `ShouldUnhookAsync`** — zero production callers, strictly weaker than `ScanOnceAsync`, and inverted in polarity; the gate's public instance surface is now pinned to `{StartAsync}`; (d) ◐ `vklayer-blastradius` case 3 is now an assertion, but the script still runs only by hand; (e) ✅ **closed 2026-08-06 host-side**, with a held process handle and a classifier that takes no elapsed-time parameter, so a frozen `writeIndex` can never end a session; (f) ✅ **closed 2026-08-20**: the normative contradiction between CLAUDE.md rule 7 and `03_METRICS` about inline RayQuery is settled the way the entry proposed — AS-build activity proves ray tracing is happening, *naming the technique* is what needs a DXIL scan — and rule 7 is amended in the PR that wrote the hooks. Its second half closes with it: `FL_MEASURED_RT` now has a producer (both command-list detours, installed off the game's own device), so all three conjuncts of the `No` branch are live and **`Yes` and `No` are both reachable for the first time**, proved by injection in both directions; (g) ✅ the present-only writer claimed `FL_MEASURED_OUTPUT_RES` unconditionally, including on records with no size |
|
||||
| **S30** | ✅ **closed 2026-08-15** | Answered on the title that raised it: with Ray Reconstruction on, Cyberpunk 2077 evaluates `kFeatureDLSS_RR` on every application frame and `kFeatureDLSS` **not once**, so RR was doing the upscaling and the decode had no arm for it. Evidence rather than inference: `renderW/H` are published only on a frame that drained an evaluation and read 1485×835 = 0.58 × 2560×1440, so the scaling-input tag arrives ON the RR evaluation. Two further defects fell out — the pre-committed decision table had two holes, and the fix contaminated the census that found it (it derived the id from the decoded byte) |
|
||||
| **S31** | ✅ **resolved 2026-09-04 — row P1, and `tokens/batch = 1.00`** | Is a drained Streamline batch an application frame? **Yes.** The `slGetNewFrameToken` count (#103, #105) reads 1.00 / 2.99 / 3.99 against Cyberpunk's own off / ×3 / ×4 and 4.00 on Hell Is Us, and on every leg with batches the two counts agree to the frame. Two independent per-frame API counts are the oracle four instruments could not be. `fg_factor` is published; `none` is reachable by counting. *(The row as it stood while open:)* ◐ **row P2, 2026-08-27 — the ORACLE is retired, the QUESTION is not** | Is a drained Streamline batch an application frame? The PresentMon 2.x `FrameType` test, with its decision table pre-committed BEFORE the run and `tools/frametype-oracle.ps1` producing the input as two dimensionless ratios. **Two obstacles measured before it could be run**: the console binary will not start a trace session unelevated on the dev box (exit 6; the account is in neither Administrators nor Performance Log Users, and the running shared service does not help), and `--track_frame_type` is a **beta** option whose own help says it needs application or driver instrumentation of the Intel-PresentMon provider — so it may be as unavailable as `fl-baseline-probe` proved to be. Two of the table's six rows retire it outright. Blocks HANDOFF item 3's producer decision |
|
||||
| **H11** | ◐ **AMD ffx-api BUILT and RUN 2026-09-04 (A1–A3 accepted; the loader row added the same evening after three loader titles read silent); Intel closed at the census by licence; FSR 3.0 host route deferred to its own PR** | XeFG and FSR3-FG identity. The AMD half is measured on nine titles: the three ffx-api leaves AND the SDK 2.x loader are hooked (the loader turned out to be the game's entry on loader-shipping titles, with the leaves silent behind it), the vendored MIT headers (tag v2.3.0) decode the dispatch descriptor, and rows A1–A3 landed as pre-committed and **R6 closed on Dying Light: The Beast and KCD2 the same night** (`FSR (3.1 or 4 …)` / `FsrFg` / ×2 / 1.01 and `none` / 1.00 through the loader row). Wukong's FSR upscaling is compiled in (Rune Factory's shape; the title has no FSR frame generation), so nothing more is owed on the AMD half; the FSR 3.0 host route is the one deferred piece Intel's SDK failed the licence checklist, so XeSS/XeFG stay at the census (§Scope decisions). `ffx_fsr3_x64.dll` (FSR 3.0, Cyberpunk only here) ~~needs ten host headers from tag v1.1.4 and is deferred with that costing written~~ **built 2026-09-05** from tag `fsr3-v3.0.4` (the docs' `v1.1.4` was the wrong tag: twelve exports match 3.0.4, not 1.1.4's fifteen, and 1.1.4's descriptor appends fields after `renderSize`); one row, the host's UPSCALE; **rows B1–B4 owed** (below) |
|
||||
@@ -291,7 +291,13 @@ refuter told to default to *refuted*. The ledger drift it found is fixed in the
|
||||
that records this. What follows is the residue: things that need code, recorded so
|
||||
the next session finds them by reading.
|
||||
|
||||
**(a) ◐ The honesty contract is in the merge gate — natively. The MANAGED half is not.**
|
||||
**(a) ✅ The honesty contract is in the merge gate — natively, and since 2026-09-06 the MANAGED half too.**
|
||||
|
||||
> **Closed 2026-09-06 by §S19(b)'s signer half and the same PR's `ci.yml` change.** The .NET
|
||||
> test host still loads `System.Security.Cryptography.ProtectedData.dll`; the guard now verifies
|
||||
> its embedded signature offline, reads `O=Microsoft Corporation` on the compiled-in bound, and
|
||||
> keeps looking. `ShmDrainIntegrationTests`, `CaptureHostEndToEndTests` and the LHM hardware case
|
||||
> run in CI under `./build.ps1 check` with no switches. The entry below is the history.
|
||||
|
||||
> **This entry was WRONG when it was written on 2026-08-05, and the correction
|
||||
> matters because the wrong version was used to re-order the work.** It claimed the
|
||||
@@ -2225,6 +2231,36 @@ admits it has no data for (Ricochet, VAC). Three refuters agreed.
|
||||
> rationale (it reaches `mskeyprotect.dll`, which is not on the path to the merge gate, and it is
|
||||
> the `CatRoot` walk §S19(b) priced). **What still stops the build is the bound**, above — the
|
||||
> owner's, and asked for beside this reading.
|
||||
>
|
||||
> #### ✅ BUILT 2026-09-06 — the embedded half, on row G1, under the compiled-in bound (owner: option 1)
|
||||
>
|
||||
> **The owner chose the bound the same afternoon: a compiled-in allowlist the rules file may only
|
||||
> intersect.** `IsCompiledTrustedSigner` in `fl_ac_rules.cpp` names the five organisations the shipped
|
||||
> rules name, and `IsTrustedSigner` now requires BOTH lists — a rules push that adds `"Evil Corp"`
|
||||
> widens nothing, which is one assertion in `fl_guard`. `Sources` gained
|
||||
> `ModuleSignerOrganisation`: `WinVerifyTrust(WTD_CHOICE_FILE)` under `WTD_REVOKE_NONE |
|
||||
> WTD_CACHE_ONLY_URL_RETRIEVAL | WTD_SAFER_FLAG`, and only after `ERROR_SUCCESS` the signing
|
||||
> certificate's subject `O=` through `CryptQueryObject` — the probe's shape with fixed buffers, in
|
||||
> `fl_guard_sources.cpp` (never `fl_ac_rules.cpp`, which the Vulkan layer compiles: wintrust and
|
||||
> crypt32 stay out of every Vulkan process). `ModuleSinkFn` asks it after the ours exemption and
|
||||
> BEFORE latching: a trusted module returns *keep looking*, exactly as the exemption does, so the
|
||||
> load-order fail-open this entry predicted is closed by the same structure — and it applies to the
|
||||
> TARGET too, because a game loading a Microsoft-signed key-protection provider is the false refusal
|
||||
> the half exists to remove. **The fail-closed row, added:** no embedded signature (every catalog-only
|
||||
> system binary — `mskeyprotect.dll` by design), an invalid one, an unreadable `O=`, a null path, a null
|
||||
> seam, a seam that fails, an organisation on one list but not the other — all untrusted, all refuse.
|
||||
> The catalog half stays deferred: it reaches only modules that are not on the path to the merge gate,
|
||||
> and it is the `CatRoot` walk this entry priced.
|
||||
>
|
||||
> **Proved in both directions, against the real seams:** `hook-harness --load <dll>` puts a named module
|
||||
> into the target before the guard looks. The NuGet copy of the CI blocker → **Allowed**, Overlay
|
||||
> injected (skipped loudly on a machine with no NuGet cache; the managed integration cases are the gate
|
||||
> that cannot skip it). Our own unsigned Overlay copied under a `protect`-bearing name outside the
|
||||
> guard's directory → **SuspiciousUnsigned**, naming it, nothing injected. Nine fake-seam cases pin the
|
||||
> decision (both lists, the target, kFailed, missing seam, pathless, load order, exact-hit precedence).
|
||||
> **And `-SkipIntegration` is gone from `ci.yml` in the same PR**: the nine `Category=Integration`
|
||||
> cases are in the merge gate for the first time since 2026-08-05, and CI runs the same
|
||||
> `./build.ps1 check` a developer does. The switch stays in `build.ps1`, loud, for whoever must.
|
||||
|
||||
**(c) `signerField` and `action` are required by the schema and parsed by
|
||||
nobody.** Both are `required` in `detection-rules.schema.json`, both carry
|
||||
|
||||
+10
-13
@@ -1012,17 +1012,14 @@ each step needs, so nothing here is started out of order:
|
||||
`ctest fl_signer_probe` (or the exe) with every network adapter disabled, compare the
|
||||
verdicts with `spike-notes` §1. Unchanged → G1; any change → G2 and the route retires.~~
|
||||
**RUN 2026-09-06 by the owner: every verdict unchanged — row G1 (§S19(b)).**
|
||||
3. **The allow-widening bound — owner-only, a decision no PR may take (§S19(b)).** Two
|
||||
written options: a compiled-in allowlist that `trustedSigners` can only intersect
|
||||
(recommended: the boundary stays code, no branch-protection change), or `Rules / validate`
|
||||
made a required status check (§S23-2, a GitHub setting).
|
||||
4. **Then the PR:** the embedded signer half in `fl_guard_sources.cpp` (`WinVerifyTrust`,
|
||||
`WTD_CHOICE_FILE`, `WTD_REVOKE_NONE | WTD_CACHE_ONLY_URL_RETRIEVAL`, `O=` compared under
|
||||
the bound; a trusted module returns *keep looking*, never *stop*; every failure refuses),
|
||||
the catalog half deferred with its own rationale, a native fixture in both directions
|
||||
(a Microsoft-signed fragment module allowed, an unsigned one refused), and
|
||||
`-SkipIntegration` dropped from `ci.yml` in the same PR so the nine integration cases
|
||||
join the merge gate.
|
||||
3. ~~**The allow-widening bound — owner-only, a decision no PR may take (§S19(b)).**~~ **DECIDED
|
||||
2026-09-06: option 1, the compiled-in allowlist `trustedSigners` may only intersect.**
|
||||
4. ~~**Then the PR:** …~~ **BUILT 2026-09-06 (§S19(b) ✅ BUILT):** `ModuleSignerOrganisation` in
|
||||
`fl_guard_sources.cpp`, `IsCompiledTrustedSigner` as the bound, the trusted module keeps the
|
||||
scan looking, every failure refuses, the catalog half deferred with its rationale, both
|
||||
directions proved against the real seams through `hook-harness --load`, and `-SkipIntegration`
|
||||
dropped from `ci.yml`. **The Separable item is closed**: the nine integration cases are in the
|
||||
merge gate, and CI runs the command a developer runs.
|
||||
|
||||
### ~~§M5 — **START HERE**~~ — MEASURED 2026-09-03, row R1, and the head moves
|
||||
|
||||
@@ -1235,8 +1232,8 @@ diagnosis*.
|
||||
needle containing `` `blockedExecutables` `` silently became something else, `.Replace`
|
||||
matched nothing, the file was unchanged — and the validator correctly passed. Print
|
||||
the mutated text before validating.
|
||||
- **`./build.ps1 check` with no switches** after every PR. CI runs `-SkipIntegration`,
|
||||
so a green CI is not evidence for anything touching the managed drain.
|
||||
- **`./build.ps1 check` with no switches** after every PR. ~~CI runs `-SkipIntegration`,~~ CI runs the same since 2026-09-06,
|
||||
so a green CI is evidence for the managed drain too (§S19(b) BUILT).
|
||||
- **A canary that does not compile is not a canary, and this repo's analyzers make that
|
||||
easy to hit.** Removing a call to prove a gate goes red can leave a constructor
|
||||
parameter unread — `CS9113` under `TreatWarningsAsErrors` — so the build fails, the
|
||||
|
||||
@@ -189,6 +189,12 @@
|
||||
"19_SAFETY: name fragment AND not signed by a known vendor => warn-and-refuse.",
|
||||
"",
|
||||
"trustedSigners are matched against the certificate subject's O= field, NOT CN=.",
|
||||
"",
|
||||
"BOUNDED BY CODE (owner decision 2026-09-06, 20_OPEN_QUESTIONS S19(b)): the guard trusts an",
|
||||
"organisation only if it is on THIS list AND on the list compiled into FrameLedger.Guard.dll",
|
||||
"(IsCompiledTrustedSigner). Adding a name here that the binary does not know widens nothing;",
|
||||
"widening is a reviewed code change. Removing a name here narrows, which data may do.",
|
||||
"",
|
||||
"Measured 2026-08-02 on Windows 11 26300, and the two fields genuinely differ:",
|
||||
" kernel32.dll CN='Microsoft Windows' O='Microsoft Corporation'",
|
||||
" nvapi64.dll CN='Microsoft Windows Hardware Compatibility Publisher' O='Microsoft Corporation'",
|
||||
|
||||
@@ -230,6 +230,17 @@ enum class ParseResult : std::uint8_t {
|
||||
// with a signer check; a fragment alone never refuses (19_SAFETY: "name
|
||||
// fragment AND not signed by a known vendor").
|
||||
[[nodiscard]] bool HasSuspiciousFragment(const Rules& rules, const char* moduleName) noexcept;
|
||||
|
||||
// THE BOUND (owner decision 2026-09-06, §S19(b)). Once the signer half is wired,
|
||||
// `trustedSigners` is a live allow-widening surface: a rules push that adds a
|
||||
// publisher widens the hard gate, and `Rules / validate` is not a required check.
|
||||
// So the data file may only INTERSECT a list compiled into this binary — the
|
||||
// boundary of what the gate trusts is code, exactly as 19_SAFETY ruled for the
|
||||
// launcher list. Widening it is a reviewed PR, never a data change.
|
||||
[[nodiscard]] bool IsCompiledTrustedSigner(const char* signerOrganisation) noexcept;
|
||||
|
||||
// True only when BOTH the rules file and the compiled-in list name the
|
||||
// organisation (full, case-insensitive equality on the certificate subject's O=).
|
||||
[[nodiscard]] bool IsTrustedSigner(const Rules& rules, const char* signerOrganisation) noexcept;
|
||||
|
||||
// Local AppData, resolved from the SHELL rather than from the environment.
|
||||
|
||||
@@ -307,6 +307,34 @@ struct Sources {
|
||||
// caller has to be able to distinguish them.
|
||||
Collected (*ModuleIsOurOwn)(const wchar_t* modulePath, bool* isOurs) = nullptr;
|
||||
|
||||
// §S19(b) — WHO SIGNED this module, from its EMBEDDED Authenticode signature,
|
||||
// verified OFFLINE (row G1, read 2026-09-06 after the CI leg and the owner's
|
||||
// adapters-disabled leg both left every verdict unchanged).
|
||||
//
|
||||
// kOk writes the signing certificate's subject `O=` into `out` — the field
|
||||
// 19_SAFETY §Blocklist seed names, measured on drivers, launchers and a NuGet
|
||||
// assembly whose CN changed between copies while its O= did not. The guard
|
||||
// then pairs it with the fragment tier: a fragment-matching module signed by
|
||||
// an organisation on the TRUSTED list keeps the scan looking; anything else
|
||||
// latches SuspiciousUnsigned, which is now literally what it says.
|
||||
//
|
||||
// kFailed is every other outcome and MEANS NOT TRUSTED: no embedded signature
|
||||
// (the catalog-signed system binaries — mskeyprotect.dll — land here by
|
||||
// design, the CryptCATAdmin* half being deferred with its own rationale), an
|
||||
// invalid one, a certificate whose O= could not be read, a buffer too small,
|
||||
// a null path. The polarity is ModuleIsOurOwn's: a seam that fails must never
|
||||
// widen what is allowed.
|
||||
//
|
||||
// OFFLINE BY FLAG, measured rather than assumed: WTD_REVOKE_NONE and
|
||||
// WTD_CACHE_ONLY_URL_RETRIEVAL, under which the probe's verdicts did not
|
||||
// change with every adapter disabled. cryptnet.dll still maps; no request is
|
||||
// made. NFR-10 and CLAUDE.md rule 8 are what that measurement protects.
|
||||
//
|
||||
// Reached only on a fragment hit, which on a measured machine is approximately
|
||||
// never — ~2-4 ms per verified module, inside a 30 s loop, on a scan set that
|
||||
// three real titles left empty.
|
||||
Collected (*ModuleSignerOrganisation)(const wchar_t* modulePath, char* out, std::size_t cap) = nullptr;
|
||||
|
||||
// §S22 — is the DLL we were asked to inject one of OUR OWN binaries?
|
||||
//
|
||||
// The guard gated the target and nothing gated the payload. Every check
|
||||
|
||||
@@ -636,6 +636,26 @@ bool HasSuspiciousFragment(const Rules& rules, const char* moduleName) noexcept
|
||||
return false;
|
||||
}
|
||||
|
||||
// The five organisations the shipped rules name, measured on this machine's
|
||||
// binaries (spike-notes §1: WHQL re-signing leaves O= intact, so both GPU vendors'
|
||||
// drivers read as Microsoft; their own launchers read as themselves). Adding one is
|
||||
// a code change with a review, which is the whole point of the list being here.
|
||||
constexpr const char* kCompiledTrustedSigners[] = {
|
||||
"Microsoft Corporation", "NVIDIA Corporation", "Valve Corp.", "Intel Corporation", "Advanced Micro Devices, Inc.",
|
||||
};
|
||||
|
||||
bool IsCompiledTrustedSigner(const char* signerOrganisation) noexcept {
|
||||
if (signerOrganisation == nullptr || signerOrganisation[0] == '\0') {
|
||||
return false;
|
||||
}
|
||||
for (const char* s : kCompiledTrustedSigners) {
|
||||
if (IEquals(signerOrganisation, s)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsTrustedSigner(const Rules& rules, const char* signerOrganisation) noexcept {
|
||||
// A signature that is absent, invalid, or simply could not be checked is
|
||||
// NOT trusted. The caller passes nullptr for all three, and they all land
|
||||
@@ -643,6 +663,11 @@ bool IsTrustedSigner(const Rules& rules, const char* signerOrganisation) noexcep
|
||||
if (signerOrganisation == nullptr || signerOrganisation[0] == '\0') {
|
||||
return false;
|
||||
}
|
||||
// The bound first: an organisation the binary does not know cannot be made
|
||||
// trusted by the data file, whatever the file says.
|
||||
if (!IsCompiledTrustedSigner(signerOrganisation)) {
|
||||
return false;
|
||||
}
|
||||
for (std::size_t i = 0; i < rules.trustedSignerCount; ++i) {
|
||||
// Full comparison, never a prefix or substring: a substring signer rule
|
||||
// is a forgery surface, because "NVIDIA Corporation Ltd" would match
|
||||
|
||||
@@ -247,6 +247,33 @@ bool ModuleIsExempt(const MatchState& st, const wchar_t* modulePath) noexcept {
|
||||
return st.sources->ModuleIsOurOwn(modulePath, &ours) == Collected::kOk && ours;
|
||||
}
|
||||
|
||||
// §S19(b) — is this fragment-matching module signed by a TRUSTED organisation?
|
||||
//
|
||||
// The other half of 19_SAFETY's heuristic ("name fragment AND not signed by a
|
||||
// known vendor"), wired 2026-09-06 on row G1. Every clause fails towards refusing:
|
||||
//
|
||||
// - a null seam does not suppress (Sources members default to nullptr);
|
||||
// - a module whose path we could not obtain cannot be verified;
|
||||
// - anything but kOk from the seam is "could not tell", which is untrusted;
|
||||
// - the organisation must be on BOTH the rules list and the compiled-in bound
|
||||
// (IsTrustedSigner) — full equality, never a substring.
|
||||
//
|
||||
// Unlike ModuleIsExempt this applies to the TARGET too: a game that loads a
|
||||
// Microsoft-signed key-protection provider is exactly the false refusal the
|
||||
// signer half exists to remove. Reached only after the fragment matched, so the
|
||||
// ~2-4 ms verification is not on the ordinary path.
|
||||
bool ModuleIsTrustedSigned(const MatchState& st, const wchar_t* modulePath) noexcept {
|
||||
if (st.sources == nullptr || st.sources->ModuleSignerOrganisation == nullptr || modulePath == nullptr ||
|
||||
st.rules == nullptr) {
|
||||
return false;
|
||||
}
|
||||
char org[kMaxValueLen] = {};
|
||||
if (st.sources->ModuleSignerOrganisation(modulePath, org, sizeof(org)) != Collected::kOk) {
|
||||
return false;
|
||||
}
|
||||
return IsTrustedSigner(*st.rules, org);
|
||||
}
|
||||
|
||||
// Check 1's sink. The ordering here is the whole of §S22(b).
|
||||
bool ModuleSinkFn(void* ctx, const char* name, const wchar_t* modulePath) noexcept {
|
||||
auto* st = static_cast<MatchState*>(ctx);
|
||||
@@ -274,6 +301,13 @@ bool ModuleSinkFn(void* ctx, const char* name, const wchar_t* modulePath) noexce
|
||||
if (ModuleIsExempt(*st, modulePath)) {
|
||||
return true;
|
||||
}
|
||||
// TRUSTED SIGNER: the same KEEP LOOKING, for the same reason. A trusted module
|
||||
// must never STOP the scan, or a genuinely suspicious module loaded after it
|
||||
// is never recorded — the load-order fail-open the paragraph above describes,
|
||||
// reachable through this clause exactly as through the exemption.
|
||||
if (ModuleIsTrustedSigned(*st, modulePath)) {
|
||||
return true;
|
||||
}
|
||||
st->sawSuspicious = true;
|
||||
strncpy_s(st->suspicious, name, _TRUNCATE);
|
||||
// Still not a stop: an EXACT blocklist hit later in the same process outranks
|
||||
|
||||
@@ -25,7 +25,17 @@
|
||||
#include <tlhelp32.h>
|
||||
#include <winsvc.h>
|
||||
|
||||
// clang-format off
|
||||
// ORDER IS LOAD-BEARING (fl-probe-signer found it): <mscat.h> is not needed here,
|
||||
// but <wintrust.h> and <softpub.h> still want <wincrypt.h>'s types first.
|
||||
#include <wincrypt.h>
|
||||
#include <wintrust.h>
|
||||
#include <softpub.h>
|
||||
// clang-format on
|
||||
|
||||
#pragma comment(lib, "advapi32.lib")
|
||||
#pragma comment(lib, "wintrust.lib")
|
||||
#pragma comment(lib, "crypt32.lib")
|
||||
|
||||
namespace fl::guard {
|
||||
namespace {
|
||||
@@ -670,6 +680,99 @@ Collected FileIsOurOwnImpl(const wchar_t* dllPath, bool* isOurs) noexcept {
|
||||
return Collected::kOk;
|
||||
}
|
||||
|
||||
// §S19(b) — the EMBEDDED signer half, offline. The shape fl-probe-signer measured,
|
||||
// with the probe's std::string and std::vector replaced by fixed buffers: the guard
|
||||
// allocates nothing.
|
||||
//
|
||||
// Two calls, and the order is the contract: WinVerifyTrust decides whether the
|
||||
// signature is VALID (chain, digest, policy) and only then is the certificate read
|
||||
// for its O=. Reading the subject first would report an organisation off a
|
||||
// signature nobody verified — a forged O= is exactly one CryptQueryObject away.
|
||||
LONG VerifyEmbeddedOffline(const wchar_t* path) noexcept {
|
||||
WINTRUST_FILE_INFO fi{};
|
||||
fi.cbStruct = sizeof(fi);
|
||||
fi.pcwszFilePath = path;
|
||||
|
||||
WINTRUST_DATA wd{};
|
||||
wd.cbStruct = sizeof(wd);
|
||||
wd.dwUIChoice = WTD_UI_NONE;
|
||||
wd.fdwRevocationChecks = WTD_REVOKE_NONE;
|
||||
wd.dwUnionChoice = WTD_CHOICE_FILE;
|
||||
wd.pFile = &fi;
|
||||
wd.dwStateAction = WTD_STATEACTION_VERIFY;
|
||||
wd.dwProvFlags = WTD_SAFER_FLAG | WTD_CACHE_ONLY_URL_RETRIEVAL;
|
||||
|
||||
GUID action = WINTRUST_ACTION_GENERIC_VERIFY_V2;
|
||||
const LONG r = WinVerifyTrust(static_cast<HWND>(INVALID_HANDLE_VALUE), &action, &wd);
|
||||
wd.dwStateAction = WTD_STATEACTION_CLOSE;
|
||||
WinVerifyTrust(static_cast<HWND>(INVALID_HANDLE_VALUE), &action, &wd);
|
||||
return r;
|
||||
}
|
||||
|
||||
// The signing certificate's subject O=, into a caller buffer. False on anything
|
||||
// short of a readable, non-empty, ASCII-representable organisation.
|
||||
bool ReadSignerOrganisation(const wchar_t* path, char* out, std::size_t cap) noexcept {
|
||||
HCERTSTORE store = nullptr;
|
||||
HCRYPTMSG msg = nullptr;
|
||||
DWORD enc = 0;
|
||||
DWORD ctype = 0;
|
||||
DWORD fmt = 0;
|
||||
if (!CryptQueryObject(CERT_QUERY_OBJECT_FILE, path, CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED,
|
||||
CERT_QUERY_FORMAT_FLAG_BINARY, 0, &enc, &ctype, &fmt, &store, &msg, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ok = false;
|
||||
DWORD need = 0;
|
||||
// Fixed, generous, and refused when exceeded: a signer info larger than this is
|
||||
// not a shape any vendor certificate produces, and "could not read" is untrusted.
|
||||
alignas(16) unsigned char buf[16384];
|
||||
if (CryptMsgGetParam(msg, CMSG_SIGNER_INFO_PARAM, 0, nullptr, &need) && need > 0 && need <= sizeof(buf) &&
|
||||
CryptMsgGetParam(msg, CMSG_SIGNER_INFO_PARAM, 0, buf, &need)) {
|
||||
auto* si = reinterpret_cast<CMSG_SIGNER_INFO*>(buf);
|
||||
CERT_INFO ci{};
|
||||
ci.Issuer = si->Issuer;
|
||||
ci.SerialNumber = si->SerialNumber;
|
||||
PCCERT_CONTEXT cert = CertFindCertificateInStore(store, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0,
|
||||
CERT_FIND_SUBJECT_CERT, &ci, nullptr);
|
||||
if (cert != nullptr) {
|
||||
wchar_t org[512]{};
|
||||
const DWORD n = CertGetNameStringW(cert, CERT_NAME_ATTR_TYPE, 0, const_cast<char*>(szOID_ORGANIZATION_NAME),
|
||||
org, static_cast<DWORD>(sizeof(org) / sizeof(org[0])));
|
||||
if (n > 1) {
|
||||
// The rules compare ASCII (IEquals); a signer whose O= does not
|
||||
// survive the narrowing is not one the list can name, so it fails.
|
||||
const int written = WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, org, -1, out,
|
||||
static_cast<int>(cap), nullptr, nullptr);
|
||||
ok = written > 1;
|
||||
if (!ok && cap > 0) {
|
||||
out[0] = '\0';
|
||||
}
|
||||
}
|
||||
CertFreeCertificateContext(cert);
|
||||
}
|
||||
}
|
||||
|
||||
if (msg != nullptr) {
|
||||
CryptMsgClose(msg);
|
||||
}
|
||||
if (store != nullptr) {
|
||||
CertCloseStore(store, 0);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
Collected ModuleSignerOrganisationImpl(const wchar_t* modulePath, char* out, std::size_t cap) noexcept {
|
||||
if (modulePath == nullptr || out == nullptr || cap == 0) {
|
||||
return Collected::kFailed;
|
||||
}
|
||||
out[0] = '\0';
|
||||
if (VerifyEmbeddedOffline(modulePath) != ERROR_SUCCESS) {
|
||||
return Collected::kFailed;
|
||||
}
|
||||
return ReadSignerOrganisation(modulePath, out, cap) ? Collected::kOk : Collected::kFailed;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Sources SystemSources() noexcept {
|
||||
@@ -685,6 +788,9 @@ Sources SystemSources() noexcept {
|
||||
// Both identity seams, one implementation — see fl_guard.h §TWO SEAMS.
|
||||
s.ModuleIsOurOwn = &FileIsOurOwnImpl;
|
||||
s.PayloadIsOurOwn = &FileIsOurOwnImpl;
|
||||
// §S19(b), the embedded half only. The catalog half is a deferral with a
|
||||
// written rationale, not a gap nobody noticed.
|
||||
s.ModuleSignerOrganisation = &ModuleSignerOrganisationImpl;
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
@@ -142,6 +142,13 @@ struct Fake {
|
||||
// exempted, so it must refuse.
|
||||
std::set<std::string> pathlessModules;
|
||||
|
||||
// §S19(b) — the signer seam: which modules verify, and as whom. A module absent
|
||||
// from the map has no valid embedded signature (kFailed), which is what an
|
||||
// unsigned DLL and a catalog-only system binary both look like to the embedded
|
||||
// half. Empty by default, so no existing case is silently trusted.
|
||||
std::map<std::string, std::string> signerByModule;
|
||||
Collected signerResult = Collected::kOk;
|
||||
|
||||
// §S22 — the payload identity seam.
|
||||
//
|
||||
// DEFAULTS TO THE REAL IMPLEMENTATION, unlike every other member here, and
|
||||
@@ -297,6 +304,35 @@ Collected FakeModuleIsOurOwn(const wchar_t* modulePath, bool* isOurs) {
|
||||
return Collected::kOk;
|
||||
}
|
||||
|
||||
Collected FakeModuleSignerOrganisation(const wchar_t* modulePath, char* out, std::size_t cap) {
|
||||
if (g.signerResult != Collected::kOk) {
|
||||
// Writes a TRUSTED name and THEN fails — the same trap FakeModuleIsOurOwn
|
||||
// sets: a caller that ignores the return code and reads the buffer would
|
||||
// trust a module the seam could not verify.
|
||||
if (out != nullptr && cap > 0) {
|
||||
strcpy_s(out, cap, "Microsoft Corporation");
|
||||
}
|
||||
return g.signerResult;
|
||||
}
|
||||
if (out == nullptr || cap == 0) {
|
||||
return Collected::kFailed;
|
||||
}
|
||||
out[0] = '\0';
|
||||
if (modulePath == nullptr) {
|
||||
// As the ours fake: answer "trusted" for a null path, deliberately wrong, so
|
||||
// the guard's own null clause is load-bearing rather than redundant.
|
||||
strcpy_s(out, cap, "Microsoft Corporation");
|
||||
return Collected::kOk;
|
||||
}
|
||||
for (const auto& [name, org] : g.signerByModule) {
|
||||
if (FakeModulePath(name) == modulePath) {
|
||||
strcpy_s(out, cap, org.c_str());
|
||||
return Collected::kOk;
|
||||
}
|
||||
}
|
||||
return Collected::kFailed;
|
||||
}
|
||||
|
||||
Collected FakePayloadIsOurOwn(const wchar_t* dllPath, bool* isOurs) {
|
||||
switch (g.payload) {
|
||||
case Fake::Payload::kOurs:
|
||||
@@ -330,6 +366,7 @@ Sources FakeSources() {
|
||||
s.EnumerateDirEntries = &FakeEnumDirEntries;
|
||||
s.ModuleIsOurOwn = &FakeModuleIsOurOwn;
|
||||
s.PayloadIsOurOwn = &FakePayloadIsOurOwn;
|
||||
s.ModuleSignerOrganisation = &FakeModuleSignerOrganisation;
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -1075,15 +1112,160 @@ TEST_CASE("signer comparison is against O=, exact, and untrusted-by-default", "[
|
||||
CHECK_FALSE(IsTrustedSigner(rules, ""));
|
||||
}
|
||||
|
||||
TEST_CASE("a suspicious module name refuses while the signer path is unwired", "[guard][heuristic]") {
|
||||
TEST_CASE("a suspicious module name refuses when the signer seam cannot vouch for it", "[guard][heuristic]") {
|
||||
ResetFake();
|
||||
g.modules = {"kernel32.dll", "someantitamper64.dll"};
|
||||
g.modules = {"kernel32.dll", "someantitamper64.dll"}; // not in signerByModule: no valid signature
|
||||
|
||||
const Verdict v = EvaluateWithSources(1234, FakeSources());
|
||||
REQUIRE_FALSE(v.Allowed());
|
||||
CHECK(v.reason == Reason::kSuspiciousUnsigned);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// §S19(b) — the signer half, wired 2026-09-06 on row G1.
|
||||
//
|
||||
// 19_SAFETY's heuristic is "name fragment AND not signed by a known vendor". The
|
||||
// fragment half has refused alone since the guard was written; this is the other
|
||||
// conjunct. Most of the cases below are about what it must NOT do, because a
|
||||
// clause that can turn a refusal into an allow is a clause that can be reached
|
||||
// by the wrong module.
|
||||
// ===========================================================================
|
||||
TEST_CASE("§S19(b) — the compiled-in bound: the rules file may only INTERSECT it", "[guard][heuristic][S19]") {
|
||||
ResetFake();
|
||||
Rules rules;
|
||||
REQUIRE(ParseRules(g.rulesJson.data(), g.rulesJson.size(), rules) == ParseResult::kOk);
|
||||
|
||||
// On both lists: trusted.
|
||||
CHECK(IsCompiledTrustedSigner("Microsoft Corporation"));
|
||||
CHECK(IsTrustedSigner(rules, "Microsoft Corporation"));
|
||||
|
||||
// On the compiled list, NOT in this rules file (the fixture names three): the
|
||||
// data may narrow, so it is not trusted here.
|
||||
CHECK(IsCompiledTrustedSigner("Intel Corporation"));
|
||||
CHECK_FALSE(IsTrustedSigner(rules, "Intel Corporation"));
|
||||
|
||||
// In the rules file, NOT on the compiled list: the data may not widen. This is
|
||||
// the owner's decision of 2026-09-06 in one assertion.
|
||||
std::string widened = g.rulesJson;
|
||||
const std::string needle = "\"Valve Corp.\"";
|
||||
const std::size_t at = widened.find(needle);
|
||||
REQUIRE(at != std::string::npos);
|
||||
widened.replace(at, needle.size(), "\"Valve Corp.\", \"Evil Corp\"");
|
||||
Rules wide;
|
||||
REQUIRE(ParseRules(widened.data(), widened.size(), wide) == ParseResult::kOk);
|
||||
CHECK_FALSE(IsCompiledTrustedSigner("Evil Corp"));
|
||||
CHECK_FALSE(IsTrustedSigner(wide, "Evil Corp"));
|
||||
CHECK(IsTrustedSigner(wide, "Valve Corp."));
|
||||
|
||||
// Never a substring, never a prefix, never empty.
|
||||
CHECK_FALSE(IsCompiledTrustedSigner("Microsoft"));
|
||||
CHECK_FALSE(IsCompiledTrustedSigner("NVIDIA Corporation Ltd"));
|
||||
CHECK_FALSE(IsCompiledTrustedSigner(""));
|
||||
CHECK_FALSE(IsCompiledTrustedSigner(nullptr));
|
||||
}
|
||||
|
||||
TEST_CASE(
|
||||
"§S19(b) — the fragment tier is suppressed for a module signed by a trusted organisation, and for nothing else",
|
||||
"[guard][failclosed][S19]") {
|
||||
ResetFake();
|
||||
g.scanSet = {1234, 4000};
|
||||
|
||||
SECTION("a Microsoft-signed fragment module in an ANCESTOR -> Allow (the CI blocker's shape)") {
|
||||
g.modulesByPid[1234] = {"kernel32.dll", "d3d11.dll"};
|
||||
g.modulesByPid[4000] = {"kernel32.dll", "System.Security.Cryptography.ProtectedData.dll"};
|
||||
g.signerByModule["System.Security.Cryptography.ProtectedData.dll"] = "Microsoft Corporation";
|
||||
|
||||
const Verdict v = EvaluateWithSources(1234, FakeSources());
|
||||
INFO("reason was " << ReasonName(v.reason) << " signal=" << v.signal);
|
||||
CHECK(v.Allowed());
|
||||
}
|
||||
|
||||
SECTION("a Microsoft-signed fragment module in the TARGET -> Allow, unlike the ours exemption") {
|
||||
// A game loading a signed key-protection provider is the false refusal
|
||||
// this half exists to remove, so the target is NOT excluded here.
|
||||
g.modulesByPid[1234] = {"kernel32.dll", "mskeyprotect.dll"};
|
||||
g.signerByModule["mskeyprotect.dll"] = "Microsoft Corporation";
|
||||
|
||||
const Verdict v = EvaluateWithSources(1234, FakeSources());
|
||||
INFO("reason was " << ReasonName(v.reason) << " signal=" << v.signal);
|
||||
CHECK(v.Allowed());
|
||||
}
|
||||
|
||||
SECTION("signed by an organisation the rules name but the binary does not -> refuse") {
|
||||
std::string widened = g.rulesJson;
|
||||
const std::string needle = "\"Valve Corp.\"";
|
||||
widened.replace(widened.find(needle), needle.size(), "\"Valve Corp.\", \"Evil Corp\"");
|
||||
g.rulesJson = widened;
|
||||
g.modulesByPid[4000] = {"evilprotect.dll"};
|
||||
g.signerByModule["evilprotect.dll"] = "Evil Corp";
|
||||
|
||||
const Verdict v = EvaluateWithSources(1234, FakeSources());
|
||||
REQUIRE_FALSE(v.Allowed());
|
||||
CHECK(v.reason == Reason::kSuspiciousUnsigned);
|
||||
}
|
||||
|
||||
SECTION("signed by an organisation on the compiled list but NOT in this rules file -> refuse") {
|
||||
g.modulesByPid[4000] = {"intelprotect.dll"};
|
||||
g.signerByModule["intelprotect.dll"] = "Intel Corporation"; // the fixture rules name three, not five
|
||||
|
||||
const Verdict v = EvaluateWithSources(1234, FakeSources());
|
||||
REQUIRE_FALSE(v.Allowed());
|
||||
CHECK(v.reason == Reason::kSuspiciousUnsigned);
|
||||
}
|
||||
|
||||
SECTION("a seam that CANNOT VERIFY does not suppress, even when it wrote a trusted name") {
|
||||
g.modulesByPid[4000] = {"mskeyprotect.dll"};
|
||||
g.signerByModule["mskeyprotect.dll"] = "Microsoft Corporation";
|
||||
g.signerResult = Collected::kFailed;
|
||||
|
||||
const Verdict v = EvaluateWithSources(1234, FakeSources());
|
||||
REQUIRE_FALSE(v.Allowed());
|
||||
CHECK(v.reason == Reason::kSuspiciousUnsigned);
|
||||
}
|
||||
|
||||
SECTION("a MISSING seam does not suppress") {
|
||||
g.modulesByPid[4000] = {"mskeyprotect.dll"};
|
||||
g.signerByModule["mskeyprotect.dll"] = "Microsoft Corporation";
|
||||
Sources s = FakeSources();
|
||||
s.ModuleSignerOrganisation = nullptr;
|
||||
|
||||
const Verdict v = EvaluateWithSources(1234, s);
|
||||
REQUIRE_FALSE(v.Allowed());
|
||||
CHECK(v.reason == Reason::kSuspiciousUnsigned);
|
||||
}
|
||||
|
||||
SECTION("a module we could not LOCATE is not verified") {
|
||||
g.modulesByPid[4000] = {"mskeyprotect.dll"};
|
||||
g.signerByModule["mskeyprotect.dll"] = "Microsoft Corporation";
|
||||
g.pathlessModules = {"mskeyprotect.dll"};
|
||||
|
||||
const Verdict v = EvaluateWithSources(1234, FakeSources());
|
||||
REQUIRE_FALSE(v.Allowed());
|
||||
CHECK(v.reason == Reason::kSuspiciousUnsigned);
|
||||
}
|
||||
|
||||
SECTION("LOAD ORDER: a trusted fragment module first, an unsigned one second -> refuse, naming the second") {
|
||||
// The fail-open §S19(b) predicted for a latch-and-skip sink. The trusted
|
||||
// module returns KEEP LOOKING, so the unsigned one after it is still seen.
|
||||
g.modulesByPid[4000] = {"mskeyprotect.dll", "shadyprotect.dll"};
|
||||
g.signerByModule["mskeyprotect.dll"] = "Microsoft Corporation";
|
||||
|
||||
const Verdict v = EvaluateWithSources(1234, FakeSources());
|
||||
REQUIRE_FALSE(v.Allowed());
|
||||
CHECK(v.reason == Reason::kSuspiciousUnsigned);
|
||||
CHECK(std::strcmp(v.signal, "shadyprotect.dll") == 0);
|
||||
}
|
||||
|
||||
SECTION("only the FUZZY tier is suppressed — an EXACT blocklist hit stays a hit whoever signed it") {
|
||||
g.modulesByPid[4000] = {"EasyAntiCheat.dll"};
|
||||
g.signerByModule["EasyAntiCheat.dll"] = "Microsoft Corporation";
|
||||
|
||||
const Verdict v = EvaluateWithSources(1234, FakeSources());
|
||||
REQUIRE_FALSE(v.Allowed());
|
||||
CHECK(v.reason == Reason::kBlockedModule);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// The injection primitive, end to end.
|
||||
//
|
||||
@@ -1274,6 +1456,115 @@ TEST_CASE("the injection primitive really loads our DLL into another process", "
|
||||
CHECK(TargetHasModule(child.pi.dwProcessId, L"FrameLedger.Overlay.dll"));
|
||||
}
|
||||
|
||||
// §S19(b) against the REAL seams. The fakes above prove the decision; these two
|
||||
// prove the seam: a real Authenticode verification of a real file the real
|
||||
// module walk reported, in a process the real injection targets.
|
||||
namespace {
|
||||
|
||||
// The CI blocker itself, where the test host's copy is staged from (the NuGet cache).
|
||||
// fl-probe-signer looks in the same place, for the same reason.
|
||||
std::wstring FindProtectedDataDll() {
|
||||
wchar_t profile[MAX_PATH]{};
|
||||
if (GetEnvironmentVariableW(L"USERPROFILE", profile, MAX_PATH) == 0) {
|
||||
return {};
|
||||
}
|
||||
const std::wstring root = std::wstring(profile) + L"\\.nuget\\packages\\system.security.cryptography.protecteddata";
|
||||
WIN32_FIND_DATAW fd{};
|
||||
HANDLE h = FindFirstFileW((root + L"\\*").c_str(), &fd);
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
return {};
|
||||
}
|
||||
std::wstring best;
|
||||
do {
|
||||
if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 || fd.cFileName[0] == L'.') {
|
||||
continue;
|
||||
}
|
||||
for (const wchar_t* under : {L"\\runtimes\\win\\lib\\net6.0\\", L"\\lib\\net6.0\\"}) {
|
||||
const std::wstring c =
|
||||
root + L"\\" + fd.cFileName + under + L"System.Security.Cryptography.ProtectedData.dll";
|
||||
if (GetFileAttributesW(c.c_str()) != INVALID_FILE_ATTRIBUTES) {
|
||||
best = c;
|
||||
}
|
||||
}
|
||||
} while (FindNextFileW(h, &fd) != 0);
|
||||
FindClose(h);
|
||||
return best;
|
||||
}
|
||||
|
||||
// Real module walk and real signer, fake everything else: the scan set is the
|
||||
// child alone, the rules are the fixture's, and the payload check is real (kReal).
|
||||
Sources RealModulesAndSigner() {
|
||||
Sources s = FakeSources();
|
||||
const Sources real = SystemSources();
|
||||
s.EnumerateModules = real.EnumerateModules;
|
||||
s.ModuleSignerOrganisation = real.ModuleSignerOrganisation;
|
||||
s.ModuleIsOurOwn = real.ModuleIsOurOwn;
|
||||
return s;
|
||||
}
|
||||
|
||||
bool StartHarnessLoading(Child& child, const std::wstring& dll) {
|
||||
std::wstring cmd = std::wstring(L"\"") + FL_HARNESS_EXE + L"\" --load \"" + dll + L"\" --hold 30";
|
||||
STARTUPINFOW si{};
|
||||
si.cb = sizeof(si);
|
||||
if (!CreateProcessW(FL_HARNESS_EXE, cmd.data(), nullptr, nullptr, FALSE, CREATE_NO_WINDOW, nullptr, nullptr, &si,
|
||||
&child.pi)) {
|
||||
return false;
|
||||
}
|
||||
Sleep(800);
|
||||
return WaitForSingleObject(child.pi.hProcess, 0) == WAIT_TIMEOUT;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_CASE("§S19(b), real seams — a target that loaded the Microsoft-signed CI blocker is ALLOWED",
|
||||
"[guard][inject][S19]") {
|
||||
const std::wstring dll = FindProtectedDataDll();
|
||||
if (dll.empty()) {
|
||||
// The NuGet cache is what stages it; a machine that never restored the test
|
||||
// SDK has no copy. Loud, not green: the managed integration cases are the
|
||||
// gate that cannot skip this.
|
||||
SKIP("System.Security.Cryptography.ProtectedData.dll not in the NuGet cache on this machine");
|
||||
}
|
||||
|
||||
Child child;
|
||||
REQUIRE(StartHarnessLoading(child, dll));
|
||||
REQUIRE(TargetHasModule(child.pi.dwProcessId, L"System.Security.Cryptography.ProtectedData.dll"));
|
||||
|
||||
ResetFake();
|
||||
g.scanSet = {child.pi.dwProcessId};
|
||||
const Verdict v = GuardedInjectWithSources(child.pi.dwProcessId, FL_OVERLAY_DLL, RealModulesAndSigner());
|
||||
INFO("reason " << ReasonName(v.reason) << " signal=" << v.signal);
|
||||
REQUIRE(v.Allowed());
|
||||
CHECK(TargetHasModule(child.pi.dwProcessId, L"FrameLedger.Overlay.dll"));
|
||||
}
|
||||
|
||||
TEST_CASE("§S19(b), real seams — a target that loaded an UNSIGNED fragment module is REFUSED, naming it",
|
||||
"[guard][inject][S19]") {
|
||||
// The negative: our own unsigned Overlay, copied under a fragment-bearing name to
|
||||
// a directory that is not the guard's — unsigned (CLAUDE.md rule 9), `protect`
|
||||
// in the name, and not ours by file id. Every clause of the heuristic, true.
|
||||
wchar_t temp[MAX_PATH]{};
|
||||
REQUIRE(GetTempPathW(MAX_PATH, temp) != 0);
|
||||
const std::wstring copy = std::wstring(temp) + L"fl_s19_unsigned_protect_fixture.dll";
|
||||
REQUIRE(CopyFileW(FL_OVERLAY_DLL, copy.c_str(), FALSE));
|
||||
|
||||
{
|
||||
Child child;
|
||||
REQUIRE(StartHarnessLoading(child, copy));
|
||||
REQUIRE(TargetHasModule(child.pi.dwProcessId, L"fl_s19_unsigned_protect_fixture.dll"));
|
||||
|
||||
ResetFake();
|
||||
g.scanSet = {child.pi.dwProcessId};
|
||||
const Verdict v = GuardedInjectWithSources(child.pi.dwProcessId, FL_OVERLAY_DLL, RealModulesAndSigner());
|
||||
INFO("reason " << ReasonName(v.reason) << " signal=" << v.signal);
|
||||
REQUIRE_FALSE(v.Allowed());
|
||||
CHECK(v.reason == Reason::kSuspiciousUnsigned);
|
||||
CHECK(_stricmp(v.signal, "fl_s19_unsigned_protect_fixture.dll") == 0);
|
||||
CHECK_FALSE(TargetHasModule(child.pi.dwProcessId, L"FrameLedger.Overlay.dll"));
|
||||
} // the child is gone before its module file is deleted
|
||||
DeleteFileW(copy.c_str());
|
||||
}
|
||||
|
||||
TEST_CASE("the injected Overlay publishes a handshake the Agent can validate", "[guard][inject][shm]") {
|
||||
// End to end, through the real DLL: inject, then open Local\FrameLedger.Ring.<pid>
|
||||
// from THIS process and check every field 04_CAPTURE says the Agent validates
|
||||
|
||||
@@ -35,6 +35,10 @@
|
||||
// issue DXGI_PRESENT_TEST, which submits nothing
|
||||
// --plus-ui K also present K frames on a SECOND swapchain in the same
|
||||
// process (fixture for stream separation)
|
||||
// --load PATH LoadLibrary PATH before anything else. Fixture for the
|
||||
// guard's signer half (§S19(b)): a fragment-matching
|
||||
// module in the TARGET, signed or not, is what the guard
|
||||
// must judge
|
||||
// --hold-presenting-overflow N
|
||||
// fill the Overlay's fixed 16-slot swapchain table, then
|
||||
// present for N seconds on one that cannot get a slot. The
|
||||
@@ -2830,6 +2834,19 @@ int main(int argc, char** argv) {
|
||||
slTagWholeResource = true;
|
||||
} else if (std::strcmp(argv[i], "--sl-tag-dlssg-inputs") == 0) {
|
||||
slTagDlssgInputs = true;
|
||||
} else if (std::strcmp(argv[i], "--load") == 0 && i + 1 < argc) {
|
||||
// The fixture for the guard's signer half: put a named module into
|
||||
// THIS process before the guard looks. Loaded, not injected, and it
|
||||
// stays loaded for the life of the process so the scan sees it.
|
||||
const char* path = argv[++i];
|
||||
wchar_t wide[MAX_PATH * 2]{};
|
||||
const int n =
|
||||
MultiByteToWideChar(CP_ACP, 0, path, -1, wide, static_cast<int>(sizeof(wide) / sizeof(wide[0])));
|
||||
HMODULE h = n > 0 ? LoadLibraryW(wide) : nullptr;
|
||||
std::printf(" --load %s -> %s\n", path, h != nullptr ? "loaded" : "FAILED");
|
||||
if (h == nullptr) {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2838,9 +2855,10 @@ int main(int argc, char** argv) {
|
||||
std::strcmp(argv[i], "--present-interval-ms") == 0 || std::strcmp(argv[i], "--presents-per-eval") == 0 ||
|
||||
std::strcmp(argv[i], "--ffx-topology") == 0 || std::strcmp(argv[i], "--ffx-no-prepare") == 0 ||
|
||||
std::strcmp(argv[i], "--sl-tag-for-frame") == 0 || std::strcmp(argv[i], "--sl-tag-whole-resource") == 0 ||
|
||||
std::strcmp(argv[i], "--sl-tag-dlssg-inputs") == 0) {
|
||||
std::strcmp(argv[i], "--sl-tag-dlssg-inputs") == 0 || std::strcmp(argv[i], "--load") == 0) {
|
||||
if (std::strcmp(argv[i], "--plus-ui") == 0 || std::strcmp(argv[i], "--present-interval-ms") == 0 ||
|
||||
std::strcmp(argv[i], "--presents-per-eval") == 0 || std::strcmp(argv[i], "--ffx-topology") == 0) {
|
||||
std::strcmp(argv[i], "--presents-per-eval") == 0 || std::strcmp(argv[i], "--ffx-topology") == 0 ||
|
||||
std::strcmp(argv[i], "--load") == 0) {
|
||||
++i;
|
||||
}
|
||||
continue; // consumed above
|
||||
|
||||
Reference in new issue
Block a user