Skip to content

Commit da6d7dc

Browse files
LiteSpeed: document security considerations for INI overrides
Make it clear that the `alter_ini()` function is indeed meant to be operating at the `ZEND_INI_SYSTEM` level, and document in the README file that only trusted sources should be granted direct access to the listener.
1 parent 60ddc8f commit da6d7dc

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

‎sapi/litespeed/README.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ have lsphp bind to address 192.168.0.2:3000,
7676

7777
have lsphp accept request on Unix domain socket `/tmp/lsphp_manual.sock`.
7878

79+
### INI Security
80+
81+
The lsphp listener must only be reachable by trusted sources, generally just
82+
LiteSpeed web front end. Any source that can set its own environment variables
83+
can configure arbitrary PHP INI directives at the `ZEND_INI_SYSTEM` level for
84+
that request. This is the equivalent level of access as the Apache
85+
`php_admin_value` directive or the FPM's `PHP_ADMIN_VALUE` parameter.
86+
7987
## Using LiteSpeed PHP with LiteSpeed Web Server
8088

8189
Detailed information about how to configure LiteSpeed web server with PHP

‎sapi/litespeed/lsapi_main.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,11 @@ static int lsapi_module_main(int show_source)
774774
}
775775

776776

777+
/* The use of `type = ZEND_INI_SYSTEM when the key starts with `\x01\x04` is
778+
* intentional - this is the mechanism by which LiteSpeed communicates the
779+
* system-level INI options that should be set. This is only called from
780+
* override_ini() with LSAPI_ForeachSpecialEnv(). See README.md in this
781+
* directory for more details. */
777782
static int alter_ini( const char * pKey, int keyLen, const char * pValue, int valLen,
778783
void * arg )
779784
{

0 commit comments

Comments
 (0)