-
Notifications
You must be signed in to change notification settings - Fork 109
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
Bond userEmail with userId on Dust managed apps in createConversation #7478
Conversation
260abf2
to
665db9b
Compare
|
|
||
// If we have a context email but no user, we try to find a user with that email in the workspace. | ||
if (!userId && context.email) { | ||
const matchingUser = await UserResource.fetchByEmail(context.email); |
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.
Let's move this to the API endpoint as this is specific to the public API right?
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.
Yup. Sounds good indeed.
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.
Moved - not sure about the location of getUserAuthenticatorFromEmail(), does it sound right?
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.
Put back here after authenticator discussion. Not sure moving it to API endpoint is worth the extra attribute on postUserMessage()
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.
fair.
You likely want to dry it and use it in editUserMessage as well?
…reation + add it to messages endpoint as well
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.
Thinking more about it this means that anyone with an API key can impersonate any user on Dust.
They can as an example access vaults they don't have access to.
So that's deifnitely a no go.
What are the problems to solve exactly?
That's just being used to save userId in the message when creating the conversation to track MAU from external apps managed by Dust (like we currently do with Slack). If vaults accesses based on conversation participants (userId in messages from that conversation) then yes, that's an issue indeed. We then have 3 solutions:
|
Adding @thib-martin to the discussion, might have an insight |
Access to vaults is based on the Authenticator object. Here you crearte a new One based on a user controled string which is not acceptable. |
That's what I figured - reverted the last 2 commits. |
|
||
// If we have a context email but no user, we try to find a user with that email in the workspace. | ||
if (!userId && context.email) { | ||
const matchingUser = await UserResource.fetchByEmail(context.email); |
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.
fair.
You likely want to dry it and use it in editUserMessage as well?
|
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 modulo the last comment 🙏
Done and merging |
Description
Risk
Not much
Deploy Plan