Protect Credentials and Run Read-Only MCP Presets¶
Read Reference Index before you start.
Prerequisites¶
- Make sure that
conf/mcp_api_executor_presets.jsonexists in the repository. - Store database credentials in a vault or
0600option file.
Safety Instructions¶
CAUTION: Never pass -p or --db-password inside CLI arguments or MCP
calls.
Command arguments expose plaintext passwords in ps aux and /proc.
CAUTION: Never use --all, --auto-detect, --sync-cis, or --force
inside MCP presets.
Forbidden flags break the read-only cis.mcp.contract.v1 boundary.
Procedure¶
- Export the password strictly via
CIS_DB_PASSWORD:
- Or pass a
0600option file for MySQL, MariaDB, or PostgreSQL:
chmod 0600 ~/.my.cnf
python3 audit_cis.py -t mariadb106 --defaults-file ~/.my.cnf -f json -o reports/m106.json
- Run only the four read-only presets from
conf/mcp_api_executor_presets.json:
python3 audit_cis.py --list-targets
python3 audit_cis.py -t postgresql16 -f sarif -l en -m local -o reports/pg16.sarif
python3 audit_cis.py --remediate-dry-run --from-report reports/pg16.json --remediation-format diff --remediation-output reports/pg16.diff
- Unset
CIS_DB_PASSWORDimmediately after audit execution finishes:
NOTE: SecretSanitizer masks passwords and tokens with *** in logs
and SARIF outputs.
Verification¶
- Run the contract and credential tests:
- Confirm zero plaintext passwords inside generated JSON and SARIF files.
Rollback¶
- Unset
CIS_DB_PASSWORD. - Clear shell history (
history -c). - Rotate any exposed database password immediately.
- Delete log and report files from that session.