Improved ExternalSessionFeedback audit#37
Conversation
9df0a38 to
25062b8
Compare
📝 WalkthroughWalkthroughThis PR enhances the ChangesAudit Enhancement and Documentation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Coverage Report for CI Build 25549275773Coverage remained the same at 84.566%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/imio/esign/services/external_session_feedback.py`:
- Around line 88-91: The audit call is logging the raw request payload (data)
which may contain PII or tokens; update the code around the
audit("session_feedback", ...) call to build a sanitized payload instead: define
an allowlist of safe keys and copy only those from data (or redact sensitive
values like emails, tokens, and URLs by masking parts), then format that
sanitized_data for the audit message instead of the original data; keep use of
session_id, code, and db_state as-is and ensure the symbol audit is called with
the redacted/safe representation rather than the raw data.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 26a7833e-e8cf-4a52-97ac-63f2ed842b6f
📒 Files selected for processing (2)
CHANGES.rstsrc/imio/esign/services/external_session_feedback.py
| audit( | ||
| "session_feedback", | ||
| 'session={} code={} db_state={} data="{}"'.format(session_id, code, db_state, data), | ||
| ) |
There was a problem hiding this comment.
Avoid storing raw request payload in audit records.
data may contain PII (emails) and sensitive URLs/tokens; writing the full payload to audit increases privacy/compliance risk. Prefer an allowlist + redaction before logging.
Proposed fix
+ safe_data = {
+ "app_session_id": data.get("app_session_id"),
+ "code": data.get("code"),
+ "session_state": data.get("session_state"),
+ "value_keys": sorted((data.get("value") or {}).keys()),
+ }
audit(
"session_feedback",
- 'session={} code={} db_state={} data="{}"'.format(session_id, code, db_state, data),
+ 'session={} code={} db_state={} data="{}"'.format(session_id, code, db_state, safe_data),
)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/imio/esign/services/external_session_feedback.py` around lines 88 - 91,
The audit call is logging the raw request payload (data) which may contain PII
or tokens; update the code around the audit("session_feedback", ...) call to
build a sanitized payload instead: define an allowlist of safe keys and copy
only those from data (or redact sensitive values like emails, tokens, and URLs
by masking parts), then format that sanitized_data for the audit message instead
of the original data; keep use of session_id, code, and db_state as-is and
ensure the symbol audit is called with the redacted/safe representation rather
than the raw data.
Testé en staging (avant d'afficher data au lieu de juste value et message):
Summary by CodeRabbit
Bug Fixes
Documentation