Skip to content

Permissions & Security

Contacts enforces strict multi-tier authorization across Setup -> Contacts, programmatic services, CLI commands, and optional Headless REST endpoints.

Permission Scope
contacts-view Read-only access to Setup -> Contacts (ProcessContacts::checkAccess()), viewing Contacts, Organizations, and Interaction Notes.
contacts-manage Create, edit, and export Contacts, Organizations, and Interaction Notes, plus quick-create via React relation pickers. Portal invitations also require account-admin (or superuser).
contacts-admin Full administrative control: Settings (contacts-settings), Roles (contacts-roles), Tags (contacts-tags), taxonomy exports, duplicate merging (./merge/), bulk imports (./import/), GDPR subject data exports (?privacy=1), GDPR anonymization (./anonymize/), and record deletions.

When Headless is installed, ContactsHeadlessProvider enforces three scopes (contacts:read, contacts:write, contacts:admin):

  • User-Bound Principals (JWT, PAT, Session): Must satisfy both the token scope and ProcessWire RBAC (ContactsAccess + $entries->can()).
  • Unbound Machine HMAC (scheme === 'hmac' + guest user): Authorized strictly by HMAC scope.
  • Write-Only Redaction: Callers holding contacts:write without contacts:read/contacts:admin (or blueprint view) receive redacted confirmations ({created: false, matchedBy, id} or {id, updated: true}) so pre-existing contact PII is never leaked on upsert.
  • Admin-Only Guards: /api/v1/contacts/{id}/privacy-export, /api/v1/contacts/{id}/anonymize, and setting linked_user_id require contacts:admin (plus contacts-admin for user-bound principals). Auto-creating an organization from company_name requires contacts-organizations create permission.
  • Hidden Block Blueprints: contacts-channel, contacts-address, contacts-membership, and contacts-consent remain gated by contacts-* permissions so non-Contacts editors cannot query CRM PII through generic /api/v1/entries/* endpoints.
  • Transfer Payload Bounds: CSV, JSON, and vCard 4.0 decoded imports enforce a 2 MiB limit (ContactTransferService::MAX_IMPORT_BYTES = 2_097_152); ProcessContacts::executeImport() allows a 4.25 MiB JSON transport envelope so full 2 MiB payloads survive JSON escaping.
  • CSV Formula Neutralization (CWE-1236): ContactTransferService::escapeCsvCell() neutralizes leading formula characters (=, +, -, @) on export, and CSV imports reverse leading apostrophe escaping cleanly.
  • CLI Path Containment: contacts:export --output-file rejects .. traversal and enforces workspace/CWD containment.
  • Linked-User & Consent Safety: mergeContacts() refuses merging two contacts linked to different positive linked_user_id accounts; Account profile sync never matches by phone number; and unauthenticated Forms submissions never overwrite an existing opted-out contact’s marketing_opt_in.

Next steps