{"record":{"id":"b684acb7bb1bd192","repo":"rustfs/rustfs","slug":"ops-diagnostics-contract-must-require-an-admin-act","errorCode":null,"errorMessage":"ops diagnostics contract must require an admin action","messagePattern":"ops diagnostics contract must require an admin action","errorType":"validation","errorClass":"ExtensionContractError","httpStatus":null,"severity":"error","filePath":"crates/extension-schema/src/lib.rs","lineNumber":266,"sourceCode":"    #[error(\"s3 hook contract duplicates hook point {hook_point:?}\")]\n    DuplicateS3HookPoint { hook_point: S3HookPoint },\n\n    #[error(\"s3 hook contract cannot mutate object data\")]\n    S3HookMutatesObjectData,\n\n    #[error(\"s3 hook contract cannot bypass IAM\")]\n    S3HookBypassesIam,\n\n    #[error(\"ops diagnostics contract must declare at least one surface\")]\n    EmptyOpsDiagnosticSurfaces,\n\n    #[error(\"ops diagnostics contract duplicates surface {surface:?}\")]\n    DuplicateOpsDiagnosticSurface { surface: OpsDiagnosticSurface },\n\n    #[error(\"ops diagnostics contract cannot mutate object data\")]\n    OpsDiagnosticsMutatesObjectData,\n\n    #[error(\"ops diagnostics contract must require an admin action\")]\n    OpsDiagnosticsMissingAdminAction,\n\n    #[error(\"ops profiler contract must describe capabilities, not execution requests\")]\n    OpsProfilerExecutionRequest,\n\n    #[error(\"ops profiler contract must declare at least one backend\")]\n    EmptyOpsProfilerBackends,\n\n    #[error(\"ops profiler contract has an empty backend name\")]\n    EmptyOpsProfilerBackend,\n\n    #[error(\"ops profiler contract duplicates backend {backend}\")]\n    DuplicateOpsProfilerBackend { backend: String },\n\n    #[error(\"ops profiler backend {backend} duplicates redaction field {field:?}\")]\n    DuplicateOpsProfilerRedactionField {\n        backend: String,\n        field: OpsProfilerRedactionField,","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/rustfs/rustfs/blob/35af688cd9d41b4346fbe27dcf7250ba72046c1f/crates/extension-schema/src/lib.rs#L248-L284","documentation":"Returned by validate_ops_diagnostics_contract (crates/extension-schema/src/lib.rs:423-425) when requires_admin_action is false. Every ops.diagnostics.v1 extension must bind its diagnostics behind an explicit admin action so that exposure stays access-controlled and auditable. A contract that permits non-admin triggering is invalid by definition.","triggerScenarios":"A contract with requires_admin_action: false; a JSON manifest containing \"requires_admin_action\": false.","commonSituations":"A template that defaults boolean flags to false; wanting to expose health checks publicly and flipping this flag instead of using the server's built-in public health endpoints.","solutions":["Set requires_admin_action: true","If a public surface is genuinely needed, expose it through the server's built-in health endpoints rather than the extension","Re-validate the contract"],"exampleFix":"// before\nrequires_admin_action: false\n\n// after\nrequires_admin_action: true","handlingStrategy":"validation","validationCode":"if !contract.requires_admin_action {\n    return Err(manifest_error(\"ops diagnostics must be gated behind an admin action\"));\n}\nvalidate_ops_diagnostics_contract(&contract)?;","typeGuard":"fn is_admin_gated(contract: &OpsDiagnosticsContract) -> bool {\n    contract.requires_admin_action\n}","tryCatchPattern":"match validate_ops_diagnostics_contract(&contract) {\n    Ok(()) => install(contract),\n    Err(ExtensionContractError::OpsDiagnosticsMissingAdminAction) => report_manifest_error(\n        \"set requires_admin_action: true or use built-in public health endpoints\",\n    ),\n    Err(other) => report_manifest_error(other),\n}","preventionTips":["Default admin-gating flags to true in manifest templates","Expose public health through server endpoints, never through diagnostics extensions","Check the flag in code review for observability plugins"],"tags":["rust","rustfs","extension-schema","ops-diagnostics","security","admin-gating","contract-validation"],"backgroundTag":"extension-contract-validation","analyzedSha":"35af688cd9d41b4346fbe27dcf7250ba72046c1f","analyzedAt":"2026-08-20T21:57:04.799Z","contentChangedAt":"2026-08-20T21:57:04.799Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}