← Back to Pull requests

fix(policy): refuse Fee.payer, Fee.granter and AuthInfo.tip instead of dropping them (regalia-kms-bim) #789

Open
unknown opened this pull request with 466 lines diff across 5 files
View on GitHub
unknown unknown commented on Nov 25, 2026 13:37 UTC
Author

Bead: regalia-kms-bim (security). Treat this as security-critical: it needs Sentinel and a council deep read when it goes ready.

Summary


parseFee accepted Fee fields 3 and 4 and dropped their values, so policy capped a fee without knowing who pays it. Per cosmos-sdk proto/cosmos/tx/v1beta1/tx.proto, they are Fee.payer (3) and Fee.granter (4). The tip is a separate message, AuthInfo.tip (3). It was already refused, but only by the unknown-field arm.

  • Fee.payer and Fee.granter are refused in any form (even empty), with the field named.

  • AuthInfo.tip is refused by name, in its own arm. It is refused outright, not added to the fee: a tip goes to the fee payer, its tipper need not be the signer, and no policy setting covers either.

  • Every refusal happens in the parser, before policy (ErrCosmosSignDoc, audit outcome policy-cosmos-malformed), so no nonce, sequence or quota is spent. The fee policy judges is now exactly the fee the chain charges.
  • This follows the "refuse now, decode later" decision of the OpenSpec change refuse-unknown-cosmos-fee-fields. That spec mislabels Fee 3/4 as tip and fee payer; regalia-4kep corrects it. The audit record has never carried a fee: adding one is an audit-schema change with a Python mirror, regalia-kms-4v6. The ModeInfo arm-3 refusal is regalia-kms-b1j.

    Tests


  • internal/policy:

  • - a tip over MaxFee;
    - a tip in a foreign denomination;
    - a tip from another tipper;
    - any tip refused by name;
    - payer and granter in any form, and on any wire type;
    - a clean control;
    - the fee policy judges: a 3500 cap admits it, a 3499 cap denies it as cosmos-fee.
  • internal/operations: with an allow-all policy, a payer, granter or tip is audited exactly policy-cosmos-malformed and reaches neither policy nor token. The clean control signs and hands policy the full two-entry fee.
  • Heavy proof (owner pre-run rule; bar amendment 7)


    heavy-pool-h4i-2, run 20261125T133527-Jonathans-MacBook-Pro-69259, at HEAD 2e200a0aa7a458d25ec0bf7abf4a26b8cb13538b.

    Amendment 7.

  • FAR_TREE b17a093dcc37bc86b596889af35e80016fe5316c, printed far-side.

  • The local rebuild (head tree minus the 22 refused paths) gives b17a093d…: a match.

  • git diff --name-only equals the refused list exactly. List sha256: 572cbc90a6e6348f48ad099eeb0b72f22af5e89a6bf41e41ede37985e4efc829.
  • Environment.

  • SigIgn 0000000000000001.

  • memBound 46% at start.

  • go1.26.11 from the already-cached toolchain, with GOPROXY=off (no download).
  • Suite. internal/policy: ok, 141 PASS, 0 FAIL.

    Mutants, each killed by named tests.

    | Mutant | Killed by |
    |---|---|
    | M1 tip ignored | TipFromAnotherTipper, TipInAForeignDenomination, TipThatPushesFeeOverTheCap, ParseAuthInfoRefusesAnyTipByName |
    | M2 foreign-denom tip admitted | TipFromAnotherTipper, TipInAForeignDenomination, ParseAuthInfoRefusesAnyTipByName |
    | M3 payer/granter admitted | ParseFeeRefusesPayerInAnyForm and ParseFeeRefusesGranterInAnyForm, with subtests |
    | M4 fee judged is not the fee charged | FeeThePolicyJudgesIsTheFeeTheChainCharges, ParseFeeSumsRepeatedAmountEntriesForOneDenomination |

    GAP, stated plainly. internal/operations cannot build on heavy. It imports internal/secrets, and heavy refuses every internal/secrets/*.go path, so it reported [setup failed] (diagnosis run 20261125T133555). The operations audit test is therefore unproven on heavy. Hosted CI confirms that package here, as a confirm-only use the GA approved. The heavy refusal is filed with dfat by the GA.

    A first run, 20261125T133444, is invalid and not cited: the host's go1.26.10 refused go.mod's 1.26.11.

    🤖 Generated with Claude Code

    Diff: 466 lines (+349 / -117) across 5 files Reviewer: jobordu Review duration: 15043m
    All Vouch review confidence checks passed
    Residual risk 0.37 = Change Risk (0.69) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.69 · 466 lines diff across 5 files
    0.69
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.368
    Shallow Review Depth shallow_review_depth
    0.344
    Sensitive Paths sensitive_paths
    0.069
    Real PR Conversation Timeline
    1 comments
    "Review active on #789"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 46.7% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 68.8% (HIGH) · Higher = larger blast radius
    68.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 36.7% · Moderate risk
    36.7%