PlasmoHQ / plasmo

🧩 The Browser Extension Framework
https://www.plasmo.com
MIT License
10.14k stars 350 forks source link

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

Open wadhia-yash opened 9 months ago

wadhia-yash commented 9 months ago

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

Code of Conduct

hugepizza commented 8 months ago

i have the same problem, any solution?

wadhia-yash commented 8 months ago

@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

fkysly commented 7 months ago

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

louisgv commented 7 months ago

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 :-?