Conversation
Co-authored-by: Marten Schiwek <marten.schiwek@sap.com>
Co-authored-by: Marten Schiwek <marten.schiwek@sap.com>
Co-authored-by: Marten Schiwek <marten.schiwek@sap.com>
…ct even if transaction is rolled back
…ithub.com:ansgarlichter/attachments into feat/emit-events-for-security-relevant-rejections
There was a problem hiding this comment.
The PR introduces audit logging for security events (download rejected, size exceeded, upload rejected) by emitting named events from the attachments service and registering a handler that forwards them to @cap-js/audit-logging when present. The overall approach is sound, but there are a few correctness issues: a no-op ?? undefined that fails to suppress falsy-but-non-nullish IP values, a missing return after req.reject that could cause fall-through in non-throwing mock contexts, and a partial fake req object passed to validateAttachmentMimeType that may throw if _attachments is absent on the entity definition.
PR Bot Information
Version: 1.19.1 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback
- Event Trigger:
pull_request.opened - LLM:
anthropic--claude-4.6-sonnet - Correlation ID:
31682370-2763-11f1-925e-15752cecceb9
SummaryThe following content is AI-generated and provides a summary of the pull request: Add Audit Logging for Security EventsNew Feature✨ Introduces automatic audit logging for attachment security events when Changes
PR Bot InformationVersion:
💌 Have ideas or want to contribute? Create an issue and share your thoughts with us! Made with ❤️ by Hyperspace. |
There was a problem hiding this comment.
The PR introduces useful audit logging for security events but has several correctness issues: the hasAuditLogging() check is fragile and should use cds.env.requires["audit-log"] instead, msg.data is mutated in-place risking corruption for downstream handlers, and the IP address is captured lazily inside cds.spawn callbacks where the socket may already be closed — it should be snapshotted synchronously before the spawn in all three event-emitting paths. The README code example also omits await on cds.connect.to.
PR Bot Information
Version: 1.19.1 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback
- Correlation ID:
5362aad0-2778-11f1-98c7-e76801f9f4e4 - LLM:
anthropic--claude-4.6-sonnet - Event Trigger:
pull_request.ready_for_review
Adding audit logging for sec events in case @cap-js/audit-logging is a dependency.
Depends on #404