mirror of
https://github.com/0xMarcio/cve.git
synced 2026-10-27 16:51:03 +00:00
Fix three ways the index misread its own data
An advisory copied from a GitHub Security Advisory opens with "### Impact" or "### Summary". The section parser treated any heading as a boundary, so those descriptions ended themselves and reached the site empty. Only the four headings an entry actually uses end a section now, and leading heading markers are stripped when the text is rendered. A trailing slash made exploit-db.com/exploits/41034 and .../41034/ two different links, which put 53 duplicate rows in front of readers. github.com also serves attachments and advisories, and 103 of those were being parsed as owner/repo -- rendering "user-attachments / files" with an empty star column instead of the PoC archive they point to.
This commit is contained in:
1 parent
1aa51fa852
commit
6822fdbfbc
3 files changed
+22
-5
No files matched your search
+6
-1
@@ -72,9 +72,14 @@ function shortAge(hours) {
|
||||
return Math.round(days / 365) + 'y';
|
||||
}
|
||||
|
||||
// github.com serves more than repositories; an attachment or an advisory has
|
||||
// no owner and no stars, and reads as nonsense in an owner / repo row.
|
||||
const NOT_A_REPO = new Set(['user-attachments', 'advisories', 'security', 'orgs',
|
||||
'apps', 'marketplace', 'sponsors', 'topics', 'collections', 'settings', 'notifications']);
|
||||
|
||||
function repoFromUrl(url) {
|
||||
const match = /^https?:\/\/(?:www\.)?github\.com\/([^/#?]+)\/([^/#?]+)/i.exec(url || '');
|
||||
if (!match) return null;
|
||||
if (!match || NOT_A_REPO.has(match[1].toLowerCase())) return null;
|
||||
return { owner: match[1], repo: match[2].replace(/\.git$/i, '') };
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user