Skip to content

Commit a148e1a

Browse files
committed
Fix unnecessary global prototype pollution
The pollution of Object.prototype.toBuffer breaks other vscode extensions
1 parent 555970d commit a148e1a

5 files changed

Lines changed: 21 additions & 20 deletions

File tree

idacode/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,8 @@
3636
### 0.3.0
3737

3838
- Fixed Python 2 support (PR #17)
39-
- Fixed issue where debugpy would attempt to spawn the current process (Issue #23)
39+
- Fixed issue where debugpy would attempt to spawn the current process (Issue #23)
40+
41+
### 0.3.1
42+
43+
- Fixed unnecessary global prototype pollution that broke other extensions (eg GitHub Copilot)

idacode/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,8 @@ IDACode doesn't support host to VM communication unless the VM uses a shared vol
7373
### 0.3.0
7474

7575
- Fixed Python 2 support (PR #17)
76-
- Fixed issue where debugpy would attempt to spawn the current process (Issue #23)
76+
- Fixed issue where debugpy would attempt to spawn the current process (Issue #23)
77+
78+
### 0.3.1
79+
80+
- Fixed unnecessary global prototype pollution that broke other extensions (eg GitHub Copilot)

idacode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "IDACode",
44
"description": "Run and debug your IDA scripts from VS Code",
55
"icon": "images/icon.png",
6-
"version": "0.3.0",
6+
"version": "0.3.1",
77
"publisher": "Layle",
88
"license": "SEE LICENSE IN LICENSE.md",
99
"preview": true,

idacode/src/extension.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@ function getCurrentDocument(): string {
1515
return vscode.window.activeTextEditor?.document.uri.fsPath as string;
1616
}
1717

18+
function toBuffer(obj: Object): Buffer {
19+
return Buffer.from(JSON.stringify(obj));
20+
}
21+
1822
function executeScriptInIDA() {
1923
const currentDocument = getCurrentDocument();
2024
const name = path.parse(currentDocument).base;
21-
socket.send({
25+
socket.send(toBuffer({
2226
event: Event.ExecuteScript,
2327
path: currentDocument
24-
}.toBuffer());
28+
}));
2529
vscode.window.showInformationMessage(`Sent ${name} to IDA`);
2630
}
2731

@@ -47,10 +51,10 @@ function connectToIDA() {
4751
prompt: 'Enter the path to the folder containing the script',
4852
value: currentFolder
4953
});
50-
socket.send({
54+
socket.send(toBuffer({
5155
event: Event.SetWorkspace,
5256
path: workspaceFolder
53-
}.toBuffer());
57+
}));
5458
vscode.window.showInformationMessage(`Set workspace folder to ${workspaceFolder}`);
5559
resolve();
5660
});
@@ -81,9 +85,9 @@ function connectToIDA() {
8185
}
8286

8387
function attachToIDA() {
84-
socket.send({
88+
socket.send(toBuffer({
8589
event: Event.AttachDebugger
86-
}.toBuffer());
90+
}));
8791
}
8892

8993
function connectAndAttachToIDA() {

idacode/src/utils/extensions.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)