{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/github/main/json-schema/github-secret-scanning-alert-schema.json",
  "title": "secret-scanning-alert",
  "x-generated": "2026-10-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/github-secret-scanning-api-openapi.yml#/components/schemas/secret-scanning-alert",
  "type": "object",
  "properties": {
    "number": {
      "$ref": "#/$defs/alert-number"
    },
    "created_at": {
      "$ref": "#/$defs/alert-created-at"
    },
    "updated_at": {
      "$ref": "#/$defs/nullable-alert-updated-at"
    },
    "url": {
      "$ref": "#/$defs/alert-url"
    },
    "html_url": {
      "$ref": "#/$defs/alert-html-url"
    },
    "locations_url": {
      "type": "string",
      "format": "uri",
      "description": "The REST API URL of the code locations for this alert."
    },
    "state": {
      "$ref": "#/$defs/secret-scanning-alert-state"
    },
    "resolution": {
      "$ref": "#/$defs/secret-scanning-alert-resolution"
    },
    "resolved_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "The time that the alert was resolved in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`."
    },
    "resolved_by": {
      "$ref": "#/$defs/nullable-simple-user"
    },
    "resolution_comment": {
      "type": [
        "string",
        "null"
      ],
      "description": "An optional comment to resolve an alert."
    },
    "secret_type": {
      "type": "string",
      "description": "The type of secret that secret scanning detected."
    },
    "secret_type_display_name": {
      "type": "string",
      "description": "User-friendly name for the detected secret, matching the `secret_type`.\nFor a list of built-in patterns, see \"[Secret scanning patterns](https://docs.github.com/enterprise-server@3.9/code-security/secret-scanning/secret-scanning-patterns#supported-secrets-for-advanced-security).\""
    },
    "secret": {
      "type": "string",
      "description": "The secret that was detected."
    },
    "push_protection_bypassed": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "Whether push protection was bypassed for the detected secret."
    },
    "push_protection_bypassed_by": {
      "$ref": "#/$defs/nullable-simple-user"
    },
    "push_protection_bypassed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "The time that push protection was bypassed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`."
    }
  },
  "$defs": {
    "alert-created-at": {
      "type": "string",
      "description": "The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.",
      "format": "date-time",
      "readOnly": true
    },
    "alert-html-url": {
      "type": "string",
      "description": "The GitHub URL of the alert resource.",
      "format": "uri",
      "readOnly": true
    },
    "alert-number": {
      "type": "integer",
      "description": "The security alert number.",
      "readOnly": true
    },
    "alert-url": {
      "type": "string",
      "description": "The REST API URL of the alert resource.",
      "format": "uri",
      "readOnly": true
    },
    "nullable-alert-updated-at": {
      "type": [
        "string",
        "null"
      ],
      "description": "The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.",
      "format": "date-time",
      "readOnly": true
    },
    "nullable-simple-user": {
      "title": "Simple User",
      "description": "A GitHub user.",
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "email": {
          "type": [
            "string",
            "null"
          ]
        },
        "login": {
          "type": "string"
        },
        "id": {
          "type": "integer"
        },
        "node_id": {
          "type": "string"
        },
        "avatar_url": {
          "type": "string",
          "format": "uri"
        },
        "gravatar_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "html_url": {
          "type": "string",
          "format": "uri"
        },
        "followers_url": {
          "type": "string",
          "format": "uri"
        },
        "following_url": {
          "type": "string"
        },
        "gists_url": {
          "type": "string"
        },
        "starred_url": {
          "type": "string"
        },
        "subscriptions_url": {
          "type": "string",
          "format": "uri"
        },
        "organizations_url": {
          "type": "string",
          "format": "uri"
        },
        "repos_url": {
          "type": "string",
          "format": "uri"
        },
        "events_url": {
          "type": "string"
        },
        "received_events_url": {
          "type": "string",
          "format": "uri"
        },
        "type": {
          "type": "string"
        },
        "site_admin": {
          "type": "boolean"
        },
        "starred_at": {
          "type": "string"
        }
      },
      "required": [
        "avatar_url",
        "events_url",
        "followers_url",
        "following_url",
        "gists_url",
        "gravatar_id",
        "html_url",
        "id",
        "node_id",
        "login",
        "organizations_url",
        "received_events_url",
        "repos_url",
        "site_admin",
        "starred_url",
        "subscriptions_url",
        "type",
        "url"
      ]
    },
    "secret-scanning-alert-resolution": {
      "type": [
        "string",
        "null"
      ],
      "description": "**Required when the `state` is `resolved`.** The reason for resolving the alert.",
      "enum": [
        "false_positive",
        "wont_fix",
        "revoked",
        "used_in_tests"
      ]
    },
    "secret-scanning-alert-state": {
      "description": "Sets the state of the secret scanning alert. You must provide `resolution` when you set the state to `resolved`.",
      "type": "string",
      "enum": [
        "open",
        "resolved"
      ]
    }
  }
}