krz/octosentry

macOS menu bar app to monitor GitHub security alerts

clone: git clone https://gitbay.org/krz/octosentry.git

main: octosentryTests/Fixtures.swift · raw

  1//
  2//  Fixtures.swift
  3//  octosentryTests
  4//
  5//  Response bodies recorded from the GitHub REST alert endpoints, trimmed
  6//  to a couple of entries each but otherwise left as the API returns them.
  7//
  8
  9enum Fixtures {
 10
 11    static let dependabotAlerts = """
 12    [
 13      {
 14        "number": 4,
 15        "state": "open",
 16        "html_url": "https://github.com/octocat/hello-world/security/dependabot/4",
 17        "created_at": "2026-06-21T22:12:22Z",
 18        "updated_at": "2026-06-22T13:10:00Z",
 19        "dependency": {
 20          "package": { "ecosystem": "npm", "name": "some-package" },
 21          "manifest_path": "package-lock.json",
 22          "scope": "runtime"
 23        },
 24        "security_advisory": {
 25          "ghsa_id": "GHSA-rf4j-j272-fj86",
 26          "cve_id": "CVE-2026-11111",
 27          "summary": "Denial of service in some-package",
 28          "severity": "high"
 29        },
 30        "security_vulnerability": {
 31          "severity": "high",
 32          "vulnerable_version_range": "< 1.2.3"
 33        }
 34      },
 35      {
 36        "number": 3,
 37        "state": "open",
 38        "html_url": "https://github.com/octocat/hello-world/security/dependabot/3",
 39        "created_at": "2026-06-19T09:01:00Z",
 40        "updated_at": "2026-06-19T09:01:00Z",
 41        "dependency": {
 42          "package": { "ecosystem": "npm", "name": "other-package" },
 43          "manifest_path": "package-lock.json",
 44          "scope": "development"
 45        },
 46        "security_advisory": {
 47          "ghsa_id": "GHSA-aaaa-bbbb-cccc",
 48          "cve_id": null,
 49          "summary": "Prototype pollution in other-package",
 50          "severity": "moderate"
 51        },
 52        "security_vulnerability": {
 53          "severity": "moderate",
 54          "vulnerable_version_range": "< 4.0.0"
 55        }
 56      }
 57    ]
 58    """
 59
 60    static let codeScanningAlerts = """
 61    [
 62      {
 63        "number": 12,
 64        "state": "open",
 65        "html_url": "https://github.com/octocat/hello-world/security/code-scanning/12",
 66        "created_at": "2026-06-20T08:00:00Z",
 67        "updated_at": "2026-06-20T08:30:00Z",
 68        "rule": {
 69          "id": "js/sql-injection",
 70          "name": "js/sql-injection",
 71          "severity": "error",
 72          "security_severity_level": "high",
 73          "description": "Query built from user-controlled sources",
 74          "tags": ["security", "external/cwe/cwe-089"]
 75        },
 76        "tool": { "name": "CodeQL", "version": "2.16.0" },
 77        "most_recent_instance": {
 78          "ref": "refs/heads/main",
 79          "state": "open",
 80          "message": { "text": "This query depends on a user-provided value." },
 81          "location": { "path": "src/db.js", "start_line": 42 }
 82        }
 83      },
 84      {
 85        "number": 11,
 86        "state": "open",
 87        "html_url": "https://github.com/octocat/hello-world/security/code-scanning/11",
 88        "created_at": "2026-06-18T11:00:00Z",
 89        "updated_at": "2026-06-18T11:00:00Z",
 90        "rule": {
 91          "id": "js/unused-local-variable",
 92          "name": "js/unused-local-variable",
 93          "severity": "warning",
 94          "security_severity_level": null,
 95          "description": "Unused variable",
 96          "tags": ["maintainability"]
 97        },
 98        "tool": { "name": "CodeQL", "version": "2.16.0" }
 99      }
100    ]
101    """
102
103    static let secretScanningAlerts = """
104    [
105      {
106        "number": 2,
107        "state": "open",
108        "html_url": "https://github.com/octocat/hello-world/security/secret-scanning/2",
109        "created_at": "2026-06-22T17:45:00Z",
110        "updated_at": "2026-06-22T17:45:00Z",
111        "secret_type": "github_personal_access_token",
112        "secret_type_display_name": "GitHub Personal Access Token",
113        "validity": "active",
114        "push_protection_bypassed": false
115      },
116      {
117        "number": 1,
118        "state": "open",
119        "html_url": "https://github.com/octocat/hello-world/security/secret-scanning/1",
120        "created_at": "2026-06-15T10:00:00Z",
121        "updated_at": "2026-06-15T10:00:00Z",
122        "secret_type": "generic_api_key",
123        "secret_type_display_name": "Generic API Key",
124        "push_protection_bypassed": false
125      }
126    ]
127    """
128
129    static let userRepos = """
130    [
131      { "id": 1296269, "name": "hello-world", "full_name": "octocat/hello-world", "private": false },
132      { "id": 1296270, "name": "spoon-knife", "full_name": "octocat/spoon-knife", "private": true }
133    ]
134    """
135}