-
Notifications
You must be signed in to change notification settings - Fork 114
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
Enhance external image hosting in agent configuration #4565
Conversation
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.
LGTM
I thiiiiiink content fragment could be moved as well to your new interface. Maybe worth doing it right now to convince ourselves it's the right one (esp as this PR is not to big)
@@ -0,0 +1,52 @@ | |||
import type { Bucket } from "@google-cloud/storage"; |
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.
gcs
rather than dfs
in name no?
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 stick with DFS for this file/class but all other occurrences will go with GCS.
I was planning to do it in a follow up PR, but let me bake this into this PR. |
Up to you 👍 |
* Strengthen external image hosting in agent configuration * ✂️ * ✂️ * ✂️ * Apply new DFS logic to content fragment + refactor * Accept static hosted Dust Avatars
Description
This PR fixes #4556.
This PR addresses a security issue by improving the way we handle image uploads. It ensures that uploaded files have an image* mimeType, are less than 3MB in size, and restricts the accepted file types in the file picker.
In the agent configuration creation, it verifies that the file is self-hosted on our GCS and has the proper mime type, or it will yield an error.
To make this solution more resilient in the future, this PR starts centralizing the DFS (Distributed File System) logic in one single place.
It also applies some refactoring to the existing logic of content fragment, to use the newly introduced
DFS
class.Risk
Worst case it breaks avatar upload on agent configuration or the content fragment (uploading file, downloading file, ...), but it has been well tested locally.
Deploy Plan