Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Account switching stops #9

Open
ittayd opened this issue Sep 20, 2023 · 23 comments
Open

Account switching stops #9

ittayd opened this issue Sep 20, 2023 · 23 comments

Comments

@ittayd
Copy link

ittayd commented Sep 20, 2023

After some time (a day or so) of running, the extension stops switching accounts. Not via rules nor manually.

I don't know how to analyze this. In the console I see this:
lockdown-run.js:17 Lockdown failed: TypeError: At intrinsics.Object.groupBy expected boolean not function
at isAllowedPropertyValue (lockdown-install.js:1:53384)
at isAllowedProperty (lockdown-install.js:1:53807)
at visitProperties (lockdown-install.js:1:55095)
at isAllowedPropertyValue (lockdown-install.js:1:53041)
at isAllowedProperty (lockdown-install.js:1:53807)
at visitProperties (lockdown-install.js:1:55095)
at lockdown-install.js:1:55523
at repairIntrinsics (lockdown-install.js:1:144597)
at lockdown-install.js:1:145462
at lockdown-run.js:4:3
(anonymous) @ lockdown-run.js:17
Show 1 more frame
Show less
lockdown-more.js:99 Protecting intrinsics failed: ReferenceError: harden is not defined
at lockdown-more.js:69:13
at Set.forEach ()
at protectIntrinsics (lockdown-more.js:44:22)
at lockdown-more.js:97:5
(anonymous) @ lockdown-more.js:99
Show 1 more frame
Show less
VM1245:11 Refused to get unsafe header "6"
t @ content.min.js:137
(anonymous) @ content.min.js:151
(anonymous) @ VM1245:11
l @ inpage.js:17
c @ inpage.js:17
(anonymous) @ inpage.js:17
(anonymous) @ inpage.js:17
85 @ inpage.js:17
i @ inpage.js:1
(anonymous) @ inpage.js:1
(anonymous) @ inpage.js:1
(anonymous) @ inpage.js:1
1.../../shared/modules/provider-injection @ inpage.js:1
i @ inpage.js:1
e @ inpage.js:1
(anonymous) @ inpage.js:1
(anonymous) @ contentscript.js:1
1.../../shared/constants/app @ contentscript.js:1
i @ contentscript.js:1
e @ contentscript.js:1
(anonymous) @ contentscript.js:1
Show 7 more frames
Show less
VM1245:11 Refused to get unsafe header "6"
t @ content.min.js:137
(anonymous) @ content.min.js:151
(anonymous) @ VM1245:11
l @ inpage.js:17
a.setDefaultLevel @ inpage.js:17
(anonymous) @ inpage.js:1
(anonymous) @ inpage.js:1
1.../../shared/modules/provider-injection @ inpage.js:1
i @ inpage.js:1
e @ inpage.js:1
(anonymous) @ inpage.js:1
(anonymous) @ contentscript.js:1
1.../../shared/constants/app @ contentscript.js:1
i @ contentscript.js:1
e @ contentscript.js:1
(anonymous) @ contentscript.js:1
Show 7 more frames
Show less
Refused to load the font '' because it violates the following Content Security Policy directive: "font-src github.githubassets.com".

Refused to load the font '' because it violates the following Content Security Policy directive: "font-src github.githubassets.com".

Refused to load the font '' because it violates the following Content Security Policy directive: "font-src github.githubassets.com".

Refused to load the font '' because it violates the following Content Security Policy directive: "font-src github.githubassets.com".

Refused to load the font '' because it violates the following Content Security Policy directive: "font-src github.githubassets.com".

Refused to load the font '' because it violates the following Content Security Policy directive: "font-src github.githubassets.com".

Refused to load the font '' because it violates the following Content Security Policy directive: "font-src github.githubassets.com".

Refused to load the font '' because it violates the following Content Security Policy directive: "font-src github.githubassets.com".

Refused to load the font '' because it violates the following Content Security Policy directive: "font-src github.githubassets.com".

@yuezk
Copy link
Owner

yuezk commented Sep 21, 2023

The error is from the lockdown-install.js, which belongs to the MetaMask extension. For your problem, I suggest you reinstall the extension or check the switching rules.

@ittaysw
Copy link

ittaysw commented Oct 5, 2023

I disabled the extension and the error persists. My rules are .* for ittayd and some other patterns (/abcd.*) for ittaysw. As you can see from this comment, account switcher is stuck on ittaysw even though the URL does not match the more specific patterns (and does match .* of course).

@ittaysw
Copy link

ittaysw commented Oct 5, 2023

I see tons of messages (several per second) like the below in the service worker console:
synced accounts (2) [{…}, {…}]0: {name: 'ittayd', cookies: Array(12), active: false, avatarUrl: 'https://avatars.githubusercontent.com/u/33328?s=100&v=4', expiresAt: Tue Oct 10 2023 10:12:52 GMT+0300 (Israel Daylight Time)}1: {name: 'ittaysw', cookies: Array(12), active: true, avatarUrl: 'https://avatars.githubusercontent.com/u/107039793?s=100&v=4', expiresAt: Tue Oct 10 2023 10:12:52 GMT+0300 (Israel Daylight Time)}length: 2[[Prototype]]: Array(0)
index.ts.346d2117.js:1 Current dynamic rules: (3) [{…}, {…}, {…}]0: {action: {…}, condition: {…}, id: 1, priority: 1}1: {action: {…}, condition: {…}, id: 2, priority: 1}2: {action: {…}, condition: {…}, id: 3, priority: 1}length: 3[[Prototype]]: Array(0)
index.ts.346d2117.js:1 dotcom_user cookie removed
index.ts.346d2117.js:1 New dotcom_user cookie ittaysw

