Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Changelog

- Avoided error when deleting site.
[sgeulette]
- Improved ExternalSessionFeedback audit.
[chris-adam]

1.0b10 (2026-06-18)
-------------------
Expand Down
6 changes: 5 additions & 1 deletion src/imio/esign/services/external_session_feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ def reply(self): # noqa C901
if session_update:
session.update(session_update)
session["last_update"] = datetime.now()
audit("session_feedback", "session={} code={} db_state={}".format(session_id, code, db_state))
audit(
"session_feedback",
'session={} code={} db_state={} data="{}"'.format(session_id, code, db_state, data),
)
Comment on lines +88 to +91

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

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.


except Exception as e:
self.request.response.setStatus(500)
Expand All @@ -104,5 +107,6 @@ def _authorized(self):
return verify_auth_token(token, groups=["access_imio-apps-docs"])

def check_permission(self):
"""Override the default permission check to implement token-based authentication."""
if not self._authorized():
raise Unauthorized("Unauthorized: Invalid or missing authentication token")
Loading