Security & stability hardening, MCP annotations, label/DLP completeness, Azure Functions host#7
Open
Sealjay wants to merge 2 commits into
Open
Security & stability hardening, MCP annotations, label/DLP completeness, Azure Functions host#7Sealjay wants to merge 2 commits into
Sealjay wants to merge 2 commits into
Conversation
Ran on every push/PR but never found a TODO/FIXME marker or opened an issue in this repo's history — dead weight. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Bw6YFkqeMH2cYtukzSQDu
…host Security & stability (review-driven): - PowerShell bridge: request-scoped frame markers (stale/timed-out output can never be mis-attributed to a later call; marker-lookalike tenant data cannot spoof a frame), child killed on timeout so the session never wedges, stdin error handling (no crash on pwsh death), single-flight connect (no double interactive sign-in on concurrent first use). - Windows-only platform gate with a clear error for the IPPS plane (Microsoft does not support Security & Compliance PowerShell on macOS/Linux); PURVIEW_ALLOW_UNSUPPORTED_OS=1 escape hatch. Graph label reads unaffected. - Graph: @odata.nextLink pagination (no silent truncation on large tenants). - Certificate app-only auth on both planes (Graph ClientCertificateCredential + tenant-wide path; Connect-IPPSSession -AppId/-Certificate*/-Organization) for headless/unattended hosts. MCP quality: - All 26 tools now declare annotations (title, readOnlyHint, destructiveHint, idempotentHint, openWorldHint) per the tool-definition-quality rubric. - Unknown prompt/resource names return InvalidParams instead of InternalError. - advanced_settings schemas document common keys and string-typed values. Completeness (labels + DLP): - New list_label_policies / get_label_policy read-back (Get-LabelPolicy). - get_sensitivity_label include_protection_settings reads back the encryption/marking/container/Teams settings the write tools set. - set_dlp_policy add_locations/remove_locations (Exchange, SharePoint, OneDrive, Teams, Endpoint); create_dlp_policy teams_location. - set_dlp_rule handles endpoint_restrictions and SIT condition changes. - Endpoint restrictions aligned to the documented EndpointDlpRestrictions settings (CopyPaste et al; undocumented PasteToBrowser/Bluetooth/RDS removed — browser/AI-site control is portal-side sensitive service domains); Block/Warn now require notify_user, enforced client-side. - Copilot location GUID + ExcludeContentProcessing confirmed against the New-DlpCompliancePolicy/-Rule references; label conditions now surface in rule list/detail output. Hosting: - Azure Functions custom-handler host (stateless streamable HTTP, per-request server instances) alongside the unchanged stdio entry point; Containerfile for full-surface container plans; smoke-tested end-to-end in CI. - CI workflow: npm test on ubuntu/windows x node 20/22. Tests: 180 passing (was 158), including stale-frame, timeout-reset, process-death, connect-dedup, platform-gate, pagination, annotation, and HTTP-host coverage. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H9bG3RxF9V4ooiVvSCbT4D
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Multi-model review (opus/sonnet/haiku research + review agents, adversarially verified, synthesised by fable) of the ground-up rebuild, followed by the fixes. Priority order: security & stability first, then feature completeness. 180 tests passing (was 158). The user-visible stdio behaviour is unchanged; the repo now also deploys to Azure Functions.
Security & stability
@@PVW_<uuid>_START/END@@). Before: a timed-out cmdlet's late output was consumed as the next request's response — wrong data returned to the wrong tool call; tenant data containing the literal marker string could also corrupt or spoof a frame. Neither is possible now.stdinnow has an error handler and writes are guarded (an EPIPE previously killed the whole MCP server); in-flight requests reject promptly on process exit instead of hanging until timeout.Connect-IPPSSessionsign-ins; now deduplicated behind one promise.PURVIEW_ALLOW_UNSUPPORTED_OS=1skips the gate). Graph label reads still work everywhere. This, plus the WAM window-handle failure the existing-DisableWAMdefault already handles, accounts for the DLP auth grief.list_sensitivity_labelsfollows@odata.nextLink— large tenants were silently truncated to the first page.ClientCertificateCredential+ tenant-wide path;Connect-IPPSSession -AppId/-Certificate*/-Organization) — Microsoft's recommended fix for unattended use, and required for remote hosting. Documented in the README, including required app permissions (InformationProtectionPolicy.Read.All,Exchange.ManageAsApp) and role assignment.MCP tool quality (glama tool-definition-quality-score rubric)
title,readOnlyHint,destructiveHint,idempotentHint,openWorldHint— consistently by verb class (list/get, create, set, remove), so hosts can gate destructive calls. Enforced by a test.InvalidParamsrather thanInternalError.advanced_settingsschemas document the common keys (Mandatory,DefaultLabelId, …) and the string-typed values quirk.Labels + DLP completeness (v1 scope only)
list_label_policies/get_label_policy(Get-LabelPolicy) — previously create/set/remove had no read-back at all.get_sensitivity_labelgainedinclude_protection_settings, reading back the encryption/marking/container/Teams settings the write tools set (Graph doesn't carry them). Degrades gracefully off-Windows.set_dlp_policycan edit locations (add_locations/remove_locationsfor Exchange/SharePoint/OneDrive/Teams/Endpoint) andcreate_dlp_policygainedteams_location.set_dlp_rulecovers endpoint & Copilot rules:endpoint_restrictionsreplacement (audit→block tuning) and SIT condition changes.CopyToClipboard→CopyPaste; undocumentedPasteToBrowser/Bluetooth/RemoteDesktopServicesandBlockWithOverrideremoved (they aren't validEndpointDlpRestrictionssettings/values — rules using them would fail or silently do nothing). Browser/AI-site paste control is portal-side sensitive-service-domain config; README now says so honestly. Block/Warn actions requirenotify_userper the cmdlet docs — enforced client-side with a clear error.list_dlp_rules/get_dlp_ruleoutput (previously showed as empty conditions). Copilot location GUID470f2276-e011-4e9d-a6ec-20768be3a4b0andExcludeContentProcessingconfirmed against the New-DlpCompliancePolicy/-Rule references — "verify on live tenant" hedges removed.Hosting: stdio + Azure Functions
index.js, still thebin); the tool surface moved tosrc/server.jsbehind acreateServer()factory.host.json+functions/server.js) using Microsoft's self-hosted MCP servers pattern: stateless streamable HTTP atPOST /mcp, fresh server+transport per request,node:http(no new dependencies), function-key auth by default. Smoke-tested end-to-end in CI (test/functions.test.jsdrives real HTTP: initialize, tools/list = 26 annotated tools).Containerfile(podman-friendly) for full-surface hosting on Premium/Dedicated/ACA — pwsh + ExchangeOnlineManagement + app-only cert auth. Code-only Flex Consumption deploys serve the Graph-read tools. Container not built in CI; the Linux IPPS caveat is documented inline.npm teston ubuntu/windows × node 20/22.Deferred (documented in ROADMAP)
/betainformationProtectionto the GA v1.0dataSecurityAndGovernancesurface — needs new scopes + live-tenant shape validation;labelPolicySettingshas no GA equivalent so that read stays beta regardless.UnallowedAppsendpoint setting (different value shape), on-prem scanner/Power BI locations, auto-labeling.Verification
node --test), including new coverage for stale frames, timeout reset, process death, connect dedup, the platform gate, pagination, annotations, label-policy read-back, and the HTTP host.set_dlp_policylocation edits andget_label_policy.🤖 Generated with Claude Code
https://claude.ai/code/session_01H9bG3RxF9V4ooiVvSCbT4D