Skip to content

Gronktayvius Redteam

The middle of the diff was cut off. I am reading only that omitted stretch so the review covers the full change.The search tool cannot read the local prompt. I am opening the omitted diff lines directly.Static red-team review of the FLT-359 diff only. I did not execute the code or probe any live service. Default Approvals:Enabled=false is inert. Once enabled, the gate does not establish an off-PC approval boundary, and the phone never sees the effect it is asked to authorize.

Critical

1. docs/ENABLE-RUNBOOK.md:16 and docs/ENABLE-RUNBOOK.md:21; src/Forge.Approvals.Cli/Program.cs:12, Program.cs:36, Program.cs:95; src/Forge.Approvals.Twilio/TwilioProvider.cs:145

The runbook says an off-PC executor may treat forge-approve verify exit 0 as authorization, and that hard stops are safe when effect credentials live off-PC. The Twilio Account SID, auth token or API key, and factor id are read from this PC's environment. TwilioProvider.SendAsync presents them to https://verify.twilio.com, then ApprovalCli reports the result as an unsigned exit code and a plaintext decision. There is no signed approval artifact.

Attack path: any same-user agent replaces forge-approve on PATH, or answers the executor itself, and prints Approved with exit 0. That is the same failure as a forged "Andrew said yes" chat line. The on-PC Twilio credential also lets that agent talk to Verify directly. Whether a push factor can be enrolled and verified with only that credential and an attacker-held ES256 key needs live-doc verification. CreateFactorAsync (TwilioProvider.cs:114, Binding.PublicKey) is the enrollment call shape, and ParseChallenge never compares the response factor_sid to options.FactorSid (TwilioProvider.cs:74 checks only factor_type == "push").

Fix: the process that holds the effect credential must call Verify itself, with an API key that never resides on the agent machine and cannot create factors. Pin factor_sid, service sid, and entity. Accept only a Twilio-verified result fetched by that executor. Treat this CLI's exit code as untrusted input.

High

2. src/Forge.Approvals.Twilio/TwilioProvider.cs:18-32

The challenge the phone can show is Details.Message (human summary), plus fields for kind, a non-canonical target JSON blob, and ticket. EffectBinding and CommandSha256 are only inside the hash in HiddenDetails. ParseChallenge (TwilioProvider.cs:79-92) never checks that Twilio echoed the visible details unchanged.

Attack path: the agent requests a benign summary and target (Destination or Repo looks harmless; ticket looks routine) and puts the real command in EffectBinding / CommandSha256. Andrew approves what the phone shows. verify then succeeds because the hash matches the hidden dangerous binding. docs/MOBILE-APP.md calls a trusted channel for the full canonical action an enablement prerequisite. Nothing in Program.Main or doctor refuses Approvals__Enabled=true when that channel is absent.

Fix: put the full canonical action, or at least effect binding and command hash, in the visible fields, and fail the challenge if they do not fit without truncation. On create, require the response echo of message and fields to match what was sent. Refuse to enable until a pinned factor is configured.

3. src/Forge.Approvals.Notify/Notifications.cs:17-19 and Notifications.cs:30-31

pavlok is launched by relative name with UseShellExecute=false and CreateNoWindow=true. Arguments are only the fixed token vibe, so the action JSON cannot inject shell text, and a console window is suppressed for a console-subsystem binary. ProcessStartInfo still inherits the parent environment, which holds Approvals__Twilio__AuthToken or the API key secret and Approvals__Email__Password. Resolution of a bare pavlok follows PATH. Whether .NET 10 also searches the current directory needs live-doc verification.

Attack path: a pavlok binary earlier on PATH (or in the application directory) starts hidden, reads the inherited environment, and exfiltrates the Verify credential. That credential is what finding 1 turns into an approval.

Fix: launch a full, pinned path. Build an explicit environment block that does not copy the parent. Keep CreateNoWindow, UseShellExecute=false, and WindowStyle=Hidden.

4. tests/Forge.Approvals.Tests/stryker-config.json:4-6; docs/VALIDATION.md:25-36; no CI workflow in the diff

