Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

cody: add callback route and URI handler for vscode-insider#53313

Merged
abeatrix merged 9 commits into
mainfrom
bee/cody-redirect
Jun 13, 2023
Merged

cody: add callback route and URI handler for vscode-insider#53313
abeatrix merged 9 commits into
mainfrom
bee/cody-redirect

Conversation

@abeatrix

@abeatrix abeatrix commented Jun 12, 2023

Copy link
Copy Markdown
Contributor

@cla-bot cla-bot Bot added the cla-signed label Jun 12, 2023
@sourcegraph-bot

sourcegraph-bot commented Jun 12, 2023

Copy link
Copy Markdown
Contributor

📖 Storybook live preview

@abeatrix abeatrix requested review from a team and toolmantim June 12, 2023 16:04
// Example: 'vscode-insider://' for VS Code Insider
if (clientURLScheme && nextRequester.customURLScheme === 'vscode') {
const redirectURL = new URL(nextRequester.redirectURL)
redirectURL.protocol = clientURLScheme

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This might be a security vulnerability vector, being a query param vs being hardcoded into the application. I'm just not sure if there's malicious URL schemes out there in the OS that people could take advantage of, but wouldn't be surprised.

We probably want to use specific hardcoded URL, like redirectURL, but for insiders. We could add a new CODY_INSIDERS entry, or condition it on the client param you added?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@vdavid is looking into Jetbrains URL schemes now… there's 15 or so of them, and might need some conditional logic too. Perhaps there'll be some conditional logic there too, instead of a straight lookup table?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This could be an issue because every time we add a new entry to the whitelist, the new entry will not work until the next release.
I guess my question for now is, do we only want to support vscode and vscode-insider only? (and ignore codespaces and remote hosts)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just added a new entry for vscode-insider.
If we want to support other clients we will need to open another PR for those

@abeatrix abeatrix changed the title cody: update callbacks and URI handlers cody: add callback route and URI handler for vscode-insider Jun 13, 2023
@abeatrix abeatrix requested review from a team and toolmantim June 13, 2023 06:43

@dominiccooney dominiccooney left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code looks good.

Let's write out the test plan in text and not rely on following a Loom alone. At the very least you want to see this working in vscode and vscode insiders.

Would be great to add an automated test so we can detect regressions automatically.

Feedback inline about naming.

Comment thread client/cody/src/chat/protocol.ts Outdated
@abeatrix abeatrix enabled auto-merge (squash) June 13, 2023 13:59
@abeatrix abeatrix merged commit 3b3fe00 into main Jun 13, 2023
@abeatrix abeatrix deleted the bee/cody-redirect branch June 13, 2023 14:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cody: token redirection does not work for vscode insider

4 participants