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

DeprecationWarning: Buffer() is deprecated due to security and usability issues #3331

Closed
alexdima opened this issue Mar 29, 2020 · 16 comments
Closed
Assignees

Comments

@alexdima
Copy link
Member

Moved from microsoft/vscode#93177


From @AdamFeher2400

I found the following error on console of Developer Tools in Visual Studio Code.
(node:1412) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.


From @zix66

Hi there!I did a little investigation : disabling & re-enabling each one from my extensions.So problem (funny!) with Microsoft Live Share. With best wishes, Igor Umansky

@fubaduba
Copy link
Contributor

Thanks for reporting this issue. We'll dig in to see what we find.

@fubaduba
Copy link
Contributor

@IlyaBiryukov who would be the best person for this?

@IlyaBiryukov
Copy link
Collaborator

@dlebu

@aexvir
Copy link

aexvir commented Nov 19, 2020

Any update on this? It would at least be nice to not have the terminal popping up every time because of this error 😕️

@jasonwilliams
Copy link

jasonwilliams commented Nov 29, 2020

I'm also getting this, its been happening for a long time now.
Here's a stack trace:

(node:15448) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
	at showFlaggedDeprecation (buffer.js:192:11)
	at new Buffer (buffer.js:279:3)
	at alloc (c:\Users\[User]\.vscode-insiders\extensions\ms-vsliveshare.vsliveshare-1.0.3206\out\prod\extension-prod.js:96294:10)
	at Object.../node_modules/msgpack-lite/lib/bufferish-buffer.js (c:\Users\[User]\.vscode-insiders\extensions\ms-vsliveshare.vsliveshare-1.0.3206\out\prod\extension-prod.js:96282:54)
	at __webpack_require__ (c:\Users\[User]\.vscode-insiders\extensions\ms-vsliveshare.vsliveshare-1.0.3206\out\prod\extension-prod.js:21:30)
	at Object.../node_modules/msgpack-lite/lib/bufferish.js (c:\Users\[User]\.vscode-insiders\extensions\ms-vsliveshare.vsliveshare-1.0.3206\out\prod\extension-prod.js:96509:37)
	at __webpack_require__ (c:\Users\[User]\.vscode-insiders\extensions\ms-vsliveshare.vsliveshare-1.0.3206\out\prod\extension-prod.js:21:30)
	at Object.../node_modules/msgpack-lite/lib/ext-buffer.js (c:\Users\[User]\.vscode-insiders\extensions\ms-vsliveshare.vsliveshare-1.0.3206\out\prod\extension-prod.js:97003:17)
	at __webpack_require__ (c:\Users\[User]\.vscode-insiders\extensions\ms-vsliveshare.vsliveshare-1.0.3206\out\prod\extension-prod.js:21:30)
	at Object.../node_modules/msgpack-lite/lib/write-core.js (c:\Users\[User]\.vscode-insiders\extensions\ms-vsliveshare.vsliveshare-1.0.3206\out\prod\extension-prod.js:97853:17)
	at __webpack_require__ (c:\Users\[User]\.vscode-insiders\extensions\ms-vsliveshare.vsliveshare-1.0.3206\out\prod\extension-prod.js:21:30)

Looks its liveshare using msgpack-lite, and so its potentially coming from kawanet/msgpack-lite#98

@Ichurep
Copy link

Ichurep commented Jan 28, 2021

I get the same problem when running with a Microsoft agent in Azure DevOps.

Error Message:
(node:7200) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead

@andrewpolemeni
Copy link

I'm also getting the same issue when compiling a VSCode extension.

Installing extensions...
(node:2944) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

@Bond-Anna
Copy link

I'm also looking for the solution

vscode-htmlhing LS: we have a connection
(node:41331) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

@michaelhidalgo
Copy link

michaelhidalgo commented Aug 10, 2021

Hi guys, any update about this? I have Node v14.17.3 (macOS Big Sur) and I'm trying to follow this guide https://code.visualstudio.com/api/get-started/your-first-extension but I get this error:

(node:4579) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues.

Screen Shot 2021-08-09 at 19 06 24

@ArturoDent
Copy link

