Skip to content
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

Pass groupids to core #6628

Merged
merged 11 commits into from
Aug 2, 2024
Merged

Pass groupids to core #6628

merged 11 commits into from
Aug 2, 2024

Conversation

flvndvd
Copy link
Contributor

@flvndvd flvndvd commented Aug 1, 2024

Description

This PR passes the group ids to core when creating a run, so we can validate permission when querying a data source.

Risk

Deploy Plan

@flvndvd flvndvd marked this pull request as ready for review August 1, 2024 16:23
@flvndvd flvndvd self-assigned this Aug 1, 2024
secrets,
});
const runRes = await coreAPI.createRunStream(
auth.getNonNullableWorkspace(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we already have owner from above ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah good catch. Let me fix.

secrets,
});
const dustRun = await coreAPI.createRun(
auth.getNonNullableWorkspace(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, we already have owner ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW here at the top we shouldn't use getNonNullableWorkspace because it throws while we want to 404 if we don't have a ws

Copy link
Contributor

@tdraier tdraier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

): Promise<{ auth: Authenticator; keyWorkspaceId: string }> {
): Promise<{
auth: Authenticator;
keyWorkspaceId: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need keyWorkspaceId? Can't it be inferred from keyWorkspace

Comment on lines +179 to +180
// Confusingly, the auth workspace here is the the one from the URL, not the one from the key.
// Where as auth.groups are the groups associated with the the key.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 to change the behaviour and keep in auth the workspace of the user key - keeping a different workspace here is very confusing. The workspace from the url is only there to know in which workspace is the app , but it has nothing to with authentication.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will always have two workspaces here as we can run an app from workspace A with a key from workspace B. This is tricky indeed and need thorough consideration in the context of groups 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do need an auth on the app workspace as this is the one we use to retrieve the app. Let's call this the appAuth.

That being said it would be nice to have an auth on the key independent of the app workspace. This one could be called keyAuth.

That way we would not need to fetch the groups and could pass the keyAuth directly to create run?

@flvndvd flvndvd merged commit abec61a into main Aug 2, 2024
3 checks passed
@flvndvd flvndvd deleted the flav/pass-groupids-to-core branch August 2, 2024 08:08
@@ -285,9 +290,12 @@ async function handler(
"App run creation"
);

const runRes = await coreAPI.createRunStream({
const groups = await GroupResource.listWorkspaceGroupsFromKey(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed on slack this should be the keyAuth groups which, once we implement X-Dust-User-Id, will correctly represent the calling user's groups

albandum pushed a commit that referenced this pull request Aug 28, 2024
* Pass group ids to core when creating runs

* Add BaseAuthenticator type

* 🙈

* ✂️

* ✨

* Address comments from review

* Use key workspace and groups

* 👕

* Address comments from review

* ✨

* 📖
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants