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

Chrome/Edge does not restore tabs if ran out of Sandbox before #558

Open
ghost opened this issue Feb 13, 2021 · 22 comments
Open

Chrome/Edge does not restore tabs if ran out of Sandbox before #558

ghost opened this issue Feb 13, 2021 · 22 comments
Labels
Chromium Collection of Chromium issues Known issue Old known Sandboxie issues Workaround Temporary or alternative solution

Comments

@ghost
Copy link

ghost commented Feb 13, 2021

Hi,

Since Chrome introduced changes in user profiles, Sandboxed Chrome has issues with restoring tabs from previous session.

How to reproduce:

  1. Create new Sandbox, run Chrome in it, set up to 'continue where you left off' on startup , open any webpage and quit Chrome
  2. Run Chrome outside of Sandboxie and close it
  3. Open Chrome sandbox in the same sandbox like in point 1. Chrome will not restore the session correctly.

Chrome used to store user profile in C:\Users<username>\AppData\Local\Google\Chrome\User Data\Default
For over 6 months it stores it in C:\Users<username>\AppData\Local\Google\Chrome\User Data\Profile 1

@ghost ghost changed the title Chrome does not restore tabs if run out if Sandbox before Chrome does not restore tabs if ran out if Sandbox before Feb 13, 2021
@isaak654
Copy link
Collaborator

isaak654 commented Feb 13, 2021

Chrome used to store user profile in C:\Users\AppData\Local\Google\Chrome\User Data\Default
For over 6 months it stores it in C:\Users\AppData\Local\Google\Chrome\User Data\Profile 1

I installed Chrome a month ago (using the official online installer, in a clean Windows 10 install) and my user profile was located in the default folder.

@ghost
Copy link
Author

ghost commented Mar 4, 2021

I have crean Chrome profile outside of Sandboxie. Then I have multiple sandboxes to run the chrome. Every time I start Chrome outside of sandbox, I have issues with lost session in sandboxed chrome.

How should I fix it?

@isaak654
Copy link
Collaborator

isaak654 commented Mar 5, 2021

I have crean Chrome profile outside of Sandboxie. Then I have multiple sandboxes to run the chrome. Every time I start Chrome outside of sandbox, I have issues with lost session in sandboxed chrome.

How should I fix it?

I've already reported something similar in issue #370... no fix at the moment.

@DavidXanatos
Copy link
Member

I think the proper solution to this behavior is to set the chrome profile folder as a WriteFilePath (https://sandboxie-plus.com/sandboxie/writefilepath/)
in the plus UI its called hidden.
This way sandboxes chrome will have an entirely own copy of the profile

@isaak654
Copy link
Collaborator

isaak654 commented Mar 5, 2021

I think the proper solution to this behavior is to set the chrome profile folder as a WriteFilePath (https://sandboxie-plus.com/sandboxie/writefilepath/)
in the plus UI its called hidden.
This way sandboxes chrome will have an entirely own copy of the profile

It makes sense, but are you sure there isn't another way? If it becomes the new default approach, it would require many changes in the browser part of templates.ini.

@ghost
Copy link
Author

ghost commented Mar 6, 2021

Sorry but this idea is not even close. I want to have clean Chrome profile as default, then configure each Sandboxed Chrome instance completely differently.

@isaak654 isaak654 changed the title Chrome does not restore tabs if ran out if Sandbox before Chrome does not restore tabs if ran out of Sandbox before Sep 25, 2021
@koliu
Copy link

koliu commented Sep 29, 2021

I ran into the same problem.
Brave has the same problem, but Firefox does not.
Therefore, this problem may lie in Chromium-based browsers.

@NewKidOnTheBlock
Copy link
Contributor

NewKidOnTheBlock commented Sep 29, 2021

Huh? Sandboxie behaved exactly like expected.
You ran Google Browser in sandbox. The session gets saved in the sandbox.
The next time you run Google Browser in sandbox, it continues exactly where you left.

Of course it doesn't take into account any changes you did to your session outside the sandbox.

@koliu
Copy link

koliu commented Sep 29, 2021

Huh? Sandboxie behaved exactly like expected. You ran Google Browser in sandbox. The session gets saved in the sandbox. The next time you run Google Browser in sandbox, it continues exactly where you left.

Of course it doesn't take into account any changes you did to your session outside the sandbox.

Thank you for pointing out what should be done correctly.
However, I think maybe try to reproduce this situation first to get us in sync.

  1. Install Chrome in the OS.
  2. Run Chrome in a sandbox.
  3. Set the Chrome settings to "continue where you left off'" at startup.
  4. Open any web page and keep these tabs open.
  5. 'Exit' Chrome directly.
  6. Run Chrome directly on the operating system (not in the sandbox) and exit...
  7. Run Chrome in the sandbox again. Then, we will encounter the problem that all tabs (session) are cleared.

Note: Chrome can be replaced by Brave.

It works fine when running Chrome in the sandbox, if we don’t perform step 6 above, the session will be saved correctly in the sandbox.
But after performing this step, the next time we start it in the sandbox, all tabs (session) will be cleared.

@Zo-Bro-23
Copy link

I'm experiencing the exact same problem as described by @koliu. Do any of you have any suggestions? I'm new to Sandboxie, so I don't really understand what's going on. I thought it might help if I go to Sandbox Settings >> Resource Access >> File Access and block access to the Chrome folder, but that just made things worse. Write-Only Access seems to work, but extensions and Chrome Apps get uninstalled on startup. What is the solution for this problem? Would really appreciate it if someone could help me out. Cheers!

@ghost
Copy link
Author

ghost commented Dec 15, 2021

  1. I am using session buddy extension for chrome to save last sessions.
  2. I never run chrome outside of sandbox.
  3. I use chocolatey to update chrome

@Zo-Bro-23
Copy link

Got it. Here's how I fixed it:

  1. I removed the default profile from my sandbox Chrome
  2. I created a different profile with the same email
    So even though it has the same email, Chrome sees the two profiles as different user accounts, so the closed tabs are stored in a separate folder. Hope I explained it clearly!

@ghost
Copy link
Author

ghost commented Dec 16, 2021

Can you elaborate step by step, please?
2. Inside or outside of main chrome sandbox?

Outside of sandbox I have clean profile without any extensions. I have multiple sandboxes with various configuration

@Zo-Bro-23
Copy link

Both my sandbox and my outside chrome sandbox have similar configurations. I cloned the outside sandbox chrome into the sandbox. I deleted the default user and added a new user with similar configurations (inside the sandbox). That made sure that the tabs were restored properly.

@isaak654 isaak654 added the Known issue Old known Sandboxie issues label Dec 17, 2021
@ghost
Copy link
Author

ghost commented Dec 17, 2021

Does your solution work with multiple sandboxes with various configurations?

@isaak654 isaak654 added the Chromium Collection of Chromium issues label Dec 17, 2021
@Zo-Bro-23
Copy link

Yup 👍

@ghost
Copy link
Author

ghost commented Dec 25, 2021

Thanks. However I decided to uninstall Chrome anyway

@ghost
Copy link
Author

ghost commented Dec 3, 2022

This happens with MS Edge as well... Since we are not able to sign into Edge, it is quite severe

@ghost ghost changed the title Chrome does not restore tabs if ran out of Sandbox before Chrome/Edge does not restore tabs if ran out of Sandbox before Dec 3, 2022
@offhub
Copy link
Collaborator

offhub commented Dec 3, 2022

Chrome/Edge saves session files with a timestamp at the end. When you restart the browser, it loads the newest session files which are created outside of the sandbox.

Example:

###
Open - Edge (Sandboxed)
	Tabs_0001 (Created/Modified)
	Session_0001 (Created/Modified)
Close - Edge (Sandboxed)

Open - Edge (UNSandboxed)
	Tabs_0002 (Created/Modified)
	Session_0002 (Created/Modified)
Close - Edge (UNSandboxed)

Open - Edge (Sandboxed)
	Tabs_0001 (old)
	Session_0001 (old)
	LOADS Tabs_0002 (Because it's newer)
	LOADS Session_0002 (Because it's newer)
Close - Edge (Sandboxed)
.
.
.
###

Try these rules:

Edge:
WriteFilePath=msedge.exe,*\AppData\Local\Microsoft\Edge\User Data\Default\Sessions\*

Chrome:
WriteFilePath=chrome.exe,*\AppData\Local\Google\Chrome\User Data\Default\Sessions\*

EDIT:

From : https://source.chromium.org/chromium/chromium/src/+/e27098ba216a56402f42f98c1689c6bfe139a4c0

Rewrites session restore to use timestamp based file storage.

When a new session is started, the timestamp is recorded and the session
is saved as Sessions_[timestamp] or Tabs_[timestamp]. The existing
session with the latest timestamp is chosen as the "last" session to
restore from, and all older sessions are deleted.

These new files were moved under a separate directory, to facilitate
snapshotting. Snapshotting relies on static file names, so the entire
folder is preserved rather than the (now dynamic) session files.

The folder structure is as follows:

[ProfileDir]
| Sessions
-----| Session_13233899802170163
     | Session_13233899825256793
     | Tabs_13233899802319101
     | Tabs_13233899825404195

The code ensures than any new session created has a higher timestamp
than any existing, in case of clock changes. If there is no older
session in the new format, it falls back to the legacy files
(as "Current Tabs" or "Current Session"), so current users should
have no interruption in restore.

@ghost
Copy link
Author

ghost commented Dec 6, 2022

You don't seem to understand the issue.
I mentioned that allowing write access will prevent having multiple sandboxes with separate browser's configurations.

Also, the issue affects only one sandbox, not all of them.

If we want to fix it, we need blacklist paths, not whitelist them

@offhub
Copy link
Collaborator

offhub commented Dec 6, 2022

WriteFilePath doesn't allow write access outside of the sandbox. It hides host/real files and folders from sandboxed programs but allows creation inside the sandbox.

In your terms:

WriteFilePath = Blacklist/Ignore
[Plus > Sandboxie Options > Resource Access > Files > Add... > Access: Box Only (Write Only)]

OpenFilePath = Whitelist/Write access
[Plus > Sandboxie Options > Resource Access > Files > Add... > Access: Open]

@ghost
Copy link
Author

ghost commented Feb 5, 2023

Thank you. I will test it and let you know.

Works perfectly, thanks!

To fix profiles issues in and outside of the box, I suggest to run Edge with default profile and delete all profiles

@isaak654 isaak654 added the Workaround Temporary or alternative solution label Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Chromium Collection of Chromium issues Known issue Old known Sandboxie issues Workaround Temporary or alternative solution
Projects
None yet
Development

No branches or pull requests

6 participants