-
Notifications
You must be signed in to change notification settings - Fork 206
feat: add Google Antigravity support #992
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,12 +19,8 @@ const ABSOLUTE_PATH_RE = /^[a-z]:|^\//i | |||||||||||||||||
| const FILE_LINE_COL_RE = /^(.*?)(:[:\d]*)$/ | ||||||||||||||||||
| const NUXT_WELCOME_RE = /<NuxtWelcome\s*\/>/ | ||||||||||||||||||
|
|
||||||||||||||||||
| export function setupGeneralRPC({ | ||||||||||||||||||
| nuxt, | ||||||||||||||||||
| options, | ||||||||||||||||||
| refresh, | ||||||||||||||||||
| openInEditorHooks, | ||||||||||||||||||
| }: NuxtDevtoolsServerContext) { | ||||||||||||||||||
| export function setupGeneralRPC(ctx: NuxtDevtoolsServerContext) { | ||||||||||||||||||
| const { nuxt, options, refresh, openInEditorHooks } = ctx | ||||||||||||||||||
| const components: Component[] = [] | ||||||||||||||||||
| const imports: Import[] = [] | ||||||||||||||||||
| const importPresets: Import[] = [] | ||||||||||||||||||
|
|
@@ -223,6 +219,10 @@ export function setupGeneralRPC({ | |||||||||||||||||
| let editor = getOptions()?.behavior.openInEditor ?? undefined | ||||||||||||||||||
| if (editor === 'auto') | ||||||||||||||||||
| editor = undefined | ||||||||||||||||||
| if (editor === 'antigravity') { | ||||||||||||||||||
| ctx.rpc.broadcast.openUrl(`https://antigravity.google/open?file=${path}${suffix}`) | ||||||||||||||||||
| return true | ||||||||||||||||||
| } | ||||||||||||||||||
|
Comment on lines
+222
to
+225
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. File path is not URL-encoded — paths with spaces or special characters will generate broken URLs.
🐛 Proposed fix- ctx.rpc.broadcast.openUrl(`https://antigravity.google/open?file=${path}${suffix}`)
+ ctx.rpc.broadcast.openUrl(`https://antigravity.google/open?file=${encodeURIComponent(path + suffix)}`)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
| await import('launch-editor').then(r => (r.default || r)(path + suffix, editor)) | ||||||||||||||||||
| return true | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
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.
openUrlbroadcasts to all clients with no URL validation — arbitrary-URL injection risk.openUrlis now a general-purpose client RPC callable by any server-side code holdingctx.rpc. A malicious or compromised Nuxt module can callctx.rpc.broadcast.openUrl('https://attacker.example/phish'), causing every connected DevTools client to open the attacker URL silently in a new tab. There is no restriction at the client handler toantigravity.googleor even to thehttps:scheme (ajavascript:URL, while blocked by most browsers inwindow.open, is a valid string today).At minimum, validate the protocol before calling
window.open:🛡️ Proposed fix
async openUrl(url: string) { - window.open(url, '_blank') + if (!url.startsWith('https://')) + return + window.open(url, '_blank', 'noopener,noreferrer') },📝 Committable suggestion
🤖 Prompt for AI Agents