Skip to content

Security: LiveHelperChat/doc

Security

docs/security.md

id security
title Security
sidebar_label Security

Quick security review (system/update)

You can run a quick built-in security review of your installation at any time by going to:

System configuration > Live Helper Chat update information (system/update)

The Status/security checks table automatically highlights issues sorted by severity (errors first, then warnings, then passing checks) with direct links to the relevant settings. It reviews:

  • Strong secret hash — checks that secrethash is at least 50 characters long (see Secret hash).
  • Strong export hash — checks that export_hash is either empty (export disabled) or at least 50 characters long (see Export hash).
  • Trusted host — checks that trusted_host_patterns is configured (see Trusted hosts and Site address).
  • Site address & HTTPS — checks that site_address is set and uses https:// (see Trusted hosts and Site address).
  • Auto login — warns if auto login is enabled, flags weak autologin secrets (fewer than 32 characters), and shows the number of predefined login links (user/autologinconfig).
  • Debug output — flags if debug_output is enabled in settings/settings.ini.php (see Debug).
  • iFrame embedding — warns if allow_iframe is enabled (which sets SameSite=None on session cookies) and shows the configured allow_iframe_domain.
  • Content Security Policy (CSP) — checks whether csp is enabled, warns if it is in report_only mode, and shows whether violation logging is active (see Content Security Policy (CSP)).
  • Password policy — checks minimum password length (>= 8), failed login attempt limit, password expiration, and login IP restriction (see Password requirements, user/passwordrequirements).
  • One login per account — checks whether one_login_per_account is enabled in settings/settings.ini.php.
  • Back office URL — checks whether the default site_admin back-office URL in default_admin_site_access has been replaced with a custom site access (see How to limit/protect back office access).
  • Administrators — reports the number of enabled administrator accounts and warns if any administrator still has autologin enabled (see Users, user/userlist).
  • Rest API — reports active API keys, checks whether username/password Rest API login is disabled (disable_rest_api_by_user), and warns if any API key user can still log in with a password or autologin (see Rest API, abstract/list/RestAPIKey).
  • Mobile app notifications — warns if mobile application / XML API access is enabled (mobile/settings).
  • Log files public access — checks whether cache/default.log is writable and verifies from the browser that cache/default.log and rotated log files (default.log.1–default.log.5) are not publicly reachable over HTTP (see Nginx configuration tips).

Secret hash

Since version 3.97, the secret hash was too weak for modern security purposes. If you have an existing installation, I suggest changing it to a string of at least 50 characters. 80 characters is recommended, and the string should include special characters.

https://github.com/LiveHelperChat/livehelperchat/blob/5cc78ea50bb5dcbce325f3cee61d21f7aa04e5d5/lhc_web/settings/settings.ini.default.php#L12

Trusted hosts and Site address

In version 3.97, there are a few new settings. If you are missing them, you can add them to your settings/settings.ini.php file under the site section.

It will avoid Live Helper Chat in some circumstances generate URL pointing to third party website.

'site_address' => 'https://demo.livehelperchat.com',
'trusted_host_patterns' => [
     '^demo\.livehelperchat\.com$', // Explicit domain
     '^.+\.livehelperchat\.com$',   // Any subdomain
],

Location in default configuration

https://github.com/LiveHelperChat/livehelperchat/blob/5cc78ea50bb5dcbce325f3cee61d21f7aa04e5d5/lhc_web/settings/settings.ini.default.php#L39
https://github.com/LiveHelperChat/livehelperchat/blob/5cc78ea50bb5dcbce325f3cee61d21f7aa04e5d5/lhc_web/settings/settings.ini.default.php#L48-L49

How to limit/protect back office access

Few things

  • Remove index.php from URL
  • Limit what URL's are exposed to the public, nginx example
  • Disable mobile app access. In mobile/settings do not enable Enable mobile application and mobile notifications
  • Disable disable_rest_api_by_user It will disable mobile app also.
  • Limit Rest API and site_admin via apache E.g
<Location "/site_admin/">
    SetEnvIf X-Forwarded-For "192.168.1.2" Remi
    <RequireAny>
        Require env Remi
        Require ip 192.168.1.2/32
    </RequireAny>  
</Location>
#Allow sso for crm
<Location ~ "/site_admin/ssoprovider/.*">
    SetEnvIf X-Forwarded-For "192.168.1.2" Remi
    <RequireAny>
        Require env Remi
        Require ip 192.168.1.2/32
    </RequireAny>   
</Location>
#Allow Rest API
<Location ~ "/restapi/.*">
    SetEnvIf X-Forwarded-For "192.168.1.2" Remi
    <RequireAny>
        Require env Remi
        Require ip 192.168.1.2/32
    </RequireAny>  
</Location>

Export hash

As with secrethash, the same situation applies to the Export hash.

The Export hash can be changed in:

System configuration > Live Help configuration > Chat configuration > Misc > Chats export secret hash

Set it to a length of at least 50 characters.

Content Security Policy (CSP)

Live Helper Chat sends a Content-Security-Policy HTTP header on private (permission-protected) and back-office routes.

  • frame-ancestors 'self' (plus allow_iframe_domain if configured) is sent on all permission-protected and site_admin routes to prevent clickjacking, together with X-Content-Type-Options: nosniff (prevents MIME-sniffing) and Referrer-Policy: strict-origin-when-cross-origin (prevents leaking admin paths, chat IDs, and query parameters in Referer headers).
  • On routes that require user permissions, script-src, style-src, connect-src, worker-src, object-src, base-uri, and form-action directives are also enforced by default to restrict where JavaScript, CSS, AJAX/WebSocket requests, Web Workers, plugins/objects, base URLs, and form submissions can be loaded from or sent to.

