Skip to content

[Feature] 扩展给脚本申请权限时候应该最小化到origin范围 #1805

Closed as not planned

Description

@g9wp

提交前检查

  • 我已搜索过现有 issues,并确认这不是重复的功能请求。
  • 在条件允许的情况下,我已尽量使用最新的 stable 或 beta 版本确认该功能仍未提供。
  • 我已确认这是新增或改进功能的请求,而不是现有功能的 bug 反馈。

你想解决的问题

当前申请权限和检查时候忽略了port,导致申请权限范围过大,应该保留port将权限最小化到origin。
比如脚本访问 http://localhost:12345/api 时候,扩展申请的权限是 http://localhost/*(相当于http://localhost:*/*),应该限制到 http://localhost:12345/*,如果url不带端口才考虑扩展到所有端口

期望的解决方案

.

ScriptCat 版本

v1.5.0

补充信息

No response

Activity

  1. added theissue type on Oct 23, 2026
  2. cyfung1031 commented on Oct 24, 2026

    @cyfung1031
    Collaborator

    UserScript规范没有指定 port
    你可以用 // @include 用 url方式 指定 port
    这部份 ScriptCat 尽量和 Tampermonkey, Violentmonkey 保持一致避免不相容

  3. cyfung1031 commented on Oct 24, 2026

    @cyfung1031
    Collaborator

    补充说明:

    UserScript权限的概念是 Domain. 每论是 abc.com:12345 或是 abc.com:80 ,这些 DNS 的指向都是同一个 server
    因此userscript给的权限是「信任abc.com这个 domain」,而不是单纯 url 本身
    也就是说 「abc.com」是值得信任的domain的话,「abc.com:80 」,「abc.com:12345」都是值得信任的
    如果是「*.abc.com」,則是「abc.com:80 」,「abc.com:12345」和「news.abc.com」 都是值得信任的
    这些都是UserScript的标准match规范設計

    特殊需要的部份以「 // @include 」来处理
    (相于对Tampermonkey,在ScriptCat里会出现 #1803 的问题但不影响执行)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions