-
Couldn't load subscription status.
- Fork 280
Open
Labels
P1🔥 重要但是不紧急的内容🔥 重要但是不紧急的内容
Description
问题描述
基于vite-monkey写的脚本dev调试情况下用inject-into无法正确绕过csp限制的bug
实测后:
vite-plugin-monkey build编译导入 == 正确注入脚本
vite-plugin-monkey dev调试 == 无法绕过csp


重现步骤
- pnpm create monkey
- 使用inject-into
- pnpm dev
脚本猫版本
v1.2.0.1300 beta
操作系统以及浏览器信息
windows11 edge 版本 135.0.3179.73 (正式版本) (64 位)
补充信息 (选填)
测试代码如下:
main.js
const div = document.createElement("div");
div.innerHTML = "hello scriptcat";
document.body.append(div);vite.config.js
export default defineConfig({
plugins: [
monkey({
entry: 'src/main.js',
userscript: {
icon: 'https://vitejs.dev/logo.svg',
namespace: 'npm/vite-plugin-monkey',
name: 'test',
version: '1.0.0',
description: 'test',
"inject-into": "content",
grant: 'none',
match: ['http://www.example.com/*'],
},
}),
],
});HTTP Response
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Cache-Control: no-store, no-cache, must-revalidate
Connection: keep-alive
Content-Encoding: gzip
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; object-src 'none'; media-src 'none'; frame-ancestors 'none';
Content-Type: text/html; charset=UTF-8
Date: Mon, 20 Oct 2025 06:33:23 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive: timeout=4
Pragma: no-cache
Proxy-Connection: keep-alive
Server: nginx
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Xss-Protection: 1; mode=blockMetadata
Metadata
Assignees
Labels
P1🔥 重要但是不紧急的内容🔥 重要但是不紧急的内容