Skip to content

Fixes #34566: mask service connections in MCP responses - #35774

Merged
Vishnuujain merged 5 commits into
mainfrom
fix/mcp-mask-service-connection
Oct 22, 2026
Merged

Vishnuujain merged 5 commits into
mainfrom
fix/mcp-mask-service-connection

Conversation

@Vishnuujain

@Vishnuujain Vishnuujain commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #34566

  • MCP reads entities with fields="*", which skips the masking each REST resource applies, so some connection and credential fields came back as stored.
  • McpResponseUtils.maskSecrets now masks them in one place, with the masker REST uses, for every caller: service connections, ingestion pipeline source config, automations workflow requests and alert webhook auth. A user's authenticationMechanism is left out of MCP responses, and get_entity hides a user's email from callers without PII access, as REST does.
  • patch_entity no longer reaches a service's /connection; connection changes go through the service's REST API.

Type of change:

  • Bug fix

Tests:

Unit tests

  • McpResponseUtilsTest, GetEntityToolTest, PatchEntityToolTest: the new cases fail without the change, plus one allowed service patch so the guard cannot over-block.
  • org.openmetadata.mcp.tools unit tests: 473/473 pass. Coverage not measured.

Backend integration tests

  • McpIntegrationIT.testGetEntityDetailsMasksServiceConnectionPassword and testPatchEntityOnServiceSavesTheDescriptionAndLeavesTheConnection (a /description patch saves, a /connection patch is refused and the connection is unchanged): compiled locally, not run.

Manual testing performed

  • Local server built from this branch, logged in as a non-admin user: MCP get_entity on a database service and on users returns the masked fields, matching REST.
  • patch_entity on a service's /connection is refused and the stored service is unchanged.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #34566 above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill runs it) and fixed every 🔴 finding, or answered it on the line below.
    • Reviewed 25222125412 and ba01fccdb1f. Fixed the stated reason for the patch guard, a comment that claimed more than the code masked, and the other entity types. One finding is outside this PR and is tracked separately. 0c180ca0d45 (alert webhooks, wording) was not re-reviewed.
  • Decision check: ADR:2026-10-20-mcp-responses-mask-stored-credentials.
  • I have added a test that covers the exact scenario we are fixing.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issues were found.

Summary

MCP responses now hide stored credentials across services, ingestion pipelines, workflows, alerts, and users.

  • MCP entity responses and change events hide stored credentials.
  • User details hide email when the caller lacks PII access.
  • MCP refuses service patches that reach the connection.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[MCP entity read] --> B[Read stored entity]
  B --> C[maskSecrets]
  C --> D[Copy and hide credentials]
  D --> E[Hide user email when required]
  E --> F[MCP response]
  G[Service patch] --> H{path or from reaches connection or root?}
  H -->|Yes| I[Reject without writing]
  H -->|No| J[Repository patch]
  J --> C
Loading

Reviews (3) · Last reviewed commit: "Merge branch 'main' into fix/mcp-mask-se..." · Reviewed by Greptile

@github-actions github-actions Bot added the safe to test Add this label to run secure Github workflows on PRs label Oct 19, 2026
@Vishnuujain Vishnuujain self-assigned this Oct 19, 2026
@pmbrull
pmbrull added this pull request to the merge queue Oct 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-10-20T08:18:30Z)

Blocked the queue: integration-tests-mysql-elasticsearch, integration-tests-postgres-opensearch

@Vishnuujain
Vishnuujain added this pull request to the merge queue Oct 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-10-20T12:41:00Z)

Blocked the queue: playwright-summary

Failed Playwright tests:

  • Flow/NotificationAlerts.spec.ts › Multiple Filters Alert

@Vishnuujain
Vishnuujain enabled auto-merge October 21, 2026 21:13
@gitar-bot

gitar-bot Bot commented Oct 21, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🔴 High risk · Masking stored credentials and PII across MCP reads while blocking service-connection patches changes sensitive data access; masking gaps could expose secrets.

Masks stored service connection, pipeline source config, workflow request, alert webhook auth, and user credential fields in MCP responses via McpResponseUtils.maskSecrets, and blocks patch_entity from reaching a service's /connection. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@Vishnuujain
Vishnuujain added this pull request to the merge queue Oct 21, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-10-22T01:27:52Z)

Blocked the queue: integration-tests-mysql-elasticsearch

@Vishnuujain
Vishnuujain added this pull request to the merge queue Oct 22, 2026
Merged via the queue into main with commit ec5752d Oct 22, 2026
89 checks passed
@Vishnuujain
Vishnuujain deleted the fix/mcp-mask-service-connection branch October 22, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP getEntity returns a service connection unmasked

2 participants