plasmo icon indicating copy to clipboard operation
plasmo copied to clipboard

[BUG] manifest.json contains "storage" permission in dev and prod build, even if not added in package.json

Open wadhia-yash opened this issue 2 years ago • 5 comments

What happened?

What happened?

After the dev or the prod build is generated the manifest.json contains permission for storage by default even though I have not added in package.json's manifest object

Following is the package.json manifest section


  "manifest": {
    "permissions": [
      "identity"
    ],
    "content_security_policy": {
      "extension_pages": "script-src 'self'; object-src 'self'; script-src-elem 'self' 'unsafe-inline';"
    },
    "oauth2": {
      "client_id": "$PLASMO_PUBLIC_FIREBASE_CLIENT_ID",
      "scopes": [
        "https://www.googleapis.com/auth/userinfo.email",
        "https://www.googleapis.com/auth/userinfo.profile"
      ]
    }
  }

And following is the manifest.json from chrome-mv3-prod

{
 "icons": {
   "16": "icon16.plasmo.6c567d50.png",
   "32": "icon32.plasmo.76b92899.png",
   "48": "icon48.plasmo.aced7582.png",
   "64": "icon64.plasmo.8bb5e6e0.png",
   "128": "icon128.plasmo.3c1ed2d2.png"
 },
 "manifest_version": 3,
 "action": {
   "default_icon": {
     "16": "icon16.plasmo.6c567d50.png",
     "32": "icon32.plasmo.76b92899.png",
     "48": "icon48.plasmo.aced7582.png",
     "64": "icon64.plasmo.8bb5e6e0.png",
     "128": "icon128.plasmo.3c1ed2d2.png"
   },
   "default_popup": "popup.html"
 },
 "version": "0.0.1",
 "author": "Cliqueraft",
 "name": "supertasks.io extension",
 "description": "Quick decision making tool web extension",
 "permissions": [
   "storage",
   "identity"
 ],
 "content_security_policy": {
   "extension_pages": "script-src 'self'; object-src 'self'; script-src-elem 'self' 'unsafe-inline';"
 },
 "oauth2": {
   "scopes": [
     "https://www.googleapis.com/auth/userinfo.email",
     "https://www.googleapis.com/auth/userinfo.profile"
   ]
 }
}

After debugging the code I encountered following code could be the reason for adding storage permission by default https://github.com/PlasmoHQ/plasmo/blob/c1dd9529278d777f8a0a085d5c63c08135a416bb/cli/plasmo/src/features/manifest-factory/base.ts#L78

PS: My app gets rejected from web-app store if I am using unnecessary permissons

Version

Latest

What OS are you seeing the problem on?

MacOSX

What browsers are you seeing the problem on?

Chrome

Relevant log output

No response

(OPTIONAL) Contribution

  • [X] I would like to fix this BUG via a PR

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct
  • [X] I checked the current issues for duplicate problems.

wadhia-yash avatar Dec 09 '23 12:12 wadhia-yash

i have the same problem, any solution?

hugepizza avatar Dec 21 '23 10:12 hugepizza

@hugepizza For meanwhile you can manually go to prod folder which is generated and remove storage permission from manifest.json file

Let me generate PR for the same

wadhia-yash avatar Dec 21 '23 11:12 wadhia-yash

+1, the same problem, how to solve? I dont want to manually

fkysly avatar Jan 27 '24 14:01 fkysly

That auto permission will only be applied if you installed the storage package. If you don't need to use permission at all, remove the plasmo storage package should remove it I think :-?

louisgv avatar Jan 28 '24 10:01 louisgv