Configuration in settings/settings.ini.php

CSP is enabled by default even if the csp block is not yet present in your settings/settings.ini.php. To customize or disable it, add the csp array under the site section:

'csp' => array(
    'enabled' => true,
    'report_only' => false,
    'log_violations' => true,
    'script_src' => "'self' 'unsafe-inline' 'unsafe-eval' https://maps.googleapis.com",
    'style_src' => "'self' 'unsafe-inline' https://fonts.googleapis.com",
    'connect_src' => "'self' https://maps.googleapis.com",
    'worker_src' => "'self' blob:",
    'object_src' => "'none'",
    'base_uri' => "'self'",
    'form_action' => "'self'",
),

How each setting works:

  • enabled — set to false to disable script-src, style-src, connect-src, worker-src, object-src, base-uri, and form-action (frame-ancestors, X-Content-Type-Options, and Referrer-Policy remain active).
  • report_only — set to true to send script-src, style-src, connect-src, worker-src, object-src, base-uri, and form-action in Content-Security-Policy-Report-Only instead of blocking (useful for troubleshooting custom extensions), while keeping frame-ancestors enforced in Content-Security-Policy.
  • log_violations — enabled by default (true); adds report-uri pointing to audit/logjserror and stores browser CSP violation reports in the Audit log under the csp category (works in both enforced and report_only modes). Set to false to disable.
  • script_src — allows external <script src="..."> files only from the same origin ('self') and Google Maps (https://maps.googleapis.com). 'unsafe-inline' and 'unsafe-eval' are included because Live Helper Chat templates and AngularJS rely on inline scripts and expression evaluation. Any script from another domain is blocked.
  • style_src — allows external stylesheets only from 'self' and https://fonts.googleapis.com (injected by the Google Maps JS API), while permitting inline <style> tags and style="..." attributes ('unsafe-inline').
  • connect_src — restricts XMLHttpRequest (AJAX), fetch(), WebSocket, EventSource, and sendBeacon() calls to 'self' and https://maps.googleapis.com.
  • worker_src — restricts Web Workers to 'self' and blob: (required by voice message MP3/WASM encoding and the Ace editor).
  • object_src — defaults to 'none' to block <object>, <embed>, and <applet> elements.
  • base_uri — defaults to 'self' to prevent injected <base> tags from hijacking relative URLs.
  • form_action — defaults to 'self' to prevent redirecting form submissions to external domains.
  • Setting any directive (script_src, style_src, connect_src, worker_src, object_src, base_uri, or form_action) to an empty string ('') omits that directive from the header.

Adding external domains

If your installation uses features or extensions that communicate with external origins from the browser, append those origins to the corresponding directive in settings/settings.ini.php:

  • NodeJS / Centrifugo / WebSocket helper on a separate subdomain or port: add its origin (for example wss://ws.example.com) to connect_src.
  • Custom admin themes, fonts, CDNs, or extensions: add their domains to script_src, style_src, or connect_src as needed.

Per-view CSP rules in module.php

Individual module views (including custom extensions) can append origins only for that specific route by defining a csp array in $ViewList inside module.php. For example, system/update allows https://livehelperchat.com in connect_src only on the update page rather than globally:

$ViewList['update'] = array(
    'params' => array(),
    'uparams' => array('action','scope'),
    'functions' => array( 'performupdate' ),
    'csp' => array(
        'connect_src' => 'https://livehelperchat.com'
    )
);

Blocking BBCode tags for visitors

Visitors can include BBCode tags directly in chat messages. Disabling tags that visitors do not need reduces the risk of external tracking images ([img]), phishing or malicious links ([url]), unwanted embeds ([youtube]), or spoofed interactive elements in the operator back office.

You can configure BBCode restrictions in:

System configuration > Live Help configuration > Automation > BBCode configuration (system/bbcode)

For each BBCode tag you can independently check:

  • Disable for visitor messages — prevents the tag from being rendered in visitor messages and hides it from the visitor BBCode toolbar.
  • Disable for operator messages — prevents the tag from being rendered in operator messages and hides it from the operator editor toolbar.

Common tags to consider disabling for visitors if you do not need them:

  • [img] — prevents visitors from embedding external images (which can leak operator IP addresses or trigger external requests).
  • [url] — disables clickable [url] links from visitors.
  • [youtube] — prevents embedded YouTube iframes.
  • [paypal], [link_trigger], [button_action], [survey], [fupload], [baseurl], [loc] — interactive or system-oriented tags generally meant for operators/bots rather than visitors.

Whitelisting allowed URL domains for visitors

Under the [url] option on the same BBCode configuration page, you can configure a domain whitelist for visitor messages:

example.com,support.example.org||⚠️ Disallowed Link ⚠️: {url}
  • List allowed domains separated by commas (subdomains of listed domains are also allowed).
  • Append || followed by a message template containing {url} as the placeholder.
  • Any URL in a visitor message that does not match the whitelist is automatically defanged (https[:]// and [.]) and displayed with your placeholder instead of a clickable link.

Exposing environment information (expose_env)

To avoid exposing server paths, environment variables, $_SERVER contents, database configuration (SHOW variables), and phpinfo() in the back office (audit/configuration), those sections are hidden by default — even for users with the lhaudit -> see_system permission.

They are only displayed when expose_env is configured in settings/settings.ini.php under the site section with explicit allowed IP addresses or IP ranges, and the current operator's IP matches:

'expose_env' => '', // Default: hidden for all IPs. E.g. '127.0.0.1,192.168.1.0/24'

Leave expose_env empty ('') in production, or restrict it strictly to trusted administrator IPs while troubleshooting. See Debugging Application: Exposing Environment Information for supported IP range formats and usage details.

There aren't any published security advisories