Skip to content

feat(plugins): add plugin manifest schema and validator - #1725

Open
developerkunal wants to merge 9 commits into
betafrom
DXCDT-2601/manifest-schema
Open

developerkunal wants to merge 9 commits into
betafrom
DXCDT-2601/manifest-schema

Conversation

@developerkunal

@developerkunal developerkunal commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🔧 Changes

Adds the new internal/plugins package, which defines the plugin.json manifest that Auth0 CLI plugins ship with. The CLI, the plugin catalog and the future plugin dev validate command share this one contract. This is a library only, with no commands, flags or files on disk yet. The engines.auth0-cli constraint is only checked for grammar here, not evaluated.

  • Schema. schema/plugin.schema.json is a JSON Schema (draft 2020-12) that rejects unknown properties and is embedded in the binary. It is compiled with santhosh-tekuri/jsonschema/v6, which moves from an indirect to a direct dependency.
  • Strict parsing. ParseManifest is for authors and the catalog. It rejects unknown fields and any apiVersion other than 1, then runs the checks JSON Schema cannot express, such as positive timeouts, unique command and flag names, reserved flag names, and environment variable names that start with AUTH0_PLUGIN_ or AUTH0_CLI_. Every problem comes back with its JSON path.
  • Runtime parsing. ParseInstalledManifest is for a manifest that is already installed. It ignores unknown fields elsewhere so a slightly newer plugin still runs on an older CLI. It fails closed in two places: an unknown field inside permissions is rejected, and so is an apiVersion greater than 1. A permission this CLI does not understand must never be silently ignored, so both errors say the plugin needs a newer CLI.
  • Consent hash. PermissionsHash() returns a SHA-256 over a canonical JSON document of scopes, hosts, files, env and each command's interactive value. Reasons are part of the hash on purpose, so a changed reason or a flipped interactive value asks for consent again. The canonical JSON is written by hand so the bytes do not depend on the Go version, and testdata/consent-hash-vectors.json holds vectors for the catalog pipeline to reuse.
  • Output safety. SafeText replaces control, format and separator characters with U+FFFD, so text from a plugin can be printed without driving the terminal or hiding content.

📚 References

DXCDT-2601. This is the first PR of the plugin framework stack of 11 PRs, so it is the base and builds on no other PR.

🔬 Testing

The new code is covered by unit tests.

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

@developerkunal
developerkunal requested a review from a team as a code owner October 24, 2026 14:46
@developerkunal
developerkunal force-pushed the DXCDT-2601/manifest-schema branch from f5112f8 to 1e522be Compare October 24, 2026 15:30
@developerkunal
developerkunal force-pushed the DXCDT-2601/manifest-schema branch from 1e522be to 2b8b8dc Compare November 2, 2026 11:12
@developerkunal
developerkunal force-pushed the DXCDT-2601/manifest-schema branch 2 times, most recently from e9713b0 to 3432b94 Compare November 24, 2026 12:02
@bkiran6398
bkiran6398 force-pushed the DXCDT-2601/manifest-schema branch from 3432b94 to d95fe92 Compare November 27, 2026 06:23
Define the plugin.json manifest as an embedded JSON Schema and validate it
in Go so the CLI, the plugin catalog and `plugin dev validate` share one
contract.

- Strict ParseManifest for authors and the catalog, and a runtime
  ParseInstalledManifest that tolerates unknown fields but fails closed on
  unknown permission fields and newer API versions. A permissions list that
  the manifest leaves out counts as empty.
- Typed Platform, FlagType and FileAccess, with OS, Arch and Libc helpers for
  matching release artifacts.
- A permissions union and a consent hash covering scopes, hosts, files, env
  and each command's interactive value. The canonical JSON is written by hand
  and hashed text cannot contain control characters, so other languages
  produce the same bytes. Test vectors are published for the catalog pipeline.
- Reserved flag, shorthand and environment variable names.
@developerkunal
developerkunal removed this pull request from stack #1736 November 30, 2026 17:24
@developerkunal
developerkunal changed the base branch from main to beta November 30, 2026 17:24
@developerkunal
developerkunal force-pushed the DXCDT-2601/manifest-schema branch from d95fe92 to 76ae442 Compare November 30, 2026 17:24
@developerkunal
developerkunal changed the base branch from beta to main November 30, 2026 17:25
@developerkunal
developerkunal removed this pull request from stack #1792 November 30, 2026 17:27
@developerkunal
developerkunal changed the base branch from main to beta November 30, 2026 17:27
A permissions.scopes entry is now an object with a name, a required
reason and an optional flag instead of a plain string. Scope names must
be unique within a command. The union keeps one entry per distinct
name, reason and optional value, and the consent hash covers all three
keys, so a changed reason or a flipped optional asks for consent again.

Free text in the manifest is tightened as well. Control, format, line
separator and paragraph separator characters are rejected, which are the
characters the CLI replaces when it prints plugin text, and descriptions,
team, reasons and file paths have length limits.
A plugin flag can now declare a default, an enum of allowed values and
required in plugin.json. They are metadata that the CLI shows in help,
completion and the agent schema, and plugin dev validate checks them.
Nothing validates user input against them.

The manifest checks that a default and every enum value fit the flag
type, that a default is one of the enum values, that a bool flag has no
enum and is not required, that a stringArray flag has no default, and
that a required flag has no default. Flags stay out of the consent hash.
A command can list the exit codes it returns, each with a code from 1 to 255 and a short meaning. The codes must be unique within a command. They are documentation only: they do not decide whether the plugin's exit code is passed on and they are not part of the consent hash.
An engines.auth0-cli comparator can now carry a semver prerelease, such as
>=1.41.0-beta.3. A plain comparator such as >=1.41.0 still compares only
MAJOR.MINOR.PATCH, so a beta build of 1.41.0 satisfies it. A comparator with
a prerelease compares the full version including the prerelease. Build
metadata stays rejected.
A command name can now have one to three words separated by a single space, such as "scan secrets". The command list stays flat, so each entry keeps its own flags, permissions and consent settings, and full names stay unique. Adds consent hash vectors for nested names.
…d flag number rules

URLs in homepage and owner.bugs now have to be printable ASCII with an https
prefix, a host and at most 2048 characters, and $schema gets the same length
limit and the free text rules, so none of them can carry terminal escape
sequences, bidirectional controls or zero width characters.

Free text now needs at least one character that is not a space separator, so
a reason cannot be made only of spaces. Int and float flag values must use the
plain decimal forms that every language parses the same way, and enum values
that are the same number written differently are reported as duplicates.

Document that the consent hash sorts by UTF-8 bytes rather than UTF-16 code
units and add a vector where the two orders disagree.
A command can list response fields under permissions.secrets, each a secret path with a reason, that the plugin proxy would otherwise remove. The list is experimental, holds up to 10 paths per command and is part of the consent hash only when a command asks for a secret, so the hash of every manifest without secrets stays the same.
A name in a permissions.secrets path holds only ASCII letters, digits, underscores and hyphens, so two paths that look the same on the consent screen are the same path for the proxy.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant