unlimitedStorage permission

125 views
Skip to first unread message

Ritik Roongta

unread,
May 30, 2023, 5:53:43 PM5/30/23
to Chromium Extensions
Hello,
I am analysing some extensions for the unlimitedStorage permissions. I am looking in the Local Storage and Local Extension Settings/<Extension ID> folders for calculating the total local storage space used by the extensions. Is there any other location where local storage data is stored by the extensions?

Browser Extenstion

unread,
May 30, 2023, 6:12:02 PM5/30/23
to Chromium Extensions, Ritik Roongta
I'm not sure what exactly you're looking for, but you can find out the storage each specific extension uses:
chrome.storage.local.getBytesInUse(null, r=> console.log(r))

And one more thing: unlimitedStorage used for chrome.storage API (not localStorage).

Ritik Roongta

unread,
May 31, 2023, 12:07:04 AM5/31/23
to Chromium Extensions, Browser Extenstion, Ritik Roongta
I am trying to study if the extensions requesting unlimitedStorage permission actually require it by analyzing if the local storage exceeds 5 MB.
This command gives 0 bytes even when the extension has a leveldb log file in 'Local Extension Setting' directory.

As far as my understanding goes, unlimitedStorage removes the storage quota for the localStorage. Do extensions request it for other measures as well?

wOxxOm

unread,
May 31, 2023, 12:58:04 AM5/31/23
to Chromium Extensions, Ritik Roongta, Browser Extenstion
"Local Storage" folder is for HTML5 window.localStorage
"Local Extension Settings" is for chrome.storage.local.

> This command gives 0 bytes even when the extension has a leveldb log file in 'Local Extension Setting' directory.

Assuming you ran getBytesInUse in devtools for the extension's context, the log file may be present but be empty inside e.g. if the data was written and then deleted. Chrome postpones compaction of the database, so it can retain its size for a [short] while even if there's nothing inside.

> unlimitedStorage removes the storage quota for the localStorage

No, unlimitedStorage is applied only to chrome.storage.local as noted above.
HTML5 localStorage is always limited to 5MB (computed as a combined string length which actually means 10MB physical bytes on disk because strings are 2-byte unicode in JS).
IndexedDB, sandboxed HTML5 FileSystem use the global quota manager so they can grow a lot:

Ritik Roongta

unread,
May 31, 2023, 9:33:00 PM5/31/23
to Chromium Extensions, wOxxOm, Ritik Roongta, Browser Extenstion
Okay. So if I want to test if requesting unlimitedStorage permission by the extension is justified, would simply checking "Local Extension Settings" and running 'getBytesInUse' provide me a fair bit of estimate since this permission only applies to chrome.storage.local?

wOxxOm

unread,
Jun 1, 2023, 1:04:20 AM6/1/23
to Chromium Extensions, Ritik Roongta, wOxxOm, Browser Extenstion
getBytesInUse is the only necessary check, however anything that shows the current usage is useless for extensions that allow storing an unpredictable amount of user data like Tampermonkey.
Reply all
Reply to author
Forward
0 new messages