For more guidance on trying to figure out why you are getting that Buffer deprecation warning, see https://stackoverflow.com/questions/63673860/vscode-extension-deprecation-warning-buffer-how-to-diagnose/68413237?r=SearchResults&s=1|86.3623#68413237

@lsby
Copy link

lsby commented Sep 3, 2021

I researched this problem and found that this error comes from

C:\Users\<user name>\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\ftp\lib\connection.js

This assr file seems to be the 'node_modules' used by vscode.

I unzipped this asar file and found this dependency:

Vscode-proxy-agent (0.11.0) depends get-uri (^3.0.2), and get-uri (3.0.2) depends ftp (^0.3.10).

The problem is with ftp (0.3.10).

The error comes from here

And there was another pull request to solve the problem, but it was not merged.

I tried to use asar to unpack, fix it, and then repack, but it failed.

Any suggestions?

@jasonwilliams
Copy link

jasonwilliams commented Sep 3, 2021

@alyssajotice @fubaduba can you update us on this issue? it should be just a case of Live Share upgrading the dependencies it uses, any reason why its still not being looked at? I would imagine the cost to fixing this is quite low

@lsby thats interesting last time i looked it was coming from here, see above. Either way, it looks like live share is using a lot of outdated dependencies which could pose a security risk

@fubaduba
Copy link
Contributor

We have this scheduled for work now and will be updating our dependencies in the new few weeks. Thanks you for your patience.

@alyssajotice alyssajotice self-assigned this Nov 2, 2021
@alyssajotice
Copy link
Contributor

Hi everyone, I've been looking into this issue. Live Share did have some instances where it used the incorrect buffer initialization. To confirm that I fixed the problem, I am checking to see if the warning message stopped appearing.

Unfortunately, when I run VS Code with the flag --disable-extensions, I still get the Buffer deprecation error, so I can't confirm that it is fixed on Live Share's end. I filed this issue here and will wait to hear back: microsoft/vscode#136874

@alyssajotice
Copy link
Contributor

I just tested out the new marketplace version 1.0.5090. To test out where the deprecation warnings are coming from, you can add the line process.traceDeprecation = true; to the top of extensionHostProcess.js. On windows, this file is at C:\<USER>\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js. This allows you to see where deprecation warnings are coming from. When I share a Live Share session, I see the following printed in my developer tools console.

Console:
ERR [Extension Host] (node:10740) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
    at showFlaggedDeprecation (buffer.js:194:11)
    at new Buffer (buffer.js:281:3)
    at Object.<anonymous> (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\ftp\lib\connection.js:52:17)
    at Module.u._compile (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:1316)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1155:10)
    at Module.load (internal/modules/cjs/loader.js:982:32)
    at Module._load (internal/modules/cjs/loader.js:823:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
    at Module.require (internal/modules/cjs/loader.js:1006:19)
    at h (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:699)
    at Object.<anonymous> (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\get-uri\dist\ftp.js:16:31)
    at Module.u._compile (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:1316)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1155:10)
    at Module.load (internal/modules/cjs/loader.js:982:32)
    at Module._load (internal/modules/cjs/loader.js:823:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
    at Module.require (internal/modules/cjs/loader.js:1006:19)
    at h (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:699)
    at Object.<anonymous> (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\get-uri\dist\index.js:10:31)
    at Module.u._compile (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:1316)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1155:10)
    at Module.load (internal/modules/cjs/loader.js:982:32)
    at Module._load (internal/modules/cjs/loader.js:823:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
    at Module.require (internal/modules/cjs/loader.js:1006:19)
    at h (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:699)
    at Object.<anonymous> (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-proxy-agent\out\agent.js:17:35)
    at Module.u._compile (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:1316)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1155:10)
    at Module.load (internal/modules/cjs/loader.js:982:32)
    at Module._load (internal/modules/cjs/loader.js:823:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
    at Module.require (internal/modules/cjs/loader.js:1006:19)
    at h (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:699)
    at Object.<anonymous> (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-proxy-agent\out\index.js:40:30)
    at Module.u._compile (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:1316)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1155:10)
    at Module.load (internal/modules/cjs/loader.js:982:32)
    at Module._load (internal/modules/cjs/loader.js:823:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
    at Module.require (internal/modules/cjs/loader.js:1006:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at r (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:5:101)
    at e.load (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:1723)
    at e.load (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:3:10695)
    at d (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:5:10300)
    at i._loadModule (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:5:10430)
    at i._resolve (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:6:452)
    at i.defineModule (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:5:6142)
    at v (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:6:1702)
    at g (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:2557)
    at Object.<anonymous> (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:105:58118)
    at Object.<anonymous> (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:115:32896)
    at e._createAndEvalScript (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:2601)
    at c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:2240
    at h (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:4192)
    at c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:4386
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)

(node:10740) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.    
at showFlaggedDeprecation (buffer.js:194:11)    
at new Buffer (buffer.js:281:3)    
at Object.<anonymous> (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\ftp\lib\connection.js:52:17)    
at Module.u._compile (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:1316)    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1155:10)    
at Module.load (internal/modules/cjs/loader.js:982:32)    
at Module._load (internal/modules/cjs/loader.js:823:14)    
at Function.f._load (electron/js2c/asar_bundle.js:5:12913)   
 at Module.require (internal/modules/cjs/loader.js:1006:19)    
