Skip to content

fix: add admin auth to set_legal_vault and collect_streaming_fees (siblings of #38) - #43

Open
leanworld7-netizen wants to merge 2 commits into
EquipChain:mainfrom
leanworld7-netizen:fix/legal-vault-fees-auth
Open

fix: add admin auth to set_legal_vault and collect_streaming_fees (siblings of #38)#43
leanworld7-netizen wants to merge 2 commits into
EquipChain:mainfrom
leanworld7-netizen:fix/legal-vault-fees-auth

Conversation

@leanworld7-netizen

Copy link
Copy Markdown

Security Fix: Sibling vulnerabilities to #38

Vulnerability 1: set_legal_vault self-authorizing (CRITICAL)

Same pattern as #38vault.require_auth() was called on the caller-supplied vault address, allowing anyone to self-authorize as the legal vault.

Impact: The legal vault address is used in legal_freeze and release_legal_freeze for fund transfers. An attacker setting themselves as the legal vault could intercept or block legal freeze releases.

Vulnerability 2: collect_streaming_fees no auth (MEDIUM)

collect_streaming_fees had zero authentication. Anyone could call it to reset the StreamingFeeAccrued counter to 0 for any stream, preventing the protocol fee vault from ever collecting accrued fees.

Impact: Griefing/DoS — streaming fee accruals can be wiped by any caller before the vault collects them.

Fix

Both functions now require an admin: Address parameter verified against DataKey::CurrentAdmin:

  • set_legal_vault(env, vault)set_legal_vault(env, admin, vault)
  • collect_streaming_fees(env, stream_id)collect_streaming_fees(env, admin, stream_id)

This follows the same pattern used by nearby admin-gated functions (L6597, L6671, L8220).

Relationship to #38

These are sibling bugs to the set_government_vault / set_tax_rate vulnerabilities reported in #38. The same self-authorizing pattern was used in set_legal_vault, and collect_streaming_fees had no auth at all.

…x_rate

set_government_vault called require_auth() on the caller-supplied vault_address,
allowing anyone to self-authorize as the government vault. set_tax_rate had no
auth at all with a comment saying 'Should be admin-only in production'.

Both functions now require an admin: Address parameter that is:
1. Authenticated via require_auth()
2. Verified against the stored CurrentAdmin

This prevents unauthenticated takeover of settlement payouts.
set_legal_vault: had vault.require_auth() on caller-supplied vault address
(same self-authorizing bug as EquipChain#38). Now requires admin verified against
DataKey::CurrentAdmin.

collect_streaming_fees: had NO auth at all. Anyone could call it to zero
out accrued streaming fees for any stream, preventing the protocol fee
vault from collecting. Now requires admin auth.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant