Skip to content

Permissions & Security

Currency enforces granular RBAC across financial configuration, rate synchronization, and administrative operations.

Permission Scope
currency-view Read-only access to Setup -> Currencies Overview, Currencies list, Live Currency Converter (./convert/), and locked Rate History (including CSV/JSON export).
currency-manage Create and edit currencies, adjust spreads and sort order, export currency lists, and trigger manual rate synchronizations (./sync/).
currency-admin Full administrative access including Settings, changing the base currency (./set-base/), viewing/exporting trashed currency rows, and permanently deleting non-base currencies.

Every external exchange rate fetch runs through Totoglu\Currency\Http\WireHttpTransport:

  • HTTPS-Only & Public DNS Pinning: assertSafePublicHttpsUrl() resolves both A and AAAA DNS records and pins the validated IP via CURL_IPRESOLVE_V4/CURL_IPRESOLVE_V6 + CURLOPT_RESOLVE to prevent DNS rebinding.
  • Blocked Networks: Rejects trailing-dot hosts, embedded credentials, IPv4 private/reserved ranges, CGNAT (100.64.0.0/10), TEST-NET ranges, multicast, and non-Global-Unicast IPv6 (including IPv4-mapped ::ffff: and 2001:db8::/32).
  • Bounded Streams & Redirects: Enforces a 5_242_880-byte (MAX_RESPONSE_BYTES, 5 MiB) streamed write limit, caps manual redirects at 3 hops, and strips Authorization/Cookie headers across origins.
  • CSRF & Method Guards: ./sync/, ./convert/, and ./set-base/ reject GET (405 Allow: POST), enforce $config->demo read-only protection (403), validate multi-source ProcessWire CSRF tokens, and emit Cache-Control: private, no-store JSON headers.
  • CurrencyEntryGuard: Prevents mutating code inline/bulk, blocks trashing or deleting the active base currency, and enforces reserved cookie name rejection.
Access to Currency Settings and base currency transitions is gated by the currency-admin permission.

Next steps