at h (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:699)    
at Object.<anonymous> (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\get-uri\dist\ftp.js:16:31)    
at Module.u._compile (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:1316)    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1155:10)    
at Module.load (internal/modules/cjs/loader.js:982:32)    
at Module._load (internal/modules/cjs/loader.js:823:14)   
 at Function.f._load (electron/js2c/asar_bundle.js:5:12913)   
 at Module.require (internal/modules/cjs/loader.js:1006:19)    
at h (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:699)    
at Object.<anonymous> (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\get-uri\dist\index.js:10:31)    
at Module.u._compile (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:1316)    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1155:10)    
at Module.load (internal/modules/cjs/loader.js:982:32)    
at Module._load (internal/modules/cjs/loader.js:823:14)    
at Function.f._load (electron/js2c/asar_bundle.js:5:12913)    
at Module.require (internal/modules/cjs/loader.js:1006:19)    
at h (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:699)    
at Object.<anonymous> (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-proxy-agent\out\agent.js:17:35)   
at Module.u._compile (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:1316)    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1155:10)    
at Module.load (internal/modules/cjs/loader.js:982:32)    
at Module._load (internal/modules/cjs/loader.js:823:14)    
at Function.f._load (electron/js2c/asar_bundle.js:5:12913)    
at Module.require (internal/modules/cjs/loader.js:1006:19)    
at h (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:699)    
at Object.<anonymous> (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-proxy-agent\out\index.js:40:30)    
at Module.u._compile (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:1316)    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1155:10)    
at Module.load (internal/modules/cjs/loader.js:982:32)    
at Module._load (internal/modules/cjs/loader.js:823:14)    
at Function.f._load (electron/js2c/asar_bundle.js:5:12913)    
at Module.require (internal/modules/cjs/loader.js:1006:19)    
at require (internal/modules/cjs/helpers.js:88:18)    
at r (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:5:101)    
at e.load (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:1723)    
at e.load (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:3:10695)    
at d (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:5:10300)    
at i._loadModule (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:5:10430)    
at i._resolve (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:6:452)    
at i.defineModule (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:5:6142)    
at v (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:6:1702)    
at g (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:2557)    
at Object.<anonymous> (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:105:58118)    
at Object.<anonymous> (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:115:32896)    
at e._createAndEvalScript (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:2601)    at c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:2240    
at h (c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:4192)    
at c:\Users\allytice\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:4386   
at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)

As you can see, none of these mention Live Share and all are coming from the vscode-proxy-agent. Therefore, I think the issue is fixed. Please reopen and send a trace if you confirm that on Live Share version 1.0.5090 and VS Code version 1.62.2 the deprecation warning is coming from Live Share.

@manishkumar-ce
Copy link

Is this one still with latest VS code extensions ?

2023-02-08 09:35:38.099 [error] [Extension Host] (node:4640) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use Code --trace-deprecation ... to show where the warning was created)

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

No branches or pull requests