Skip to content

Security, Secrets & Attachments

WireMailPHPMailer is hardened for production ProcessWire sites where module configuration screens, error logs, and dynamic attachment paths represent real attack surfaces.

In WireMailPHPMailerConfig, six sensitive configuration fields are strictly write-only:

  • dsn (rendered as type="password")
  • Password
  • OAuthClientSecret
  • OAuthRefreshToken
  • DKIM_passphrase
  • DKIM_private_string

Before Inputfield::render, existing values are masked so credentials never leak back into browser HTML. Submitting the config form with blank password fields preserves the stored secrets unless you explicitly check them in _clear_secrets.

2. DSN Validation & Log Credential Redaction

Section titled “2. DSN Validation & Log Credential Redaction”
  • The dsn field accepts only smtp:// and smtps:// schemes with an allowlisted set of query parameters.
  • Call WireMailPHPMailer::redactDsnCredentials($text) before writing SMTP errors or diagnostics to logs; it scrubs smtp:// and smtps:// userinfo credentials (including email-shaped usernames) automatically.
  • Debugoutput defaults to 'error_log' rather than echoing raw SMTP transcripts to browser output.

$mail->attachment($value, $filename = '') enforces strict filesystem rules before attaching any file:

  • Rejects PHP stream wrappers (php://, phar://, http://, ftp://).
  • Rejects null bytes (\0), .. parent traversal segments, and symbolic links (is_link()).
  • Explicitly blocks ProcessWire configuration files (site/config*.php) from ever being attached to an email.

When $config->demo is enabled, WireMailPHPMailer automatically blocks both ___send() (returning 0) and the admin _test_email test sender so demo environments can never be abused as mail relays.

Next steps