MCPcopy Create free account
hub / github.com/0xMarcio/cve / upsert_github_section

Function upsert_github_section

scripts/update_cves.py:308–345  ·  view source on GitHub ↗
(text: str, poc_links: Iterable[str])

Source from the content-addressed store, hash-verified

306 readme_cves = set()
307 accepted: set[str] = set()
308 for cve_id in name_cves:
309 has_context = readme_has_poc_context(readme, cve_id, full_name)
310 has_artifact = root_has_poc_artifact(repo, cve_id)
311 has_content = bool(readme.strip()) or has_artifact or has_code
312 if (
313 (not identity_is_non_poc or has_artifact or has_code)
314 and (metadata_has_poc or has_context or has_artifact)
315 and has_content
316 ):
317 accepted.add(cve_id)
318 for cve_id in description_cves | topic_cves:
319 has_context = readme_has_poc_context(readme, cve_id, full_name)
320 if (
321 (not identity_is_non_poc or cve_id in name_cves)
322 and (metadata_has_poc or has_context)
323 and (has_context or root_has_poc_artifact(repo, cve_id) or has_code)
324 ):
325 accepted.add(cve_id)
326 for cve_id in readme_cves:
327 has_artifact = root_has_poc_artifact(repo, cve_id)
328 if identity_cves and cve_id not in identity_cves and not has_artifact:
329 continue
330 if (
331 readme_has_poc_context(readme, cve_id, full_name)
332 and (has_artifact or has_code or identity_has_poc)
333 ):
334 accepted.add(cve_id)
335 return accepted
336
337
338def http_json(
339 url: str,
340 *,
341 headers: dict[str, str] | None = None,
342 data: dict[str, Any] | None = None,
343 timeout: int = 45,
344 allow_not_found: bool = False,
345) -> Any:
346 request_headers = {"Accept": "application/json", "User-Agent": USER_AGENT}
347 request_headers.update(headers or {})
348 body = None

Callers 1

update_existing_markdownFunction · 0.85

Calls 1

parse_linksFunction · 0.85

Tested by

no test coverage detected