PHP code example of iamariezflores / php-sec-check
1. Go to this page and download the library: Download iamariezflores/php-sec-check library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Aquilinoflores\PhpSecCheck\Checks\Laravel\EnvCredentialsCheck;
Route::get('/security-audit', function () {
$customKeys = ['CUSTOM_SECRET', 'ANOTHER_KEY'];
$check = new EnvCredentialsCheck($customKeys);
$results = $check->run(base_path());
return response()->json($results);
});
interface CheckInterface {
public function run(string $projectRoot): array;
}
bash
composer
=== PHP Security Check Tool ===
[PHP VERSION]
[OK] PHP version is up-to-date.
[DISPLAY ERRORS]
[WARN] 'display_errors' is enabled. Disable in production.
[COMPOSER DEPENDENCIES]
[OK] No known vulnerabilities found in dependencies.
[DANGEROUS FUNCTIONS]
[WARN] Dangerous function enabled: exec
[WARN] Dangerous function enabled: shell_exec
[WARN] Dangerous function enabled: curl_exec
Laravel project detected!
[WARNING] Sensitive key 'APP_KEY' found in .env!
[WARNING] vendor/ directory exists and is not ignored in .gitignore!
Scan complete.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.