-
Notifications
You must be signed in to change notification settings - Fork 3.1k
ci: validate config and schema files against JSON Schema (#553) #1684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f61def6
ci: validate config and schema files against JSON Schema (#553)
Dongni-Yang e0d189c
fixup: address CodeRabbit review comments
Dongni-Yang d412bcc
fix(schemas): align blueprint policyAddition endpoint with sandbox-po…
Dongni-Yang 9229458
fix(blueprint): use access: full for nim_service local endpoint
Dongni-Yang 5482882
fix(validate-configs): reject flag-like values for --file and --schema
Dongni-Yang 1ccd5e1
fix(validate-configs): harden remaining input boundaries
Dongni-Yang 778b6cb
fix(schema): reject unknown keys in blueprint config
cv 5436118
merge: sync main into schema validation PR
cv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,4 +64,4 @@ components: | |
| endpoints: | ||
| - host: "nim-service.local" | ||
| port: 8000 | ||
| protocol: rest | ||
| access: full | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,172 @@ | ||
| { | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "$id": "https://github.com/NVIDIA/NemoClaw/schemas/blueprint.schema.json", | ||
| "title": "NemoClaw Blueprint", | ||
| "description": "Schema for nemoclaw-blueprint/blueprint.yaml — defines sandbox orchestration, inference profiles, and policy configuration.", | ||
| "type": "object", | ||
| "required": ["version", "profiles", "components"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "version": { | ||
| "type": "string", | ||
| "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$", | ||
| "description": "Semver version of the blueprint." | ||
| }, | ||
| "min_openshell_version": { | ||
| "type": "string", | ||
| "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$", | ||
| "description": "Minimum compatible OpenShell version." | ||
| }, | ||
| "min_openclaw_version": { | ||
| "type": "string", | ||
| "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$", | ||
| "description": "Minimum compatible OpenClaw version." | ||
| }, | ||
| "digest": { | ||
| "type": "string", | ||
| "description": "Computed at release time." | ||
| }, | ||
| "profiles": { | ||
| "type": "array", | ||
| "items": { "type": "string" }, | ||
| "minItems": 1, | ||
| "uniqueItems": true, | ||
| "description": "Declared inference profile names." | ||
| }, | ||
| "description": { | ||
| "type": "string" | ||
| }, | ||
| "components": { | ||
| "type": "object", | ||
| "required": ["sandbox", "inference"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "sandbox": { | ||
| "type": "object", | ||
| "required": ["image", "name"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "image": { | ||
| "type": "string", | ||
| "description": "Container image for the sandbox." | ||
| }, | ||
| "name": { | ||
| "type": "string", | ||
| "description": "Default sandbox name." | ||
| }, | ||
| "forward_ports": { | ||
| "type": "array", | ||
| "items": { "type": "integer", "minimum": 1, "maximum": 65535 } | ||
| } | ||
| } | ||
| }, | ||
| "inference": { | ||
| "type": "object", | ||
| "required": ["profiles"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "profiles": { | ||
| "type": "object", | ||
| "minProperties": 1, | ||
| "additionalProperties": { | ||
| "$ref": "#/$defs/inferenceProfile" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "policy": { | ||
| "type": "object", | ||
| "required": ["base"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "base": { | ||
| "type": "string", | ||
| "description": "Path to the base sandbox policy file." | ||
| }, | ||
| "additions": { | ||
| "type": "object", | ||
| "additionalProperties": { | ||
| "$ref": "#/$defs/policyAddition" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| }, | ||
| "$defs": { | ||
| "inferenceProfile": { | ||
| "type": "object", | ||
| "required": ["provider_type", "endpoint"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "provider_type": { "type": "string" }, | ||
| "provider_name": { "type": "string" }, | ||
| "endpoint": { "type": "string" }, | ||
| "model": { "type": "string" }, | ||
| "credential_env": { "type": "string" }, | ||
| "credential_default": { "type": "string" }, | ||
| "timeout_secs": { "type": "integer", "minimum": 1 }, | ||
| "dynamic_endpoint": { "type": "boolean" } | ||
| } | ||
| }, | ||
| "policyAddition": { | ||
| "type": "object", | ||
| "required": ["name", "endpoints"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "name": { "type": "string" }, | ||
| "endpoints": { | ||
| "type": "array", | ||
| "items": { "$ref": "#/$defs/endpoint" }, | ||
| "minItems": 1 | ||
| } | ||
| } | ||
| }, | ||
| "endpoint": { | ||
| "type": "object", | ||
| "required": ["host", "port"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "host": { "type": "string" }, | ||
| "port": { "type": "integer", "minimum": 1, "maximum": 65535 }, | ||
| "protocol": { "type": "string", "enum": ["rest"] }, | ||
| "enforcement": { "type": "string", "enum": ["enforce", "audit"] }, | ||
| "tls": { "type": "string", "enum": ["terminate", "passthrough"] }, | ||
| "access": { "type": "string", "enum": ["full"] }, | ||
| "rules": { | ||
| "type": "array", | ||
| "items": { "$ref": "#/$defs/rule" }, | ||
| "minItems": 1 | ||
| } | ||
| }, | ||
| "if": { | ||
| "properties": { "protocol": { "const": "rest" } }, | ||
| "required": ["protocol"] | ||
| }, | ||
| "then": { "required": ["rules"] } | ||
| }, | ||
| "rule": { | ||
| "type": "object", | ||
| "required": ["allow"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "allow": { | ||
| "type": "object", | ||
| "required": ["method", "path"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "method": { | ||
| "type": "string", | ||
| "enum": ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"] | ||
| }, | ||
| "path": { | ||
| "type": "string", | ||
| "pattern": "^/" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "$id": "https://github.com/NVIDIA/NemoClaw/schemas/openclaw-plugin.schema.json", | ||
| "title": "NemoClaw OpenClaw Plugin Manifest", | ||
| "description": "Schema for nemoclaw/openclaw.plugin.json — the OpenClaw plugin manifest that declares the plugin identity and its configuration schema.", | ||
| "type": "object", | ||
| "required": ["id", "name", "version", "description", "configSchema"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "id": { | ||
| "type": "string", | ||
| "minLength": 1, | ||
| "description": "Unique plugin identifier." | ||
| }, | ||
| "name": { | ||
| "type": "string", | ||
| "minLength": 1, | ||
| "description": "Human-readable plugin name." | ||
| }, | ||
| "version": { | ||
| "type": "string", | ||
| "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$", | ||
| "description": "Semver version of the plugin." | ||
| }, | ||
| "description": { | ||
| "type": "string", | ||
| "minLength": 1, | ||
| "description": "Short description of the plugin." | ||
| }, | ||
| "configSchema": { | ||
| "type": "object", | ||
| "description": "JSON Schema object describing the plugin's configuration fields." | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| { | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "$id": "https://github.com/NVIDIA/NemoClaw/schemas/policy-preset.schema.json", | ||
| "title": "NemoClaw Policy Preset", | ||
| "description": "Schema for policy presets (nemoclaw-blueprint/policies/presets/*.yaml) — named network policy bundles that can be merged into the base sandbox policy.", | ||
| "type": "object", | ||
| "required": ["preset", "network_policies"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "preset": { | ||
| "type": "object", | ||
| "required": ["name", "description"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "name": { "type": "string", "minLength": 1 }, | ||
| "description": { "type": "string", "minLength": 1 } | ||
| } | ||
| }, | ||
| "network_policies": { | ||
| "type": "object", | ||
| "minProperties": 1, | ||
| "additionalProperties": { | ||
| "$ref": "#/$defs/networkPolicyEntry" | ||
| } | ||
| } | ||
| }, | ||
| "$defs": { | ||
| "networkPolicyEntry": { | ||
| "type": "object", | ||
| "required": ["name", "endpoints"], | ||
| "properties": { | ||
| "name": { "type": "string" }, | ||
| "endpoints": { | ||
| "type": "array", | ||
| "items": { "$ref": "#/$defs/endpoint" }, | ||
| "minItems": 1 | ||
| }, | ||
| "binaries": { | ||
| "type": "array", | ||
| "items": { "$ref": "#/$defs/binary" } | ||
| } | ||
| } | ||
| }, | ||
| "endpoint": { | ||
| "type": "object", | ||
| "required": ["host", "port"], | ||
| "properties": { | ||
| "host": { "type": "string" }, | ||
| "port": { "type": "integer", "minimum": 1, "maximum": 65535 }, | ||
| "protocol": { "type": "string", "enum": ["rest"] }, | ||
| "enforcement": { "type": "string", "enum": ["enforce", "audit"] }, | ||
| "tls": { "type": "string", "enum": ["terminate", "passthrough"] }, | ||
| "access": { "type": "string", "enum": ["full"] }, | ||
| "rules": { | ||
| "type": "array", | ||
| "items": { "$ref": "#/$defs/rule" }, | ||
| "minItems": 1 | ||
| } | ||
| }, | ||
| "if": { | ||
| "properties": { "protocol": { "const": "rest" } }, | ||
| "required": ["protocol"] | ||
| }, | ||
| "then": { "required": ["rules"] } | ||
| }, | ||
| "rule": { | ||
| "type": "object", | ||
| "required": ["allow"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "allow": { | ||
| "type": "object", | ||
| "required": ["method", "path"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "method": { | ||
| "type": "string", | ||
| "enum": ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"] | ||
| }, | ||
| "path": { | ||
| "type": "string", | ||
| "pattern": "^/" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "binary": { | ||
| "type": "object", | ||
| "required": ["path"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "path": { | ||
| "type": "string", | ||
| "pattern": "^/" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.