-
Notifications
You must be signed in to change notification settings - Fork 534
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
Update SDK Connections model to consume context and filter by readAccess #2074
Conversation
…ated with a project the user doesn't have access to.
…s associated with a project the user doesn't have access to." This reverts commit d4eccba.
…ated with a project the user doesn't have access to.
{proj.name} | ||
</span> | ||
); | ||
<td className="d-flex align-items-center"> |
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.
Updated this to utilize the ProjectBadges
component to increase continuity.
@@ -1489,14 +1490,17 @@ export async function postApiKeyReveal( | |||
} | |||
|
|||
export async function getWebhooks(req: AuthRequest, res: Response) { | |||
const { org } = getContextFromReq(req); | |||
const context = getContextFromReq(req); | |||
const webhooks = await WebhookModel.find({ |
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've created a follow up ticket to refactor the Webhook model so we're not exporting the model.
Your preview environment pr-2074-bttf has been deployed. Preview environment endpoints are available at: |
connection: SDKConnectionInterface, | ||
useCloudProxy: boolean = false | ||
) { | ||
if (!connectionSupportsProxyUpdate(connection, useCloudProxy)) return; | ||
|
||
const job = agenda.create(PROXY_UPDATE_JOB_NAME, { | ||
context, |
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.
Do we want to add the context to the message body? I know we avoided this for other jobs we've refactored by passing in the org ID instead, and letting the job create its own context. Just wanted to make sure.
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.
The more I think about this, the less it seems like a good idea. It seems like our context object shouldn't be persisted anywhere nor leave the scope of our express webserver. It can contain sensitive information (users' emails), or be potentially huge (e.g. the upcoming data models collection from Jeremy's PR).
Putting the context inside of a message body sent to distributed services makes our context object more sensitive to changes i.e. we have to be more careful with what we put in there. Right now, I think we just want it to be a toolbox for all things needed within the lifetime of a request within our express server without worrying about concerns like size or security. Our previous approach with embedding the only org ID seems more robust with this in mind.
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.
That's a great call. I've updated this job so it no longer takes in the context object, and instead just takes in the orgId, and builds a FULL_ACCESS_CONTEXT
object on the fly.
…gId, and building the context object on the fly, rather than passing in the context object.
…ess (#2074) * Updates SDK Connections model to consume context and add no access filtering
Features and Changes
This PR updates the
SDKConnectionModel
to ensure we're filtering SDK connections based on the user'sreadAccess
level.SDK Connections have taken on a few different forms over the years - they've been legacy SDK endpoints, and now, SDK Connections. Given that, when testing, we need to look at both the newer
SDK Connections
as well as the legacy SDK endpoints, and also SDK WebhooksTesting