# io.atcr.hold.subscribeScanJobs

> Subscribe to vulnerability scan jobs via WebSocket. Scanners connect to receive pending scan jobs and send back results. Authenticated via shared secret (query parameter or X-Scanner-Secret header).

- Kind: subscription
- Authority: hold.atcr.io
- Lexicon: 1
- Published by [did:web:lexicon.atcr.io](https://lexicon.garden/identity/did:web:lexicon.atcr.io), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:web:lexicon.atcr.io/io.atcr.hold.subscribeScanJobs)
- [Schema JSON](https://lexicon.garden/lexicon/did:web:lexicon.atcr.io/io.atcr.hold.subscribeScanJobs/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:web:lexicon.atcr.io/io.atcr.hold.subscribeScanJobs/analytics)

## Subscription (`io.atcr.hold.subscribeScanJobs`)

Type: subscription · WebSocket

### Parameters (query string)

- `cursor` (integer): Sequence number to resume from. If omitted, starts from latest. Use -1 to receive only new jobs.
- `instance` (string): Stable identity of the scanner process, sent on every connect. A scanner that reconnects with the same value resumes the jobs it was holding when the connection dropped, instead of having them offered to another scanner. Omitted means the hold assigns a per-connection identity and the scanner's in-flight work is reclaimed rather than resumed.
  - Constraints: maxLength: 64
- `workers` (integer): How many scans this scanner runs concurrently. The hold keeps this many jobs in flight for the connection. Omitted or unusable means one.
  - Constraints: minimum: 1, maximum: 32

### Messages (DAG-CBOR frames)

- `#scanJob` (object): A scan job dispatched from hold to scanner. Sent as a JSON WebSocket message.
- `#scanResult` (object): A scan result sent from scanner back to hold. Sent as a JSON WebSocket message.

### Errors

- `InvalidSecret`: Scanner shared secret is invalid

## #scanJob (`io.atcr.hold.subscribeScanJobs#scanJob`)

Type: object

A scan job dispatched from hold to scanner. Sent as a JSON WebSocket message.

### Properties

- `digest` (string, required): Manifest digest (e.g., sha256:abc123...)
  - Constraints: maxLength: 128
- `holdDid` (string · did, required): DID of the hold where the image is stored
- `holdEndpoint` (string · uri, required): HTTP endpoint of the hold for blob downloads
- `priority` (integer): Scan priority (lower = higher priority). Tier-based scheduling.
- `repository` (string, required): Repository name (e.g., myapp)
  - Constraints: maxLength: 256
- `seq` (integer, required): Monotonic sequence number for cursor-based resumption
- `tag` (string): Optional tag that triggered the scan
  - Constraints: maxLength: 256
- `type` (string, required): Message type discriminator
  - Constraints: maxLength: 32, const: "scan_job"
- `userDid` (string · did, required): DID of the image owner

## #scanResult (`io.atcr.hold.subscribeScanJobs#scanResult`)

Type: object

A scan result sent from scanner back to hold. Sent as a JSON WebSocket message.

### Properties

- `digest` (string, required): Manifest digest that was scanned
  - Constraints: maxLength: 128
- `error` (string): Error message if scan failed
  - Constraints: maxLength: 1024
- `sbom` (bytes): SBOM blob (SPDX JSON format, max 100MB)
  - Constraints: maxLength: 104857600
- `scannerVersion` (string): Scanner version string
  - Constraints: maxLength: 64
- `summary` (ref, required): Vulnerability count summary
  - Reference: `#vulnSummary`
- `type` (string, required): Message type discriminator
  - Constraints: maxLength: 32, const: "scan_result"
- `vulnReport` (bytes): Grype vulnerability report blob (JSON, max 100MB)
  - Constraints: maxLength: 104857600

## #vulnSummary (`io.atcr.hold.subscribeScanJobs#vulnSummary`)

Type: object

### Properties

- `critical` (integer, required): Count of critical severity vulnerabilities
  - Constraints: minimum: 0
- `high` (integer, required): Count of high severity vulnerabilities
  - Constraints: minimum: 0
- `low` (integer, required): Count of low severity vulnerabilities
  - Constraints: minimum: 0
- `medium` (integer, required): Count of medium severity vulnerabilities
  - Constraints: minimum: 0
- `total` (integer, required): Total vulnerability count
  - Constraints: minimum: 0

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Subscribe to vulnerability scan jobs via WebSocket. Scanners connect to receive pending scan jobs and send back results. Authenticated via shared secret (query parameter or X-Scanner-Secret header).",
      "errors": [
        {
          "description": "Scanner shared secret is invalid",
          "name": "InvalidSecret"
        }
      ],
      "message": {
        "schema": {
          "refs": [
            "#scanJob",
            "#scanResult"
          ],
          "type": "union"
        }
      },
      "parameters": {
        "properties": {
          "cursor": {
            "description": "Sequence number to resume from. If omitted, starts from latest. Use -1 to receive only new jobs.",
            "type": "integer"
          },
          "instance": {
            "description": "Stable identity of the scanner process, sent on every connect. A scanner that reconnects with the same value resumes the jobs it was holding when the connection dropped, instead of having them offered to another scanner. Omitted means the hold assigns a per-connection identity and the scanner's in-flight work is reclaimed rather than resumed.",
            "maxLength": 64,
            "type": "string"
          },
          "workers": {
            "description": "How many scans this scanner runs concurrently. The hold keeps this many jobs in flight for the connection. Omitted or unusable means one.",
            "maximum": 32,
            "minimum": 1,
            "type": "integer"
          }
        },
        "type": "params"
      },
      "type": "subscription"
    },
    "scanJob": {
      "description": "A scan job dispatched from hold to scanner. Sent as a JSON WebSocket message.",
      "properties": {
        "digest": {
          "description": "Manifest digest (e.g., sha256:abc123...)",
          "maxLength": 128,
          "type": "string"
        },
        "holdDid": {
          "description": "DID of the hold where the image is stored",
          "format": "did",
          "type": "string"
        },
        "holdEndpoint": {
          "description": "HTTP endpoint of the hold for blob downloads",
          "format": "uri",
          "type": "string"
        },
        "priority": {
          "description": "Scan priority (lower = higher priority). Tier-based scheduling.",
          "type": "integer"
        },
        "repository": {
          "description": "Repository name (e.g., myapp)",
          "maxLength": 256,
          "type": "string"
        },
        "seq": {
          "description": "Monotonic sequence number for cursor-based resumption",
          "type": "integer"
        },
        "tag": {
          "description": "Optional tag that triggered the scan",
          "maxLength": 256,
          "type": "string"
        },
        "type": {
          "const": "scan_job",
          "description": "Message type discriminator",
          "maxLength": 32,
          "type": "string"
        },
        "userDid": {
          "description": "DID of the image owner",
          "format": "did",
          "type": "string"
        }
      },
      "required": [
        "type",
        "seq",
        "digest",
        "repository",
        "userDid",
        "holdDid",
        "holdEndpoint"
      ],
      "type": "object"
    },
    "scanResult": {
      "description": "A scan result sent from scanner back to hold. Sent as a JSON WebSocket message.",
      "properties": {
        "digest": {
          "description": "Manifest digest that was scanned",
          "maxLength": 128,
          "type": "string"
        },
        "error": {
          "description": "Error message if scan failed",
          "maxLength": 1024,
          "type": "string"
        },
        "sbom": {
          "description": "SBOM blob (SPDX JSON format, max 100MB)",
          "maxLength": 104857600,
          "type": "bytes"
        },
        "scannerVersion": {
          "description": "Scanner version string",
          "maxLength": 64,
          "type": "string"
        },
        "summary": {
          "description": "Vulnerability count summary",
          "ref": "#vulnSummary",
          "type": "ref"
        },
        "type": {
          "const": "scan_result",
          "description": "Message type discriminator",
          "maxLength": 32,
          "type": "string"
        },
        "vulnReport": {
          "description": "Grype vulnerability report blob (JSON, max 100MB)",
          "maxLength": 104857600,
          "type": "bytes"
        }
      },
      "required": [
        "type",
        "digest",
        "summary"
      ],
      "type": "object"
    },
    "vulnSummary": {
      "properties": {
        "critical": {
          "description": "Count of critical severity vulnerabilities",
          "minimum": 0,
          "type": "integer"
        },
        "high": {
          "description": "Count of high severity vulnerabilities",
          "minimum": 0,
          "type": "integer"
        },
        "low": {
          "description": "Count of low severity vulnerabilities",
          "minimum": 0,
          "type": "integer"
        },
        "medium": {
          "description": "Count of medium severity vulnerabilities",
          "minimum": 0,
          "type": "integer"
        },
        "total": {
          "description": "Total vulnerability count",
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "critical",
        "high",
        "medium",
        "low",
        "total"
      ],
      "type": "object"
    }
  },
  "id": "io.atcr.hold.subscribeScanJobs",
  "lexicon": 1
}
```
