Repository: CloudSecurityAlliance/gsd-tools (language: python)

Issue:
Update GSD Bot to use INTRODUCED/FIX for reference types
e.g.

[GSD-2023-1002425](https://gsd.id/GSD-2023-1002425)

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=94f68f3e059c478e240f65fcb64746fe371295df


Discussion / hints:
also INTRODUCED is now available in OSV
Per @kurtseifried, also add introduced as a reference if available as a type of INTRODUCED.

Fix patch:
diff --git a/gsd-bot/.devcontainer/devcontainer.json b/gsd-importers/linux-kernel/.devcontainer/devcontainer.json
similarity index 100%
rename from gsd-bot/.devcontainer/devcontainer.json
rename to gsd-importers/linux-kernel/.devcontainer/devcontainer.json
diff --git a/gsd-bot/.env.sample b/gsd-importers/linux-kernel/.env.sample
similarity index 100%
rename from gsd-bot/.env.sample
rename to gsd-importers/linux-kernel/.env.sample
diff --git a/gsd-bot/.gitignore b/gsd-importers/linux-kernel/.gitignore
similarity index 100%
rename from gsd-bot/.gitignore
rename to gsd-importers/linux-kernel/.gitignore
diff --git a/gsd-importers/linux-kernel/.gitkeep b/gsd-importers/linux-kernel/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/gsd-bot/Dockerfile b/gsd-importers/linux-kernel/Dockerfile
similarity index 100%
rename from gsd-bot/Dockerfile
rename to gsd-importers/linux-kernel/Dockerfile
diff --git a/gsd-bot/GSD/GSDGithub.py b/gsd-importers/linux-kernel/GSD/GSDGithub.py
similarity index 100%
rename from gsd-bot/GSD/GSDGithub.py
rename to gsd-importers/linux-kernel/GSD/GSDGithub.py
diff --git a/gsd-bot/GSD/GSDIssue.py b/gsd-importers/linux-kernel/GSD/GSDIssue.py
similarity index 100%
rename from gsd-bot/GSD/GSDIssue.py
rename to gsd-importers/linux-kernel/GSD/GSDIssue.py
diff --git a/gsd-bot/GSD/GSDRepo.py b/gsd-importers/linux-kernel/GSD/GSDRepo.py
similarity index 94%
rename from gsd-bot/GSD/GSDRepo.py
rename to gsd-importers/linux-kernel/GSD/GSDRepo.py
index a917f19..372762f 100644
--- a/gsd-bot/GSD/GSDRepo.py
+++ b/gsd-importers/linux-kernel/GSD/GSDRepo.py
@@ -263,19 +263,16 @@ def get_osv_json_format(self, gsd_id, issue_data):
                     raise Exception("Unknown kernel note")
 
             c["references"] = []
-            for i in issue_data["references"]:
-                c["references"].append({"type": "WEB", "url": i})
-
-            c["affected"].append({
-                "package": {
-                    "name": "Kernel",
-                    "ecosystem": "Linux"
-                },
-                "ranges": [{
-                    "type": "SEMVER",
-                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/",
-                    "events": [{"introduced": issue_data["introduced_version"]}, {"fixed": issue_data["fixed_version"]}]
-                }]
+            for i in issue_data["extended_references"]:
+                c["references"].append({
+                    "type": i["note"].upper(),
+                    "url": f"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id={i['value']}"
+                })
+
+            c["affected"][0]["ranges"].append({
+                "type": "SEMVER",
+                "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/",
+                "events": [{"introduced": issue_data["introduced_version"]}, {"fixed": issue_data["fixed_version"]}]
             })
         else:
             # We're not looking at kernel issues
diff --git a/gsd-bot/GSD/__init__.py b/gsd-importers/linux-kernel/GSD/__init__.py
similarity index 100%
rename from gsd-bot/GSD/__init__.py
rename to gsd-importers/linux-kernel/GSD/__init__.py
diff --git a/gsd-bot/README.md b/gsd-importers/linux-kernel/README.md
similarity index 100%
rename from gsd-bot/README.md
rename to gsd-importers/linux-kernel/README.md
diff --git a/gsd-bot/bot.py b/gsd-importers/linux-kernel/bot.py
similarity index 100%
rename from gsd-bot/bot.py
rename to gsd-importers/linux-kernel/bot.py
diff --git a/gsd-bot/helpers/add-osv-summary.py b/gsd-importers/linux-kernel/helpers/add-osv-summary.py
similarity index 100%
rename from gsd-bot/helpers/add-osv-summary.py
rename to gsd-importers/linux-kernel/helpers/add-osv-summary.py
diff --git a/gsd-bot/helpers/add-osv-to-repo.py b/gsd-importers/linux-kernel/helpers/add-osv-to-repo.py
similarity index 100%
rename from gsd-bot/helpers/add-osv-to-repo.py
rename to gsd-importers/linux-kernel/helpers/add-osv-to-repo.py
diff --git a/gsd-bot/helpers/git-askpass-helper.sh b/gsd-importers/linux-kernel/helpers/git-askpass-helper.sh
similarity index 100%
rename from gsd-bot/helpers/git-askpass-helper.sh
rename to gsd-importers/linux-kernel/helpers/git-askpass-helper.sh
diff --git a/gsd-bot/helpers/git-askpass.py b/gsd-importers/linux-kernel/helpers/git-askpass.py
similarity index 100%
rename from gsd-bot/helpers/git-askpass.py
rename to gsd-importers/linux-kernel/helpers/git-askpass.py
diff --git a/gsd-bot/helpers/gitconfig b/gsd-importers/linux-kernel/helpers/gitconfig
similarity index 100%
rename from gsd-bot/helpers/gitconfig
rename to gsd-importers/linux-kernel/helpers/gitconfig
diff --git a/gsd-bot/helpers/linux-kernel-generator.py b/gsd-importers/linux-kernel/helpers/linux-kernel-generator.py
similarity index 100%
rename from gsd-bot/helpers/linux-kernel-generator.py
rename to gsd-importers/linux-kernel/helpers/linux-kernel-generator.py
diff --git a/gsd-bot/helpers/loop_bot.sh b/gsd-importers/linux-kernel/helpers/loop_bot.sh
similarity index 100%
rename from gsd-bot/helpers/loop_bot.sh
rename to gsd-importers/linux-kernel/helpers/loop_bot.sh
diff --git a/gsd-bot/helpers/rename-uvi-to-gsd.py b/gsd-importers/linux-kernel/helpers/rename-uvi-to-gsd.py
similarity index 100%
rename from gsd-bot/helpers/rename-uvi-to-gsd.py
rename to gsd-importers/linux-kernel/helpers/rename-uvi-to-gsd.py
diff --git a/gsd-bot/helpers/update-osv-linux.py b/gsd-importers/linux-kernel/helpers/update-osv-linux.py
similarity index 100%
rename from gsd-bot/helpers/update-osv-linux.py
rename to gsd-importers/linux-kernel/helpers/update-osv-linux.py
diff --git a/gsd-bot/requirements.txt b/gsd-importers/linux-kernel/requirements.txt
similarity index 100%
rename from gsd-bot/requirements.txt
rename to gsd-importers/linux-kernel/requirements.txt
diff --git a/gsd-bot/setup.cfg b/gsd-importers/linux-kernel/setup.cfg
similarity index 100%
rename from gsd-bot/setup.cfg
rename to gsd-importers/linux-kernel/setup.cfg
diff --git a/gsd-bot/setup.py b/gsd-importers/linux-kernel/setup.py
similarity index 100%
rename from gsd-bot/setup.py
rename to gsd-importers/linux-kernel/setup.py


Test patch:
diff --git a/gsd-bot/tests/__init__.py b/gsd-importers/linux-kernel/tests/__init__.py
similarity index 100%
rename from gsd-bot/tests/__init__.py
rename to gsd-importers/linux-kernel/tests/__init__.py
diff --git a/gsd-bot/tests/test_GSDGithub.py b/gsd-importers/linux-kernel/tests/test_GSDGithub.py
similarity index 100%
rename from gsd-bot/tests/test_GSDGithub.py
rename to gsd-importers/linux-kernel/tests/test_GSDGithub.py
diff --git a/gsd-bot/tests/test_GSDIssue.py b/gsd-importers/linux-kernel/tests/test_GSDIssue.py
similarity index 100%
rename from gsd-bot/tests/test_GSDIssue.py
rename to gsd-importers/linux-kernel/tests/test_GSDIssue.py
diff --git a/gsd-bot/tests/test_GSDRepo.py b/gsd-importers/linux-kernel/tests/test_GSDRepo.py
similarity index 100%
rename from gsd-bot/tests/test_GSDRepo.py
rename to gsd-importers/linux-kernel/tests/test_GSDRepo.py