{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://auditstatus.com/schema/attester.schema.json",
  "title": "Audit Status attester configuration",
  "description": "The attester configuration, /etc/auditstatus/config.yml on each server. Generated from lib/config.js. See https://auditstatus.com/docs/configuration/#attester-configuration",
  "type": "object",
  "properties": {
    "version": {
      "enum": [
        2,
        null
      ]
    },
    "projectRoot": {
      "type": [
        "string",
        "null"
      ],
      "minLength": 1
    },
    "exclude": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "processes": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "user": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "pattern": "^[a-z_][\\w-]{0,31}$"
        },
        "uid": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 4294967294
        },
        "cwdPrefix": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1
        },
        "inspectorPorts": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65535
          }
        }
      },
      "additionalProperties": false
    },
    "packages": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "enabled": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "globalDir": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1
        },
        "globalPackages": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "additionalProperties": false
    },
    "services": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "pattern": "^[\\w.-]{1,64}$"
          },
          "root": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1
          },
          "user": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "pattern": "^[a-z_][\\w-]{0,31}$"
          },
          "uid": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 4294967294
          },
          "cwd": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1
          },
          "exclude": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "ecosystems": {
            "anyOf": [
              {
                "description": "auto, false, or a list of ecosystems to check",
                "anyOf": [
                  {
                    "const": "auto"
                  },
                  {
                    "const": false
                  },
                  {
                    "type": "array",
                    "items": {
                      "enum": [
                        "npm",
                        "pypi",
                        "rubygems",
                        "hex",
                        "composer",
                        "maven",
                        "nuget"
                      ]
                    }
                  }
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "installs": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object",
              "properties": {
                "ecosystem": {
                  "enum": [
                    "npm",
                    "pypi",
                    "rubygems",
                    "hex",
                    "composer",
                    "maven",
                    "nuget"
                  ]
                },
                "dir": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "ecosystem",
                "dir"
              ],
              "additionalProperties": false
            }
          },
          "container": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 1,
                "pattern": "^[\\w.-]{1,128}$"
              },
              "id": {
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 1,
                "pattern": "^[\\da-f]{12,64}$"
              },
              "image": {
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 1
              },
              "label": {
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 1,
                "pattern": "^[\\w./-]+=\\S*$"
              }
            },
            "additionalProperties": false,
            "anyOf": [
              {
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  }
                }
              },
              {
                "required": [
                  "id"
                ],
                "properties": {
                  "id": {
                    "type": "string"
                  }
                }
              },
              {
                "required": [
                  "image"
                ],
                "properties": {
                  "image": {
                    "type": "string"
                  }
                }
              },
              {
                "required": [
                  "label"
                ],
                "properties": {
                  "label": {
                    "type": "string"
                  }
                }
              }
            ]
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false,
        "oneOf": [
          {
            "required": [
              "root"
            ],
            "properties": {
              "root": {
                "type": "string"
              }
            }
          },
          {
            "required": [
              "container"
            ],
            "properties": {
              "container": {
                "type": "object"
              }
            }
          }
        ]
      }
    },
    "runtimes": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "debugPorts": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65535
          }
        },
        "node": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "globalDir": {
              "type": [
                "string",
                "null"
              ],
              "minLength": 1
            },
            "globalPackages": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "type": "string",
                "minLength": 1
              }
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "distro": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "enabled": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "root": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "pattern": "^\\/"
        }
      },
      "additionalProperties": false
    },
    "containers": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "dockerSocket": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1
        },
        "podmanSocket": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1
        },
        "crictl": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1
        },
        "hashRootfs": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "maxFiles": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1,
          "maximum": 10000000
        }
      },
      "additionalProperties": false
    },
    "tpm": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "enabled": {
          "enum": [
            "auto",
            true,
            false,
            null
          ]
        },
        "tcti": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1
        },
        "handle": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "pattern": "^0x81[\\da-fA-F]{6}$"
        },
        "bank": {
          "enum": [
            "sha1",
            "sha256",
            "sha384",
            "sha512",
            null
          ]
        },
        "pcrs": {
          "type": [
            "array",
            "null"
          ],
          "minItems": 1,
          "items": {
            "type": "integer",
            "minimum": 0,
            "maximum": 23
          }
        },
        "ekAlgorithm": {
          "enum": [
            "rsa",
            "ecc",
            null
          ]
        }
      },
      "additionalProperties": false
    },
    "ima": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "enabled": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "log": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1
        },
        "maxBytes": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1024,
          "maximum": 536870912
        }
      },
      "additionalProperties": false
    },
    "confidential": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "enabled": {
          "enum": [
            "auto",
            true,
            false,
            null
          ]
        },
        "entry": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "monitor": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "enabled": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "log": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1
        },
        "windowSeconds": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 60,
          "maximum": 2592000
        }
      },
      "additionalProperties": false
    },
    "limits": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "maxFiles": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1,
          "maximum": 10000000
        },
        "maxChangedFiles": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 100000
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false,
  "anyOf": [
    {
      "required": [
        "services"
      ],
      "properties": {
        "services": {
          "type": "array"
        },
        "projectRoot": {
          "type": "null"
        },
        "processes": {
          "type": "null"
        },
        "exclude": {
          "type": "null"
        }
      }
    },
    {
      "required": [
        "projectRoot"
      ],
      "properties": {
        "projectRoot": {
          "type": "string"
        },
        "services": {
          "type": "null"
        }
      }
    }
  ]
}
