There was an error while loading. Please reload this page.
1 parent 03d556f commit 1c71d76Copy full SHA for 1c71d76
1 file changed
scripts/build-index.cjs
@@ -20,11 +20,17 @@ const MASTER_INDEX_VERSION = '0.1.0';
20
* @returns {Promise<object|null>} Repository metadata or null if not available
21
*/
22
async function fetchGitHubMetadata(repoUrl) {
23
- if (!repoUrl?.includes('github.com')) {
+ if (!repoUrl) {
24
return null;
25
}
26
27
try {
28
+ // Parse and validate the URL to prevent substring injection attacks
29
+ const url = new URL(repoUrl);
30
+ if (url.hostname !== 'github.com' && url.hostname !== 'www.github.com') {
31
+ return null;
32
+ }
33
+
34
// Extract owner/repo from URL
35
const match = new RegExp(/github\.com\/([^/]+)\/([^/]+)/).exec(repoUrl);
36
if (!match) {
0 commit comments