image
(note: not working whether the pattern is .* or /.*)

@ittaysw
Copy link

ittaysw commented Oct 5, 2023

Turned on error collection and saw this: Uncaught (in promise) Error: Extension context invalidated.
assets/browser-polyfill.7e0c1479.js:1 (anonymous function)

@ittayd
Copy link
Author

ittayd commented Oct 7, 2023

I logged out of all accounts, cleaned all github cookies, removed all rules. Then i logged in again (through the extension) and created the rules. I've done this before and after a while the extension stops working. But this time I also looked at the console and see onBeforeRequest: found an auto switch rule for url https://github.com/ Object, which I didn't see when the extension stopped working. Seems like it goes into some infinite loop without finding a matching rule.

@ittayd
Copy link
Author

ittayd commented Oct 9, 2023

This just happens again, now there's no infinite loop in the service worker, instead, I see that ittayd is selected even though the URL matches one of the other patterns. Could it be the account attribute that appears in the conditions in console?

@ittayd
Copy link
Author

ittayd commented Oct 9, 2023

Note that even though 'ittayd' is selected, when I load the repository I get a "Confirm your account recovery settings" window and after I confirm there are errors

@ittayd
Copy link
Author

ittayd commented Oct 9, 2023

Deleting cookies and reloading the page doesn't help

@ittayd
Copy link
Author

ittayd commented Oct 9, 2023

I removed the .* rule and can't manually switch to ittaysw at the home page or otherwise.

@yuezk
Copy link
Owner

yuezk commented Oct 10, 2023

@ittayd, Can you provide the accounts you want to switch? So that I can give help on the auto-switching rules.

@ittayd
Copy link
Author

ittayd commented Oct 11, 2023

ittaysw and ittayd (those you can see in the thread)

@yuezk
Copy link
Owner

yuezk commented Oct 11, 2023

I disabled the extension and the error persists. My rules are .* for ittayd and some other patterns (/abcd.*) for ittaysw. As you can see from this comment, account switcher is stuck on ittaysw even though the URL does not match the more specific patterns (and does match .* of course).

I'm afraid the rule .* is too general. You need more specific rules to let the auto-switching work. It's better to ensure that there are no intersections among the rules.

@ittayd
Copy link
Author

ittayd commented Oct 11, 2023

But if I don't have this rule then the profile will never auto switch to ittayd. After it switches to ittaysw, I'll need to manually switch to ittayd.
Why is it hard to go over the rules one by one and switch on the first match?

@yuezk
Copy link
Owner

yuezk commented Oct 12, 2023

Why is it hard to go over the rules one by one and switch on the first match?

It might be because the priority property is the same for all the rules.

Back to your problem, if you have two accounts, you could define two rules for auto-switching. You can define one regexp for one account. And define a regexp, which is the opposite of the previous one. Then auto-switching rules could work. If you can describe all the conditions, I could try to give the regexp.

@ittaysw
Copy link

ittaysw commented Oct 16, 2023

So allow me to set the priority of rules, or, set the priority by their visual order in the plugin's dialoge.

I'll try the opposite regex thing

@ittaysw
Copy link

ittaysw commented Oct 16, 2023

I now see the error Rule with id 1 specifies an incorrect value for the "regexFilter" key.. When I test the regex in the console it works. Here it is ^((?!(/.*starkware.*|/.*starknet.*)).)*

@yuezk
Copy link
Owner

yuezk commented Oct 16, 2023

@ittaysw
Copy link

ittaysw commented Oct 17, 2023

I think there's a bug in the code somewhere that makes the extension to stop selecting the right rule.
I also think it should iterate on rules according to their order in the UX and take the last match. That way people can put a general account rule first and then narrow. Alternatively, there should be an option to set a default account if no rule matches.

@ittaysw
Copy link

ittaysw commented Oct 17, 2023

Note that after the bug happens I can't switch manually (the door icon in the extension) or exit an account (the x button)

@ittaysw
Copy link

ittaysw commented Oct 17, 2023

When I right click the extension and choose "inspect pop-up" and go to the Application tab, the session and local and shared storage seem to be empty

@ittaysw
Copy link

ittaysw commented Oct 17, 2023

Even if I remove the 'ittaysw' profile from the extension, it loggs me as ittaysw. I delete all github cookies and load the homepage and it logs me as ittaysw (i disable it, remove all cookies and load the homepage and am not logged in)

@ittaysw
Copy link

ittaysw commented Oct 17, 2023

And now I see the profile is back in the extension...

@ittayd
Copy link
Author

ittayd commented Oct 17, 2023

I managed to remove the profiles from the extensions. In github try to login, get an error page. Disabled the extension, try to login, works fine.

The extension probably has a bug where it keeps a mangled login in storage somewhere, which it tries to apply, but fails.

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

No branches or pull requests

3 participants