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

Error running through SSH #51

Open
lolo169 opened this issue Mar 24, 2023 · 6 comments
Open

Error running through SSH #51

lolo169 opened this issue Mar 24, 2023 · 6 comments

Comments

@lolo169
Copy link

lolo169 commented Mar 24, 2023

chrome-cookies-secure is very helpful ;-) thanks for that

The following code works just fine on MacOS:

const chrome = require('chrome-cookies-secure');
chrome.getCookies('https://www.google.com/', function(err, cookies) {
        console.log(cookies);
});

but running it through SSH I get the following error:

node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Error: User interaction is not allowed.]

Node.js v19.2.0

Keychain access to "Chrome Safe Storage" is set to "Allow all applications to access this item"

Any idea?

@rubengmurray
Copy link
Collaborator

Are you SSH'ing to another macOS server? What command are you using to trigger the script? I've not run it like this before.

@lolo169
Copy link
Author

lolo169 commented Sep 4, 2023

I solved the problem hardcoding chromePassword call:
crypto.pbkdf2(chromePassword, SALT, ITERATIONS, KEYLENGTH, 'sha1', callback);
in '/Users/team/node_modules/chrome-cookies-secure/index.js'

@rubengmurray
Copy link
Collaborator

You mean in the getDerivedKey function there's a case that wasn't handled by the if / else blocks?

It already runs pbkdf2 as you describe it in the darwin & linux cases:

https://github.com/bertrandom/chrome-cookies-secure/blob/master/index.js#L52

So are you saying there's platform value that isn't getting picked up?

Or are you hard-coding the chromePassword value itself in one of the if blocks?

@lolo169
Copy link
Author

lolo169 commented Sep 7, 2023

Hi Ruben,

Yes, I hardcode the chromePassword.

if (process.platform === 'darwin') {
keytar = require('keytar');
keytar.getPassword('Chrome Safe Storage', 'Chrome').then(function(chromePassword) {
//crypto.pbkdf2(chromePassword, SALT, ITERATIONS, KEYLENGTH, 'sha1', callback);
crypto.pbkdf2('hxC47gOiK9i2f+Olwdaonw==', SALT, ITERATIONS, KEYLENGTH, 'sha1', callback);
});
}

@rubengmurray
Copy link
Collaborator

Where did you get the password from? Is this from your keychain?

@lolo169
Copy link
Author

lolo169 commented Sep 30, 2023 via email

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

No branches or pull requests

2 participants