security
Security rules for the BMW Wallbox integration — secrets/credentials, SSL/TLS, OCPP input handling, safe logging, and dependency hygiene.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Security rules for the BMW Wallbox integration — secrets/credentials, SSL/TLS, OCPP input handling, safe logging, and dependency hygiene.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Core project conventions for the BMW Wallbox Home Assistant integration — architecture, OCPP/EVCC rules, Python/HA style, coordinator pattern, git, and testing standards.
Testing conventions for the BMW Wallbox integration — pytest, HA fixtures, entity/handler/command patterns. Tests are MANDATORY for every new entity, handler, and command.
| name | security |
| description | Security rules for the BMW Wallbox integration — secrets/credentials, SSL/TLS, OCPP input handling, safe logging, and dependency hygiene. |
| user-invocable | false |
This integration runs inside Home Assistant and exposes an OCPP 2.0.1 WebSocket server that the wallbox connects to. The main risk surfaces are secrets, TLS, and untrusted OCPP input.
FAIL — never:
RFID_TOKEN = "04a125f2fc1194" # hardcoded literal
password = "hunter2"
PASS — always from config:
token = self.config.get("rfid_token")
if not token:
_LOGGER.error("No RFID token configured")
return {"success": False, "message": "No RFID token configured"}
privkey.pem, *.key) are referenced by path from config — never committed, never inlined..env and key material stay out of git (already covered by .gitignore).# FAIL — leaks a secret
_LOGGER.info("Using RFID token %s", rfid_token)
_LOGGER.debug("Config: %s", self.config) # config may contain keys/paths
# PASS — log identifiers and status, not secrets
_LOGGER.info("Starting transaction on evse_id=%s", evse_id)
_LOGGER.debug("SetChargingProfile response: %s", response.status)
_LOGGER only — print() is banned (ruff T20).os.path.isfile).ssl.CERT_NONE, verify=False) to "make it work".S104 (binding to all interfaces) is intentionally allowed for the OCPP server — do not "fix" it.Treat everything arriving from the wallbox (message fields, meter_value, kwargs, identifiers) as untrusted:
eval, exec, os.system, subprocess(..., shell=True), or pickle.loads.float/int) so a malformed value can't crash the handler loop..pre-commit-config.yaml) and via ruff S rules.requirements-*.txt pinned; the OCPP/HA versions matter for protocol behavior..venv/bin/ruff check custom_components/ tests/ --select S to surface bandit findings on demand.S rules (flake8-bandit) — flagged in lint on edit and in CI.pyproject.toml-configured, excludes tests..claude/hooks/protect-files.sh) — blocks Claude from editing .env, private keys, and venv/cache/VCS internals._LOGGER output or committed filesruff --select S clean on changed code