Files
MikrotikManager/docs/mcp-ui2-database-artifact-mounted-proposal-20261101.md
T

4.5 KiB

Next UI-2 proposal: genuine database artifact -> mounted UI download -> scope revoke

PROPOSAL ONLY. No code, runner, server/browser/PG/native process or test starts are authorized by this document. Logs one-case acceptance is saved separately; no parent closes here.

Choose one supported existing producer: database.backup, entirely on an owned empty PostgreSQL fixture with synthetic data. Its actual mm_database_backup_plan -> human approval -> one apply executes the real bounded pg_dump/encryption/artifact publication path. No RouterOS/PKI/service configuration change is needed. Do not synthesize an applied operation, artifact bytes, receipt or SQL row; use real store/runtime/crypto and producer-generated receipt.

Actual supported UI path exists: current /mcp operation detail -> ArtifactDownloads (components/mcp/artifact-downloads.tsx) -> mcpApi.downloadArtifact -> downloadHumanArtifact -> real GET /api/mcp/artifacts/:id. Operations endpoint projects genuine receipts only for verified applied database-backup steps, owner and current authorization (human-artifact-receipts.ts). This excludes logs.export as a shortcut: current ArtifactDownloads projection does not support that artifact kind.

One proposed journey

  1. Create one genuine own database-backup artifact using existing approved runtime/API flow. Producer executes once; record actual pg_dump child start/exit count, operation/step IDs/state, artifact bytes/SHA metadata. No binary, credential, JWT, SQL payload or dump content in evidence.
  2. Mount the actual current Next /mcp UI against that actual backend. Use a genuine signed synthetic-issuer owner JWT, not unsigned claims or API mocks. Serve isolated source-pinned frontend output without copying .env*/real credentials, and allow browser traffic only to owned frontend/backend. Open the real applied operation and its actual receipt; click Скачать файл. Real browser download bytes/SHA must match the producer's signed receipt; UI correctly says only that the file was handed to the browser.
  3. Keep that operation detail open, and narrow the same connection through the real owner API: remove delegated mm:settings:admin, retain a harmless allowed permission such as mm:mcp:read. Keep owner browser JWT valid. Then click the still-mounted receipt's download button again. This is actual stored-source permission revocation, not forged expiry or changing a receipt.
  4. Source predicts 403 PERMISSION_DENIED: humanDatabaseBackupMetadata checks owner/UI role, then readDatabaseBackupSource rejects the delegated permission before payload read/decryption. humanArtifactError(403) renders the fixed sanitized revoked/foreign-file explanation. Expect no second browser download, no old-success status carried over, no raw server body/filename/secret rendered, and unchanged original applied operation/verified receipt. pg_dump/service execution count stays one; no extra prepare/apply or operation is created by either download attempt.

Use permission narrowing deliberately: fully revoking the MCP bearer currently propagates401 from effectiveMcpConnection, and frontend requestBlob's normal401 flow can redirect to portal. That is a separate auth/navigation journey; do not turn it into a local artifact403 assertion or change bridge/UI behavior for this test.

Terminal and boundaries

One actual mounted-component/browser journey passes only with genuine producer/receipt + successful hash-matched real download + actual revoked-source403 shown by current UI + no second download/producer execution. Verify native pg_dump, backend/frontend/browser and ownPG real exits/cleanup before deleting owned paths. No API route fulfillment, mocked permission/pool/crypto/action, fake applied state, private SDK hook or modified product behavior.

Expiry is not included: real database artifact TTL is900 seconds and its expiry metadata is signed. Do not edit signed rows/global clock or fabricate a producer to claim natural expiry. Unknown/reconcile after a configuration mutation is also not included; this journey proves no replay of a read-only artifact producer on UI downloads, not a native mutation outcome. Existing isolated Artifact UI11 and real backend backup/artifact receipts remain historical component proofs, not this mounted real-backend acceptance.

After root selects this scope, the next deliverable is a concrete staged fixture/lifecycle/source-pinned runner for review before any build/server/browser/PG/pg_dump run. Live portal account/sender, Inspector/external clients, full UI-1/UI-2 and whole-installation RAM remain open.