/** * Plugin install trust policy (#3557). * * `plugins install --verify` used to be parsed and never read, and a plugin's * declared `trustLevel`/`permissions` were neither recorded nor enforced. * These pure helpers decide what an install may register. */ /** * Permissions a plugin may declare and still have its hooks and commands * registered without `--trust`. Anything else (filesystem, network, shell, * secrets, config, privileged, …) needs an explicit `--trust`. */ export declare const DEFAULT_PLUGIN_PERMISSIONS: readonly string[]; /** Trust levels that are withheld unless the user passes `--trust`. */ export declare const UNTRUSTED_TRUST_LEVELS: readonly string[]; /** Registry trust levels that the registry itself vouches for. */ export declare const REGISTRY_VOUCHED_TRUST_LEVELS: readonly string[]; export interface DeclaredTrust { trustLevel?: string; permissions: string[]; } export interface TrustDecision { /** Hooks and commands may be registered. */ allowed: boolean; /** Verification was skipped with `--no-verify`. */ verificationSkipped: boolean; /** Why registration was withheld (empty when allowed). */ reasons: string[]; /** Declared permissions outside {@link DEFAULT_PLUGIN_PERMISSIONS}. */ excessPermissions: string[]; } export interface TrustOptions { /** `--verify` (default true). */ verify: boolean; /** `--trust` (default false). */ trust: boolean; /** Trust level from a registry entry, when the plugin was found there. */ registryTrustLevel?: string; } /** * Read the trust declaration from a plugin's package.json. The `claude-flow` * block wins; top-level fields are accepted as a fallback. */ export declare function readDeclaredTrust(pkg: Record): DeclaredTrust; /** Decide whether an install may register the plugin's hooks and commands. */ export declare function evaluatePluginTrust(declared: DeclaredTrust, opts: TrustOptions): TrustDecision; /** * Whether npm may run the package's lifecycle scripts (preinstall/install/ * postinstall, and those of its dependencies). Scripts execute before the * package's own trust declaration can be read, so only an explicit `--trust` * or a registry-vouched entry allows them; everything else installs with * `--ignore-scripts`. */ export declare function shouldRunInstallScripts(opts: { trust?: boolean; registryTrustLevel?: string; }): boolean; /** A registry checksum we can actually verify: `sha256:` + 64 hex chars. */ export declare function parseSha256Checksum(checksum: unknown): string | null; export declare function sha256Hex(data: Buffer): string; //# sourceMappingURL=trust-policy.d.ts.map