-
Notifications
You must be signed in to change notification settings - Fork 8
Fix: Non-draft support and MTLS Support for Multitenant S3 Access #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Replaced legacy `srv.after("PUT", ...)` with `AttachmentsSrv.registerUpdateHandlers(...)` - Ensures consistent handling of stream uploads for non-draft entities
… non-draft entities
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks fine and seems be working fine - both non draft and draft entity (tested locally).
Just a little change in regards of the isAttachmentAnnotated
function to be reviewed.
Please, document the API usage |
have added the same |
have added it in the readme, have referenced to the ./tests/non-draft-request.http where I have updated the Requests with UpID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were couple of review comments based on logging and potential issue based on usage inconsistency
lib/malwareScanner.js
Outdated
await updateStatus(AttachmentsSrv, key, "Scanning", currEntity, draftEntity, activeEntity) | ||
|
||
const credentials = getCredentials() | ||
DEBUG?.(`Malware Scanning: Scanning content to entity ${key} - credentials = ${JSON.stringify(credentials)}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not log credentials in any log output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This log was added just for debug options. I was having several problem with credentials checking, thought it would be useful. May be removed if you find insecure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll move this to a separate PR.
lib/malwareScanner.js
Outdated
const contentStream = await AttachmentsSrv.get(currEntity, key) | ||
|
||
DEBUG?.(`Malware Scanning: Scanning content to entity ${key} - contentStream = ${contentStream}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we logging contentStream binary ? What purpose does it serve?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above - just checking if every step is being complete, since in BTP is not possible to debug with breakpoints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll move this to a separate PR.
req.data.url = `${req.tenant}_${req.data.url}`; | ||
} | ||
req.data.ID = cds.utils.uuid() | ||
let ext = extname(req.data.filename).toLowerCase().slice(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any chance the user sends the request with a file without extension? Will this code break if extension is not there for file ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like that if nothing is found at the Ext2MimeTypes
map, it will fallback as "application/octet-stream" mime type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, The code will not break if there’s no file extension. It will simply assign mimeType = "application/octet-stream".
This reverts commit 6a20230.
…/attachments into fix/non-draft_mtls_upload
Hello @vlovini , |
…dded original GET and PUT requests
PR fix Reference - #231
Key Changes:
1) Unified and Improved Handler Registration for Draft vs Non-Draft
2) Standardized Draft and Non-Draft Handler Registration:
AttachmentsSrv.registerDraftUpdateHandlers() for drafts
AttachmentsSrv.registerUpdateHandlers() for non-drafts
3) Service Manager Authentication via mTLS in helper.js
4) Documentation Examples
5) Improved logs