feat(feedback): record source IP + user agent and mirror to the audit log (BUNYIP-411) #411
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/BUNYIP-411-feedback-request-metadata"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Closes BUNYIP-411. Records the source IP, browser User-Agent, and other identifying context for every feedback submission, persists them on the record, mirrors them to the audit log, and shows them in the admin feedback detail view so spam can be traced and blocked.
How
X-Forwarded-For, plus the browserUser-Agent, on every outbound/v1call (BUNYIP-311 / BUNYIP-409), and bunyip-api'sextract_client_ipresolves the external IP from those headers. This change reads theUser-Agentinsubmit_feedbackand threads both values through the create + audit paths.20260730000010_feedback_request_metadata.sqladds nullablefeedback.submitter_ip(INET, matching the auditactor_ip_addressconvention) andfeedback.user_agent(TEXT).submitter_ipis the resolved external client IP, not the Docker-internal peer.CreateFeedback/Feedback/AdminFeedbackDetailcarry the new fields;to_admin_detailexposes the IP as a bare host string (strips the/32CIDR suffix).FeedbackSubmittedaudit entry now setsactor_ip_addressand includesip+user_agentin its metadata JSON (the audit schema has no dedicated UA column).Tests
bounded_user_agent_trims_blanks_and_caps_lengthaudit_metadata_carries_ip_and_user_agent/audit_metadata_omits_absent_ip_and_user_agentmetadata_captures_external_ip_behind_trusted_proxy(records the external IP, not the internal peer)client_ip_uses_forwarded_for_when_peer_is_trusted_proxy(bunyip-domain) andresolve_forwarded_iptests (bunyip-web).just check-containeris green (fmt + clippy -D warnings + build + full workspace tests). Feedback uses runtime sqlx queries, so no.sqlxregen.Verification (live stack)
submitter_ip inet,user_agent textpresent onfeedback.X-Forwarded-For: 203.0.113.55+ a UA persists both on the row (submitter_ip=203.0.113.55- the external IP, not the internal peer).audit_logsgets afeedback_submittedrow withactor_ip_address=203.0.113.55and metadata carryingip+user_agent.🤖 Generated with Claude Code
https://claude.ai/code/session_01LerAorB26HGHLfjC9iDUbd