Skip to content

Commit

Permalink
feat(core): add a schema for policy files
Browse files Browse the repository at this point in the history
  • Loading branch information
boneskull committed Jul 13, 2023
1 parent 23e4837 commit d668540
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions packages/core/schema/lavamoat-policy.v0-0-1.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "LavaMoat Policy Schema",
"type": "object",
"$id": "lavamoat-policy.v0-0-1",
"properties": {
"resources": {
"type": "object",
"$comment": "This one or more valid npm package names delimited by a \">\" character, or the special case \"<root>\"",
"properties": {
"<root>": {
"$ref": "#/$defs/resourcePolicy"
}
},
"patternProperties": {
"^(@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*(>(@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*)*$": {
"$ref": "#/$defs/resourcePolicy"
}
},
"allowAdditionalProperties": false
}
},
"required": ["resources"],
"$defs": {
"resourcePolicy": {
"type": "object",
"minProperties": 1,
"properties": {
"globals": {
"type": "object",
"$comment": "A global property key can be any string (accessible via bracket notation)",
"additionalProperties": {
"type": "string"
}
},
"packages": {
"type": "object",
"$comment": "This one or more valid npm package names delimited by a \">\" character",
"patternProperties": {
"^(@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*(>(@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*)*$": {
"type": "boolean"
}
},
"allowAdditionalProperties": false
}
},
"allowAdditionalProperties": false
}
}
}

0 comments on commit d668540

Please sign in to comment.