No pipeline runs SAST, DAST, or the unit tests, so none of them can fail a build. Semgrep, CodeQL, and ZAP are absent. Stryker names only Forge.Approvals.Core.csproj with mutate **/*.cs and thresholds.break 60. TwilioProvider.ParseChallenge, FileReplayStore, ApprovalCli exit codes, SMTP, and the Pavlok spawn are outside that mutation set. docs/VALIDATION.md records that dotnet test and dotnet stryker never ran (user-level NuGet.Config access denied). A mutant that skips the hidden-details hash compare would not be scored. The stock fixture tests/Forge.Approvals.Tests/Fixtures/twilio-push-challenge.json:24-26 has hidden_details.ip only. The success shape of actionHash / jti is not a captured producer body.

Fix: run Stryker against Core, Twilio, Notify, and Cli, and fail the build on the break threshold. Add a CI job that runs dotnet test -warnaserror and fails on a red suite. Before enablement, replace the fixture with a verbatim live challenge that contains Forge's hidden details, and assert a hash mismatch and a wrong factor_sid both deny.

Medium

5. src/Forge.Approvals.Cli/Program.cs:12, Program.cs:66, Program.cs:95; src/Forge.Approvals.Core/ApprovalGate.cs:49

bool.TryParse treats 1, yes, true (trailing space), and an empty value as disabled. Disabled request and status exit 0. Enabled status always exits 0, including for Denied, Invalid, and Expired, and Evaluate(..., consume: false) returns Approved without writing the replay marker (ApprovalGate.cs:49).

Attack path: a fleet hook that treats exit 0 as permission, or that polls status and acts on the text Approved, authorizes work while the flag is default-off, and can repeat a single approval until expiry.

Fix: if Approvals__Enabled is set to anything other than exact true or false, exit non-zero on every command. Make request exit non-zero when disabled. Make status exit non-zero unless the printed decision is Pending or Approved, and never document it as an authorization signal. Keep consume-on-verify only.

6. src/Forge.Approvals.Core/Models.cs:113-117

ValidateLabel only checks NFC and well-formed UTF-8. Mixed-script and confusable characters stay valid. NFC does not stop a Cyrillic lookalike in Repo, Host, Path, Destination, or HumanSummary. The hash then binds the lookalike, and the phone shows the lookalike. Restrict identifiers to an allowlisted repertoire, or reject IdentifierStatus / mixed-script labels (Unicode TR39).

7. src/Forge.Approvals.Notify/Notifications.cs:66 and Notifications.cs:83-88

The pinned sentence is a real constant and the recipient is a single MailAddress whose parsed address must equal the raw configuration string (Notifications.cs:74-77). The body still starts with attacker-controlled HumanSummary, and the subject uses only Destination, else Repo, else Host, else Path, else the first recipient, stripped of \r and \n and cut at 80 characters. Other populated target fields and the effect binding are omitted. U+2028 and U+2029 in the subject are not stripped.

Attack path: the agent sets Destination to a benign label and Path or Repo to the real target, and writes a summary that tells Andrew to treat the email as the approval. The pin sits under that text.

Fix: put PinnedOrigin first, render every populated target field plus effect binding and command hash as quoted data, and strip Unicode line breaks in the subject. Keep one plain recipient.

8. src/Forge.Approvals.Core/Jcs.cs:97-100

Quote escapes C0 controls and the standard short escapes. It leaves U+2028 and U+2029 raw. RFC 8785 follows JSON.stringify, which escapes both. A phone or executor using a correct JCS library will compute a different ActionHash than ActionJson.Hash (Models.cs:85-86). That fails closed if the other side refuses the mismatch, and it fails open if that side trusts the PC-supplied hash and displays a different canonical string. Number goes through GetDouble() (Jcs.cs number arm). Amounts on the action-hash path are strings, so this is not an amount collision. The validation note says 24 Appendix B vectors passed in a side smoke harness. xUnit did not run them.

Fix: emit \u2028 and \u2029. Set AllowDuplicateProperties = false on the JsonDocument options as well as the manual reject (property existence on .NET 10 needs live-doc verification).

9. src/Forge.Approvals.Cli/Program.cs:23; src/Forge.Approvals.Cli/Stores.cs:16 and Stores.cs:40

Replay uses FileMode.CreateNew and FileShare.None, and the clock rejects now < last under clock.lock. Those are the right structures for a local NTFS volume. The default directory is .forge-approvals under the current working directory, created with inherited ACLs. clock.last can be deleted to clear the high-water mark. CreateNew atomicity on SMB or OneDrive needs live-doc verification and is not something I would trust.

Attack path: run verify from a repo the agent can write, or point Approvals__StateDirectory at a synced folder, and either pre-plant state or remove clock.last and roll the clock back so an expired request looks live. Same-user deletion of *.spent is already admitted by the runbook. It is still a replay if enablement treats these files as the anti-replay authority.

Fix: require an explicit state directory when enabled, create it with a user-only ACL, refuse non-local NTFS, and fail closed if clock.last is missing after the first successful record.

Controls that hold

Disabled Main returns before it builds HttpClient, the gate, or either notifier (Program.cs:19-20). verify while disabled exits 10 (Program.cs:66). Exceptions on the CLI are printed as Invalid and the message is dropped, so a transport error does not echo the basic-auth secret. Unknown Twilio statuses become Invalid (TwilioProvider.cs:90). Hash, JTI, and challenge-id mismatches return Invalid before consume (ApprovalGate.cs:37-43). Expiry is checked again after the provider returns (ApprovalGate.cs:47-48). Numeric amounts and non-canonical decimals are rejected. Duplicate keys are rejected in Jcs and in RejectDuplicates. Redirects are off (Program.cs:22). Service, entity, and challenge ids are Uri.EscapeDataString'd under a fixed https://verify.twilio.com/v2/ origin, which blocks path and host injection through those fields. Email is plain text, one configured recipient, and the pin is not taken from the action. Pavlok does not receive action fields. Production projects take no third-party NuGet packages. No database or cloud resource is mutated by hand. No workflow file, Terraform, or migration is in the diff.

Tests, tooling, dependencies

Visible tests lock several real gates: disabled ApprovalCli does not touch a null gate, a fake provider is not called when the file hash mismatches, sixteen concurrent FileReplayStore consumers have one winner, clock rollback and a corrupt clock.last fail, and a second verify fails. They drive ApprovalCli, not Program.Main. They use a fake provider, so they do not lock ParseChallenge, factor_sid, SMTP, or the child environment. A middle slice of the test diff was not in the text I could score. I am not calling those methods missing or passed.

CVE status of xUnit 2.9.3, Microsoft.NET.Test.Sdk 17.14.1, and the inbox System.Net.Mail.SmtpClient on the .NET 10 runtime needs live-advisory verification. I am not asserting a CVE id. SmtpClient with EnableSsl = true (Notifications.cs:56) is the obsolete STARTTLS client. Whether .NET 10 fails closed on a certificate hostname mismatch or on STARTTLS strip needs live-doc verification. There is no pinned SMTP host.

Do not enable this slice. The default-off path is inert. The enabled path still authorizes from an on-PC signal and does not show Andrew the effect he is approving.

Jira FLT-359 · Vikunja · BOARD.md