#0404
A configuration management endpoint lets admins fetch config files by name from a central config directory.
The handler accepts any extension and any path. An attacker requests ../../app/secret.php or ../../etc/passwd.
Two bugs exist: (1) no path traversal check, and (2) no extension allowlist — attackers can read PHP source files, shell scripts, and system files.
Combining extension filtering with path traversal checks is defence-in-depth. Either check alone can be bypassed; together they prevent both direct file disclosure and type confusion attacks.
getConfigPath to reject traversal attempts and reject disallowed extensions..json and .yaml extensions are permitted.'Invalid config file' for bad extension or traversal.getConfigPath('/etc/app/configs', 'setup.php')// → throws Error('Invalid config file')
getConfigPath('/etc/app/configs', '../../secret.json')// → throws Error('Invalid config file')
getConfigPath('/etc/app/configs', 'database.json')// → returns '/etc/app/configs/database.json'