Coverage area · Partly checked automatically
Logging and audit trails you can trust
When something goes wrong, your logs are the evidence. This page covers the gaps that make incidents hard to investigate and the leaks that make logs a liability; OpenRouting checks some of the leaks automatically.
what to look for · Logging & audit [ ] Secrets or PII written to logs? [ ] Sensitive actions audit-logged? [ ] Can input forge log lines? fix: structured audit events, no secrets $
A manual checklist for this area. The example below isn't flagged by a stock rule; see what is checked today.
What OpenRouting checks today
Partly checked automatically
Semgrep's default ruleset flags credentials written to Python loggers, log injection in Java, and missing or unencrypted log settings in Terraform; the secrets agent reviews secrets-in-logs findings. Not checked: missing audit events for sensitive actions, unstructured logging in other languages and log tamper-resistance. Use the checklist for those.
Why this area matters
Security logging and monitoring failures are OWASP Top 10 A09. Breaches often go unnoticed for months because sensitive actions were never logged, or the logs that existed couldn't be trusted. At the same time, logs regularly become a leak themselves: tokens, passwords and personal data written to them end up in log aggregators with far wider access than the original system (CWE-532, CWE-117, CWE-778).
Scanners flag individual log calls but can't tell whether an audit trail exists for a sensitive action. Whether one does is a manual check; when Semgrep flags a logged credential, the secrets agent reads the handler to decide whether the value is really a secret.
What goes wrong in real applications
Secrets and personal data in logs
Logging authorization headers, tokens or full request bodies copies credentials into every system that stores or ships logs.
Log injection
Writing unescaped user input into plain-text logs lets it forge entries that look like real events, misleading investigators.
Missing audit events
Role changes, permission grants, exports and login failures that aren't recorded leave no trail to reconstruct what happened.
Tamperable logs
Logs the application can rewrite or delete — local files with no shipping, shared credentials for the log store — can't be relied on after a compromise.
Sample: the risky pattern and the fix
@app.post("/admin/users/<uid>/role")
@require_admin
def set_role(uid):
log.info("admin call auth=%s", request.headers.get("Authorization"))
log.info("role change note: " + request.json["note"])
db.users.update_one({"_id": uid}, {"$set": {"role": request.json["role"]}})
return "", 204@app.post("/admin/users/<uid>/role")
@require_admin
def set_role(uid):
body = RoleChange.model_validate(request.json)
db.users.update_one({"_id": uid}, {"$set": {"role": body.role}})
audit.record( # structured, append-only audit sink
actor=current_user.id, action="user.role_change",
target=uid, new_role=body.role, note=body.note,
ip=request.remote_addr,
)
return "", 204The original writes the caller's bearer token into the logs, concatenates free text that can forge log lines, and never records who changed whose role. The fix drops the token, validates input, and emits a structured audit event to an append-only sink, so the trail is both complete and safe to share.
Illustrative code, simplified for clarity — not taken from a customer repository.
What to look for in your code
- Log calls that include tokens, authorization headers, passwords or full request bodies
- Unstructured logging of raw user input
- Sensitive actions — role changes, exports, deletions, auth failures — with no audit record
- Logging configuration in the repo: local-only files, disabled shipping, debug-level logging in production
Scope and limits
- It reviews logging code and config; it doesn't collect, search or analyze your runtime logs, and it doesn't perform incident forensics.
- Retention, immutability and access controls in your log platform live outside the repository. For an active incident, a manual expert review can be requested from the dashboard.
The checklist above is broader than what runs automatically; see what OpenRouting checks today. Where a scanner does run, it surfaces candidates and a review agent decides whether each one is real — it doesn't promise to find every issue.
Review agents for this area
These agents give the verdict and fix when a scanner raises a finding here.
- Secrets & data exposure — Judges whether a flagged value is really a secret and whether sensitive data leaks through logs or errors.
- Blast radius & data exposure — Assesses how much damage a compromise of this code could cause, and how to shrink it.
Common questions
Can OpenRouting investigate an incident?
Not automatically — it reviews code, not runtime evidence. You can request a manual expert review (incident or audit) from the Agent setup tab, and the team follows up.
Does it check for missing logging everywhere?
No. Audit-event coverage isn't checked automatically, and no static tool can prove logging is complete. Use the checklist on this page for sensitive actions.