Expand truncated git commit ids and fix typos#414
Expand truncated git commit ids and fix typos#414progval wants to merge 1 commit intoSAP:vulnerability-datafrom
Conversation
|
|
22b7d06 to
0d29a84
Compare
|
I can't use the CLA app linked above, but I agree to the CLA:
|
One truncated id (da3a703213e47d87682f6970ca2db8d05a4ada2) remains in `statements/CVE-2019-10156/statement.yaml` because I was not able to locate this commit. Most of them were fixed with this Python script, with some manual fixes: ```python from pathlib import Path import requests import tqdm import yaml for path in tqdm.tqdm(list(Path(".").glob("statements/*/statement.yaml"))): stmt = yaml.safe_load(path.read_text()) for fix in stmt.get("fixes", []): for commit in fix.get("commits", []): if len(commit["id"]) < 40: if commit["repository"].startswith("https://github.com/"): slug = commit["repository"].removeprefix("https://github.com/").removesuffix(".git") elif commit["repository"].startswith("https://git-wip-us.apache.org/"): # github redirect slug = commit["repository"].removeprefix("https://git-wip-us.apache.org/repos/").removesuffix(".git") elif commit["repository"].startswith("https://gitbox.apache.org/repos/"): # github redirect slug = commit["repository"].removeprefix("https://gitbox.apache.org/repos/").removesuffix(".git") elif commit["repository"].startswith(("http://svn.apache.org/", "https://svn.apache.org/")): # subversion, not git continue else: assert False, f"Unknown repo: {commit}" j = requests.get(f"https://api.github.com/repos/{slug}/commits/{commit['id']}", headers={"Authorization": "Bearer github_pat_[redacted]"}).json() if "status" in j: print(path, j) continue path.write_text(path.read_text().replace(commit["id"], j["sha"])) ```
0d29a84 to
b91206f
Compare
One truncated id (da3a703213e47d87682f6970ca2db8d05a4ada2) remains in
statements/CVE-2019-10156/statement.yamlbecause I was not able to locate this commit.Most of them were fixed with this Python script, with some manual fixes: