diff --git a/pkgs/mcpx/docs/spec/conformance-matrix.md b/pkgs/mcpx/docs/spec/conformance-matrix.md index a5390d1a62..07c65e0ac8 100644 --- a/pkgs/mcpx/docs/spec/conformance-matrix.md +++ b/pkgs/mcpx/docs/spec/conformance-matrix.md @@ -854,7 +854,7 @@ Every normative requirement of every revision (catalogue: `docs/spec/requirement |---|---|---|---|---| | [elicitation-server-no-sensitive-info](https://modelcontextprotocol.io/specification/2025-06-18/client/elicitation#user-interaction-model) | MUST NOT | server | tested: `conformance.TestClientFeaturesServer/2025-06-18/elicitation/elicitation-server-no-sensitive-info` | n/a: addresses the other side | | [elicitation-app-show-requesting-server](https://modelcontextprotocol.io/specification/2025-06-18/client/elicitation#security-considerations) | SHOULD | client | n/a: addresses the other side | tested: `conformance.TestClientFeaturesClient/2025-06-18/elicitation/elicitation-app-show-requesting-server` | -| [elicitation-app-review-modify-responses](https://modelcontextprotocol.io/specification/2025-06-18/client/elicitation#user-interaction-model) | SHOULD | client | n/a: addresses the other side | **gap** #255: mcpx elicit prints the raw request: no review step, no domain emphasis or punycode warning, no defaults pre-filled | +| [elicitation-app-review-modify-responses](https://modelcontextprotocol.io/specification/2025-06-18/client/elicitation#user-interaction-model) | SHOULD | client | n/a: addresses the other side | tested: `cli.TestRenderAnswerReviewMasksSensitiveFields@2025-06-18`
`cli.TestRenderQuestionFormShowsSchemaDefaults@2025-06-18` | | [elicitation-app-decline-cancel-options](https://modelcontextprotocol.io/specification/2025-06-18/client/elicitation#user-interaction-model) | SHOULD | client | n/a: addresses the other side | tested: `elicit.TestAnExpiredQuestionBecomesCancelNotDecline@2025-06-18,2025-11-25,2026-07-28`
`elicit.TestAnsweringAfterTheProcessDiedStillWorks@2025-06-18,2025-11-25,2026-07-28` | | [elicitation-client-declare-capability-at-initialize](https://modelcontextprotocol.io/specification/2025-11-25/client/elicitation#capabilities) | MUST | client | n/a: addresses the other side | tested: `conformance.TestClientFeaturesClient/2025-06-18/elicitation/elicitation-client-declare-capability-at-initialize` | | [elicitation-form-schema-flat-primitives](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#requested-schema) | MUST (schema-structural) | server | tested: `conformance.TestClientFeaturesServer/2025-06-18/elicitation/elicitation-form-schema-flat-primitives` | n/a: addresses the other side | @@ -1299,9 +1299,9 @@ Every normative requirement of every revision (catalogue: `docs/spec/requirement | [elicitation-server-no-sensitive-info-in-form-mode](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#user-interaction-model) | MUST NOT | server | tested: `conformance.TestClientFeaturesServer/2025-11-25/elicitation/elicitation-server-no-sensitive-info-in-form-mode` | n/a: addresses the other side | | [elicitation-server-sensitive-via-url-mode](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#user-interaction-model) | MUST | server | tested: `conformance.TestClientFeaturesServer/2025-11-25/elicitation/elicitation-server-sensitive-via-url-mode` | n/a: addresses the other side | | [elicitation-client-show-requesting-server](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#security-considerations) | MUST | client | n/a: addresses the other side | tested: `conformance.TestClientFeaturesClient/2025-11-25/elicitation/elicitation-client-show-requesting-server` | -| [elicitation-client-form-review-modify-responses](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#user-interaction-model) | MUST | client | n/a: addresses the other side | **gap** #255: mcpx elicit prints the raw request: no review step, no domain emphasis or punycode warning, no defaults pre-filled | +| [elicitation-client-form-review-modify-responses](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#user-interaction-model) | MUST | client | n/a: addresses the other side | tested: `cli.TestRenderAnswerReviewMasksSensitiveFields@2025-11-25,2026-07-28`
`cli.TestRenderQuestionFormShowsSchemaDefaults@2025-11-25,2026-07-28` | | [elicitation-client-decline-cancel-options](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#user-interaction-model) | MUST | client | n/a: addresses the other side | tested: `elicit.TestAnExpiredQuestionBecomesCancelNotDecline@2025-06-18,2025-11-25,2026-07-28`
`elicit.TestAnsweringAfterTheProcessDiedStillWorks@2025-06-18,2025-11-25,2026-07-28` | -| [elicitation-client-url-show-domain-and-consent](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#user-interaction-model) | MUST | client | n/a: addresses the other side | **gap** #255: mcpx elicit prints the raw request: no review step, no domain emphasis or punycode warning, no defaults pre-filled | +| [elicitation-client-url-show-domain-and-consent](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#user-interaction-model) | MUST | client | n/a: addresses the other side | tested: `cli.TestRenderQuestionURLShowsRegistrableDomain@2025-11-25,2026-07-28`
`cli.TestRenderQuestionURLWarnsOnPunycodeHost@2025-11-25,2026-07-28` | | [elicitation-client-declare-capability-at-initialize](https://modelcontextprotocol.io/specification/2025-11-25/client/elicitation#capabilities) | MUST | client | n/a: addresses the other side | tested: `conformance.TestClientFeaturesClient/2025-11-25/elicitation/elicitation-client-declare-capability-at-initialize` | | [elicitation-empty-capability-means-form-only](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#capabilities) | (definition) | both | tested: `conformance.TestClientFeaturesServer/2025-11-25/elicitation/elicitation-empty-capability-means-form-only` | tested: `conformance.TestClientFeaturesClient/2025-11-25/elicitation/elicitation-empty-capability-means-form-only` | | [elicitation-client-support-at-least-one-mode](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#capabilities) | MUST | client | n/a: addresses the other side | tested: `conformance.TestClientFeaturesClient/2025-11-25/elicitation/elicitation-client-support-at-least-one-mode` | @@ -1347,16 +1347,16 @@ Every normative requirement of every revision (catalogue: `docs/spec/requirement | [elicitation-url-not-pre-authenticated](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | MUST NOT | server | tested: `conformance.TestClientFeaturesServer/2025-11-25/elicitation/elicitation-url-not-pre-authenticated` | n/a: addresses the other side | | [elicitation-no-clickable-urls-in-form](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | SHOULD NOT | server | tested: `conformance.TestClientFeaturesServer/2025-11-25/elicitation/elicitation-no-clickable-urls-in-form` | n/a: addresses the other side | | [elicitation-url-https-outside-dev](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | SHOULD | server | tested: `conformance.TestClientFeaturesServer/2025-11-25/elicitation/elicitation-url-https-outside-dev` | n/a: addresses the other side | -| [elicitation-client-handle-urls-carefully](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | MUST | client | n/a: addresses the other side | **gap** #255: mcpx elicit prints the raw request: no review step, no domain emphasis or punycode warning, no defaults pre-filled | +| [elicitation-client-handle-urls-carefully](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | MUST | client | n/a: addresses the other side | tested: `cli.TestRenderQuestionURLShowsRegistrableDomain@2025-11-25,2026-07-28`
`cli.TestRenderQuestionURLWarnsOnPunycodeHost@2025-11-25,2026-07-28` | | [elicitation-client-no-url-prefetch](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | MUST NOT | client | n/a: addresses the other side | tested: `conformance.TestClientFeaturesClient/2025-11-25/elicitation/elicitation-client-no-url-prefetch` | | [elicitation-client-no-open-without-consent](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | MUST NOT | client | n/a: addresses the other side | tested: `conformance.TestClientFeaturesClient/2025-11-25/elicitation/elicitation-client-no-open-without-consent` | | [elicitation-client-show-full-url](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | MUST | client | n/a: addresses the other side | tested: `conformance.TestClientFeaturesClient/2025-11-25/elicitation/elicitation-client-show-full-url` | | [elicitation-client-open-url-securely](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | MUST | client | n/a: addresses the other side | tested: `elicit.TestRoutingSendsCredentialsToAHumanAndTheRestToTheAgent@2025-06-18,2025-11-25,2026-07-28` | -| [elicitation-client-highlight-domain](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | SHOULD | client | n/a: addresses the other side | **gap** #255: mcpx elicit prints the raw request: no review step, no domain emphasis or punycode warning, no defaults pre-filled | -| [elicitation-client-warn-punycode](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | SHOULD | client | n/a: addresses the other side | **gap** #255: mcpx elicit prints the raw request: no review step, no domain emphasis or punycode warning, no defaults pre-filled | +| [elicitation-client-highlight-domain](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | SHOULD | client | n/a: addresses the other side | tested: `cli.TestRenderQuestionURLShowsRegistrableDomain@2025-11-25,2026-07-28` | +| [elicitation-client-warn-punycode](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | SHOULD | client | n/a: addresses the other side | tested: `cli.TestRenderQuestionURLWarnsOnPunycodeHost@2025-11-25,2026-07-28` | | [elicitation-client-no-clickable-except-url-field](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | SHOULD NOT | client | n/a: addresses the other side | tested: `conformance.TestClientFeaturesClient/2025-11-25/elicitation/elicitation-client-no-clickable-except-url-field` | | [elicitation-server-no-trust-client-user-id](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#identifying-the-user) | MUST NOT | server | **gap** #257: mcpx has no authenticated user: state is bound to the request, the session id is whatever the caller sends | n/a: addresses the other side | -| [elicitation-server-follow-best-practices](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#identifying-the-user) | SHOULD | server | **gap** #255: requestState signing is sound; question storage is world-readable and there is no user identity | n/a: addresses the other side | +| [elicitation-server-follow-best-practices](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#identifying-the-user) | SHOULD | server | **gap** #255: requestState signing is sound and question storage is owner-only (0700/0600, #1676); there is no user identity | n/a: addresses the other side | | [elicitation-url-verify-opening-user](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#phishing) | MUST | server | n/a: mcpx issues no URL; the upstream that does sees mcpx's identity, not the end user's | n/a: addresses the other side | | [elicitation-url-same-user-start-and-complete](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#phishing) | MUST | server | n/a: see Implied: shared pooled upstream | n/a: addresses the other side | | [elicitation-url-identity-resilient-to-url-tampering](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#phishing) | MUST | server | n/a: catalogue marks it n/a | n/a: addresses the other side | @@ -1980,9 +1980,9 @@ Every normative requirement of every revision (catalogue: `docs/spec/requirement | [elicitation-server-no-sensitive-info-in-form-mode](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#user-interaction-model) | MUST NOT | server | tested: `conformance.TestClientFeaturesServer/2026-07-28/elicitation/elicitation-server-no-sensitive-info-in-form-mode` | n/a: addresses the other side | | [elicitation-server-sensitive-via-url-mode](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#user-interaction-model) | MUST | server | tested: `conformance.TestClientFeaturesServer/2026-07-28/elicitation/elicitation-server-sensitive-via-url-mode` | n/a: addresses the other side | | [elicitation-client-show-requesting-server](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#security-considerations) | MUST | client | n/a: addresses the other side | tested: `conformance.TestClientFeaturesClient/2026-07-28/elicitation/elicitation-client-show-requesting-server` | -| [elicitation-client-form-review-modify-responses](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#user-interaction-model) | MUST | client | n/a: addresses the other side | **gap** #255: mcpx elicit prints the raw request: no review step, no domain emphasis or punycode warning, no defaults pre-filled | +| [elicitation-client-form-review-modify-responses](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#user-interaction-model) | MUST | client | n/a: addresses the other side | tested: `cli.TestRenderAnswerReviewMasksSensitiveFields@2025-11-25,2026-07-28`
`cli.TestRenderQuestionFormShowsSchemaDefaults@2025-11-25,2026-07-28` | | [elicitation-client-decline-cancel-options](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#user-interaction-model) | MUST | client | n/a: addresses the other side | tested: `elicit.TestAnExpiredQuestionBecomesCancelNotDecline@2025-06-18,2025-11-25,2026-07-28`
`elicit.TestAnsweringAfterTheProcessDiedStillWorks@2025-06-18,2025-11-25,2026-07-28` | -| [elicitation-client-url-show-domain-and-consent](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#user-interaction-model) | MUST | client | n/a: addresses the other side | **gap** #255: mcpx elicit prints the raw request: no review step, no domain emphasis or punycode warning, no defaults pre-filled | +| [elicitation-client-url-show-domain-and-consent](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#user-interaction-model) | MUST | client | n/a: addresses the other side | tested: `cli.TestRenderQuestionURLShowsRegistrableDomain@2025-11-25,2026-07-28`
`cli.TestRenderQuestionURLWarnsOnPunycodeHost@2025-11-25,2026-07-28` | | [elicitation-client-declare-capability-per-request-meta](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#capabilities) | MUST | client | n/a: addresses the other side | tested: `conformance.TestClientFeaturesClient/2026-07-28/elicitation/elicitation-client-declare-capability-per-request-meta` | | [elicitation-empty-capability-means-form-only](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#capabilities) | (definition) | both | tested: `conformance.TestClientFeaturesServer/2026-07-28/elicitation/elicitation-empty-capability-means-form-only` | tested: `conformance.TestClientFeaturesClient/2026-07-28/elicitation/elicitation-empty-capability-means-form-only` | | [elicitation-client-support-at-least-one-mode](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#capabilities) | MUST | client | n/a: addresses the other side | tested: `conformance.TestClientFeaturesClient/2026-07-28/elicitation/elicitation-client-support-at-least-one-mode` | @@ -2017,16 +2017,16 @@ Every normative requirement of every revision (catalogue: `docs/spec/requirement | [elicitation-url-not-pre-authenticated](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | MUST NOT | server | tested: `conformance.TestClientFeaturesServer/2026-07-28/elicitation/elicitation-url-not-pre-authenticated` | n/a: addresses the other side | | [elicitation-no-clickable-urls-in-form](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | SHOULD NOT | server | tested: `conformance.TestClientFeaturesServer/2026-07-28/elicitation/elicitation-no-clickable-urls-in-form` | n/a: addresses the other side | | [elicitation-url-https-outside-dev](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | SHOULD | server | tested: `conformance.TestClientFeaturesServer/2026-07-28/elicitation/elicitation-url-https-outside-dev` | n/a: addresses the other side | -| [elicitation-client-handle-urls-carefully](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | MUST | client | n/a: addresses the other side | **gap** #255: mcpx elicit prints the raw request: no review step, no domain emphasis or punycode warning, no defaults pre-filled | +| [elicitation-client-handle-urls-carefully](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | MUST | client | n/a: addresses the other side | tested: `cli.TestRenderQuestionURLShowsRegistrableDomain@2025-11-25,2026-07-28`
`cli.TestRenderQuestionURLWarnsOnPunycodeHost@2025-11-25,2026-07-28` | | [elicitation-client-no-url-prefetch](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | MUST NOT | client | n/a: addresses the other side | tested: `conformance.TestClientFeaturesClient/2026-07-28/elicitation/elicitation-client-no-url-prefetch` | | [elicitation-client-no-open-without-consent](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | MUST NOT | client | n/a: addresses the other side | tested: `conformance.TestClientFeaturesClient/2026-07-28/elicitation/elicitation-client-no-open-without-consent` | | [elicitation-client-show-full-url](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | MUST | client | n/a: addresses the other side | tested: `conformance.TestClientFeaturesClient/2026-07-28/elicitation/elicitation-client-show-full-url` | | [elicitation-client-open-url-securely](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | MUST | client | n/a: addresses the other side | tested: `elicit.TestRoutingSendsCredentialsToAHumanAndTheRestToTheAgent@2025-06-18,2025-11-25,2026-07-28` | -| [elicitation-client-highlight-domain](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | SHOULD | client | n/a: addresses the other side | **gap** #255: mcpx elicit prints the raw request: no review step, no domain emphasis or punycode warning, no defaults pre-filled | -| [elicitation-client-warn-punycode](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | SHOULD | client | n/a: addresses the other side | **gap** #255: mcpx elicit prints the raw request: no review step, no domain emphasis or punycode warning, no defaults pre-filled | +| [elicitation-client-highlight-domain](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | SHOULD | client | n/a: addresses the other side | tested: `cli.TestRenderQuestionURLShowsRegistrableDomain@2025-11-25,2026-07-28` | +| [elicitation-client-warn-punycode](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | SHOULD | client | n/a: addresses the other side | tested: `cli.TestRenderQuestionURLWarnsOnPunycodeHost@2025-11-25,2026-07-28` | | [elicitation-client-no-clickable-except-url-field](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#safe-url-handling) | SHOULD NOT | client | n/a: addresses the other side | tested: `conformance.TestClientFeaturesClient/2026-07-28/elicitation/elicitation-client-no-clickable-except-url-field` | | [elicitation-server-no-trust-client-user-id](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#identifying-the-user) | MUST NOT | server | **gap** #257: mcpx has no authenticated user: state is bound to the request, the session id is whatever the caller sends | n/a: addresses the other side | -| [elicitation-server-follow-best-practices](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#identifying-the-user) | SHOULD | server | **gap** #255: requestState signing is sound; question storage is world-readable and there is no user identity | n/a: addresses the other side | +| [elicitation-server-follow-best-practices](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#identifying-the-user) | SHOULD | server | **gap** #255: requestState signing is sound and question storage is owner-only (0700/0600, #1676); there is no user identity | n/a: addresses the other side | | [elicitation-url-verify-opening-user](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#phishing) | MUST | server | n/a: mcpx issues no URL; the upstream that does sees mcpx's identity, not the end user's | n/a: addresses the other side | | [elicitation-url-same-user-start-and-complete](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#phishing) | MUST | server | n/a: see Implied: shared pooled upstream | n/a: addresses the other side | | [elicitation-url-identity-resilient-to-url-tampering](https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#phishing) | MUST | server | n/a: catalogue marks it n/a | n/a: addresses the other side | diff --git a/pkgs/mcpx/go.mod b/pkgs/mcpx/go.mod index 1e041f6679..f857df10bd 100644 --- a/pkgs/mcpx/go.mod +++ b/pkgs/mcpx/go.mod @@ -8,6 +8,7 @@ require ( github.com/charmbracelet/lipgloss v1.1.0 github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 github.com/tetratelabs/wazero v1.9.0 + golang.org/x/net v0.59.0 golang.org/x/sys v0.48.0 gopkg.in/yaml.v3 v3.0.1 modernc.org/sqlite v1.60.0 @@ -97,7 +98,6 @@ require ( golang.org/x/crypto v0.57.0 // indirect golang.org/x/exp v0.0.0-20250210185358-939b2ce775ac // indirect golang.org/x/mod v0.41.0 // indirect - golang.org/x/net v0.59.0 // indirect golang.org/x/sync v0.23.0 // indirect golang.org/x/term v0.46.0 // indirect golang.org/x/text v0.42.0 // indirect diff --git a/pkgs/mcpx/internal/cli/elicit.go b/pkgs/mcpx/internal/cli/elicit.go index c4e60caf89..059484e771 100644 --- a/pkgs/mcpx/internal/cli/elicit.go +++ b/pkgs/mcpx/internal/cli/elicit.go @@ -1,15 +1,23 @@ package cli import ( + "bufio" + "bytes" "context" "encoding/json" "fmt" + "io" + "net/url" "os" "path/filepath" + "sort" "strings" "text/tabwriter" "time" + "golang.org/x/net/idna" + "golang.org/x/net/publicsuffix" + "github.com/dezren39/mcpx/internal/elicit" ) @@ -57,6 +65,7 @@ func (a *App) CmdElicit(ctx context.Context, args []string) error { fs := newFlagSet("elicit") session := fs.String("session", "", "restrict to one session") audience := fs.String("audience", "", "agent or human") + yes := fs.Bool("yes", false, "answer without the interactive review prompt") if err := parseFlags(a, fs, args); err != nil { return err } @@ -137,6 +146,35 @@ func (a *App) CmdElicit(ctx context.Context, args []string) error { content = json.RawMessage(raw) } } + // Review before relay (#1678): on a terminal, a form answer is + // shown back -- credential-shaped values masked -- and relayed + // only on an explicit yes. --yes and non-interactive stdin keep + // the historical one-shot behaviour byte-for-byte. + if len(content) > 0 && !*yes && isTerminal(os.Stdin) { + r, found, err := b.Get(fs.Arg(0)) + if err != nil { + return err + } + if !found { + return fmt.Errorf("no elicitation %s", fs.Arg(0)) + } + if r.Mode == elicit.Form { + fmt.Print(renderAnswerReview(r, content)) + confirmed, err := confirmSend(ctx, os.Stdin) + if err != nil { + return err + } + if !confirmed { + return fmt.Errorf("answer not sent: declined at review") + } + } + } + // A cancellation that landed during the review (or at any + // point above) wins over the relay: the user said stop, so + // nothing is sent (Codex review, PR #3011). + if err := ctx.Err(); err != nil { + return err + } return b.Respond(elicit.Answer{ ID: fs.Arg(0), Action: elicit.Accept, Content: content, By: "cli", }) @@ -222,6 +260,7 @@ func renderQuestion(r elicit.Request) string { fmt.Fprintf(&b, " expires in %s\n", short(r.TTLRemaining())) if r.Mode == elicit.URL { fmt.Fprintf(&b, " url %s\n", r.URL) + b.WriteString(urlDomainLines(r.URL)) fmt.Fprintf(&b, "\n mcpx elicit accept %s (after visiting it)\n", r.ID) fmt.Fprintf(&b, " mcpx elicit decline %s\n", r.ID) return b.String() @@ -229,12 +268,16 @@ func renderQuestion(r elicit.Request) string { for _, f := range describeSchema(r.Schema) { fmt.Fprintf(&b, " %-8s %s\n", f.name, f.detail) } - fmt.Fprintf(&b, "\n mcpx elicit answer %s '%s'\n", r.ID, exampleFor(r.Schema)) + fmt.Fprintf(&b, "\n mcpx elicit answer %s %s\n", r.ID, shellQuote(exampleFor(r.Schema))) fmt.Fprintf(&b, " mcpx elicit decline %s\n", r.ID) return b.String() } -type schemaField struct{ name, detail string } +type schemaField struct { + name, detail string + format string + def json.RawMessage +} func describeSchema(raw json.RawMessage) []schemaField { if len(raw) == 0 { @@ -242,9 +285,11 @@ func describeSchema(raw json.RawMessage) []schemaField { } var doc struct { Properties map[string]struct { - Type string `json:"type"` - Description string `json:"description"` - Enum []any `json:"enum"` + Type string `json:"type"` + Format string `json:"format"` + Description string `json:"description"` + Enum []any `json:"enum"` + Default json.RawMessage `json:"default"` } `json:"properties"` Required []string `json:"required"` } @@ -271,8 +316,12 @@ func describeSchema(raw json.RawMessage) []schemaField { if p.Description != "" { detail += " -- " + p.Description } - out = append(out, schemaField{name: name, detail: detail}) + if len(p.Default) > 0 { + detail += ", default: " + compactJSON(p.Default) + } + out = append(out, schemaField{name: name, detail: detail, format: p.Format, def: p.Default}) } + sort.Slice(out, func(i, j int) bool { return out[i].name < out[j].name }) return out } @@ -283,11 +332,163 @@ func exampleFor(raw json.RawMessage) string { } var parts []string for _, f := range fields { - parts = append(parts, fmt.Sprintf("%q:%q", f.name, "...")) + v := `"..."` + if len(f.def) > 0 { + v = compactJSON(f.def) + } + parts = append(parts, fmt.Sprintf("%q:%s", f.name, v)) } return "{" + strings.Join(parts, ",") + "}" } +// shellQuote renders s as a single POSIX shell word: wrapped in single +// quotes, with each embedded single quote closed, escaped and reopened. +// The suggested answer command embeds schema defaults, which are +// server-controlled; quoting at this boundary keeps a default such as +// O'Reilly (or worse) from breaking the command or injecting into it. +func shellQuote(s string) string { + return "'" + strings.ReplaceAll(s, "'", `'\''`) + "'" +} + +// urlDomainLines renders the registrable domain under a URL question's +// full URL, and -- for a punycode or non-ASCII host -- both host forms and +// the warning. Plain ASCII hosts get the domain line only (#1678). +func urlDomainLines(raw string) string { + u, err := url.Parse(raw) + if err != nil { + return "" + } + host := u.Hostname() + if host == "" { + return "" + } + // The publicsuffix list compares labels case-sensitively, while + // URL hosts are case-insensitive: an uppercase host would look + // up CO.UK, miss the lowercase rules, and render the suffix + // itself as the domain -- dropping the registrant's label from + // the review indicator (Codex review, PR #3011). The lookup + // uses the lowercased host; the full URL printed above and the + // host forms below keep the host as the server sent it. + domain, err := publicsuffix.EffectiveTLDPlusOne(strings.ToLower(host)) + if err != nil { + domain = host + } + var b strings.Builder + fmt.Fprintf(&b, " domain %s\n", domain) + if uni, ascii, puny := hostForms(host); puny { + fmt.Fprintf(&b, " host %s (%s)\n", uni, ascii) + b.WriteString(" warn host uses punycode; check the domain is the one you expect\n") + } + return b.String() +} + +// hostForms returns the unicode and punycode forms of a host that uses +// either, reporting whether the host is punycode-shaped at all. +func hostForms(host string) (uni, ascii string, puny bool) { + nonASCII := false + for _, r := range host { + if r > 127 { + nonASCII = true + break + } + } + if !nonASCII && !strings.Contains(strings.ToLower(host), "xn--") { + return "", "", false + } + uni, err := idna.ToUnicode(host) + if err != nil { + uni = host + } + ascii, err = idna.ToASCII(host) + if err != nil { + ascii = host + } + return uni, ascii, true +} + +// renderAnswerReview prints the answer about to be relayed, with +// credential-shaped values masked as (set)/(not set) -- never the value, +// never its length (#1678). +func renderAnswerReview(r elicit.Request, content json.RawMessage) string { + var b strings.Builder + b.WriteString("About to send this answer:\n") + var values map[string]json.RawMessage + if json.Unmarshal(content, &values) != nil { + fmt.Fprintf(&b, " %s\n", compactJSON(content)) + return b.String() + } + formats := map[string]string{} + for _, f := range describeSchema(r.Schema) { + formats[f.name] = f.format + // The relay applies schema defaults to omitted fields + // (mcpclient.applyDefaults), so the review must show the + // effective answer -- defaults included -- not only what + // was explicitly supplied (#1678, Codex P2 on PR 3011). + if _, supplied := values[f.name]; !supplied && len(f.def) > 0 { + values[f.name] = f.def + } + } + names := make([]string, 0, len(values)) + for name := range values { + names = append(names, name) + } + sort.Strings(names) + for _, name := range names { + raw := values[name] + if elicit.IsSensitiveField(name, formats[name]) { + state := "(not set)" + if isSetValue(raw) { + state = "(set)" + } + fmt.Fprintf(&b, " %-8s %s\n", name, state) + continue + } + fmt.Fprintf(&b, " %-8s %s\n", name, compactJSON(raw)) + } + return b.String() +} + +// isSetValue reports whether an answer value carries anything: JSON null, +// an empty string and an absent value all count as not set. +func isSetValue(raw json.RawMessage) bool { + t := strings.TrimSpace(string(raw)) + return t != "" && t != "null" && t != `""` +} + +// confirmSend asks for the relay decision; anything but y/yes -- EOF +// included -- is a no, so a vanished terminal never sends. The read is +// cancellation-aware: main cancels the command context on SIGINT, and +// a prompt that ignored that would sit blocked on the read and could +// still relay on a later y, after the user already said stop +// (Codex review, PR #3011). +func confirmSend(ctx context.Context, in io.Reader) (bool, error) { + fmt.Print("Send this answer? [y/N] ") + type result struct{ line string } + read := make(chan result, 1) + go func() { + line, _ := bufio.NewReader(in).ReadString('\n') + read <- result{line} + }() + select { + case <-ctx.Done(): + return false, ctx.Err() + case r := <-read: + switch strings.ToLower(strings.TrimSpace(r.line)) { + case "y", "yes": + return true, nil + } + return false, nil + } +} + +func compactJSON(raw json.RawMessage) string { + var b bytes.Buffer + if err := json.Compact(&b, raw); err != nil { + return string(raw) + } + return b.String() +} + func short(d time.Duration) string { switch { case d <= 0: diff --git a/pkgs/mcpx/internal/cli/elicit_test.go b/pkgs/mcpx/internal/cli/elicit_test.go new file mode 100644 index 0000000000..0b0f1f56d6 --- /dev/null +++ b/pkgs/mcpx/internal/cli/elicit_test.go @@ -0,0 +1,192 @@ +package cli + +import ( + "context" + "encoding/json" + "errors" + "io" + "strings" + "testing" + "time" + + "github.com/dezren39/mcpx/internal/elicit" +) + +// #1678 (Phase 3 of #1675): a URL question shows the registrable domain +// under the full URL, so a subdomain spoof has to survive a second line. +func TestRenderQuestionURLShowsRegistrableDomain(t *testing.T) { + out := renderQuestion(elicit.Request{ + ID: "elc-1", Message: "Log in", Mode: elicit.URL, + URL: "https://login.example.co.uk/auth?x=1", + }) + if !strings.Contains(out, " url https://login.example.co.uk/auth?x=1\n") { + t.Errorf("full URL missing or changed:\n%s", out) + } + if !strings.Contains(out, " domain example.co.uk\n") { + t.Errorf("registrable domain line missing:\n%s", out) + } + if strings.Contains(out, "warn") { + t.Errorf("plain ASCII host must not warn:\n%s", out) + } +} + +// #1678: a punycode (or raw non-ASCII) host prints both forms plus the +// warning line, in the settled wording. +func TestRenderQuestionURLWarnsOnPunycodeHost(t *testing.T) { + for _, raw := range []string{"https://xn--mnchen-3ya.de/login", "https://münchen.de/login"} { + out := renderQuestion(elicit.Request{ + ID: "elc-2", Message: "Log in", Mode: elicit.URL, URL: raw, + }) + if !strings.Contains(out, " host münchen.de (xn--mnchen-3ya.de)\n") { + t.Errorf("%s: both host forms missing:\n%s", raw, out) + } + if !strings.Contains(out, " warn host uses punycode; check the domain is the one you expect\n") { + t.Errorf("%s: warn line missing:\n%s", raw, out) + } + } +} + +// #1678: schema defaults appear in the field detail and in the answer +// example; fields without one keep the "..." placeholder. +func TestRenderQuestionFormShowsSchemaDefaults(t *testing.T) { + schema := json.RawMessage(`{"type":"object","properties":{ + "repo":{"type":"string","default":"me/thing"}, + "count":{"type":"number","default":3}, + "note":{"type":"string"}},"required":["repo"]}`) + out := renderQuestion(elicit.Request{ + ID: "elc-3", Message: "Details", Mode: elicit.Form, Schema: schema, + }) + if !strings.Contains(out, `default: "me/thing"`) { + t.Errorf("string default missing from field detail:\n%s", out) + } + if !strings.Contains(out, "default: 3") { + t.Errorf("number default missing from field detail:\n%s", out) + } + if !strings.Contains(out, `"repo":"me/thing"`) || !strings.Contains(out, `"count":3`) { + t.Errorf("defaults missing from answer example:\n%s", out) + } + if !strings.Contains(out, `"note":"..."`) { + t.Errorf("defaultless field lost its placeholder:\n%s", out) + } +} + +// #1678: the answer review masks credential-shaped values as set/not set +// and never prints the value itself. +func TestRenderAnswerReviewMasksSensitiveFields(t *testing.T) { + r := elicit.Request{ + Mode: elicit.Form, + Schema: json.RawMessage(`{"type":"object","properties":{ + "pw":{"type":"string","format":"password"}, + "api_token":{"type":"string"}, + "repo":{"type":"string"}}}`), + } + out := renderAnswerReview(r, json.RawMessage( + `{"api_token":"hunter2","pw":"s3cret","repo":"me/thing","empty_secret":""}`)) + for _, leaked := range []string{"hunter2", "s3cret"} { + if strings.Contains(out, leaked) { + t.Errorf("review leaked a credential value:\n%s", out) + } + } + if !strings.Contains(out, "api_token") || !strings.Contains(out, "(set)") { + t.Errorf("sensitive field not masked as (set):\n%s", out) + } + if !strings.Contains(out, "empty_secret") || !strings.Contains(out, "(not set)") { + t.Errorf("empty sensitive field not masked as (not set):\n%s", out) + } + if !strings.Contains(out, "me/thing") { + t.Errorf("plain field value missing from review:\n%s", out) + } +} + +// The relay decision defaults to no: only an explicit y/yes sends, and a +// vanished terminal (EOF) never does. +func TestConfirmSendRequiresExplicitYes(t *testing.T) { + for in, want := range map[string]bool{ + "y\n": true, "yes\n": true, "Y\n": true, + "n\n": false, "\n": false, "": false, "send it\n": false, + } { + got, err := confirmSend(context.Background(), strings.NewReader(in)) + if err != nil || got != want { + t.Errorf("confirmSend(%q) = %v, %v; want %v", in, got, err, want) + } + } +} + +// Codex P1 on PR 3011: a schema default containing an apostrophe (or a +// shell injection attempt) must survive shell-quoting in the suggested +// answer command: the JSON is one shell word, embedded quotes escaped. +func TestRenderQuestionShellQuotesDefaults(t *testing.T) { + schema := json.RawMessage(`{"type":"object","properties":{ + "name":{"type":"string","default":"O'Reilly"}, + "evil":{"type":"string","default":"'; printf INJECTED; #"}}}`) + out := renderQuestion(elicit.Request{ + ID: "elc-4", Message: "Details", Mode: elicit.Form, Schema: schema, + }) + if !strings.Contains(out, `'{"evil":"'\''; printf INJECTED; #","name":"O'\''Reilly"}'`) { + t.Errorf("suggested command does not shell-quote the whole JSON as one word:\n%s", out) + } +} + +// Codex P2 on PR 3011: the answer review shows the effective answer -- +// schema defaults for omitted fields included, since the relay applies +// them -- with sensitive defaults still masked. +func TestRenderAnswerReviewIncludesEffectiveDefaults(t *testing.T) { + r := elicit.Request{ + Mode: elicit.Form, + Schema: json.RawMessage(`{"type":"object","properties":{ + "share_data":{"type":"boolean","default":true}, + "api_token":{"type":"string","format":"password","default":"d3fault"}, + "repo":{"type":"string"}}}`), + } + out := renderAnswerReview(r, json.RawMessage(`{"repo":"me/thing"}`)) + if !strings.Contains(out, "share_data") || !strings.Contains(out, "true") { + t.Errorf("omitted field's default missing from review:\n%s", out) + } + if strings.Contains(out, "d3fault") { + t.Errorf("review leaked a sensitive default value:\n%s", out) + } + if !strings.Contains(out, "api_token") || !strings.Contains(out, "(set)") { + t.Errorf("sensitive default not masked as (set) in review:\n%s", out) + } +} + +// Codex P2 on PR 3011: URL hosts are case-insensitive but the +// publicsuffix list is not -- an uppercase host must still resolve to +// the registrable domain, not render the suffix itself. +func TestRenderQuestionURLUppercaseHostShowsRegistrableDomain(t *testing.T) { + out := renderQuestion(elicit.Request{ + ID: "elc-5", Message: "Log in", Mode: elicit.URL, + URL: "https://login.example.CO.UK/auth", + }) + if !strings.Contains(out, " domain example.co.uk\n") { + t.Errorf("uppercase host lost its registrable domain:\n%s", out) + } +} + +// Codex P2 on PR 3011: cancelling the command context (Ctrl-C) while +// the confirmation read is blocked must end the prompt without a +// relay decision, not leave the command stuck on stdin. +func TestConfirmSendHonoursContextCancellation(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + pr, pw := io.Pipe() + defer pw.Close() + defer pr.Close() + done := make(chan error, 1) + go func() { + ok, err := confirmSend(ctx, pr) + if ok { + done <- errors.New("confirmSend returned yes on a cancelled read") + return + } + done <- err + }() + cancel() + select { + case err := <-done: + if !errors.Is(err, context.Canceled) { + t.Errorf("confirmSend on cancel = %v; want context.Canceled", err) + } + case <-time.After(5 * time.Second): + t.Fatal("confirmSend ignored context cancellation and stayed blocked") + } +} diff --git a/pkgs/mcpx/internal/cli/flagindex_generated.go b/pkgs/mcpx/internal/cli/flagindex_generated.go index a5159f74d7..8201881af9 100644 --- a/pkgs/mcpx/internal/cli/flagindex_generated.go +++ b/pkgs/mcpx/internal/cli/flagindex_generated.go @@ -80,6 +80,7 @@ var handFlagIndex = map[string][]HandFlag{ "elicit": { {Name: "session", Usage: "restrict to one session"}, {Name: "audience", Usage: "agent or human"}, + {Name: "yes", Usage: "answer without the interactive review prompt"}, }, "embeddings export": { {Name: "output", Usage: "output file path (default stdout)"}, diff --git a/pkgs/mcpx/internal/conformance/coverage_clientfeatures.go b/pkgs/mcpx/internal/conformance/coverage_clientfeatures.go index 79da357878..813eb5e90e 100644 --- a/pkgs/mcpx/internal/conformance/coverage_clientfeatures.go +++ b/pkgs/mcpx/internal/conformance/coverage_clientfeatures.go @@ -15,6 +15,15 @@ func init() { const retentionPrune = "elicit.TestOpenPrunesTerminalRowsPastTheAgeBound@2024-11-05,2025-03-26,2025-06-18,2025-11-25,2026-07-28" const summaryEvents = "daemon.TestElicitEventsAreSummaryOnly@2024-11-05,2025-03-26,2025-06-18,2025-11-25,2026-07-28" const storeMigrated = "elicit.TestOpenAtMigratesLegacyStore@2025-11-25,2026-07-28" + // #1678 (Phase 3 of #1675): the CLI review-first elicit surface -- + // domain line + punycode warning on URL questions, schema defaults in + // form rendering, and the masked confirm-before-relay answer review. + const cliReview = "cli.TestRenderAnswerReviewMasksSensitiveFields@2025-11-25,2026-07-28" + const cliReviewApp = "cli.TestRenderAnswerReviewMasksSensitiveFields@2025-06-18" + const cliDefaults = "cli.TestRenderQuestionFormShowsSchemaDefaults@2025-11-25,2026-07-28" + const cliDefaultsApp = "cli.TestRenderQuestionFormShowsSchemaDefaults@2025-06-18" + const cliDomain = "cli.TestRenderQuestionURLShowsRegistrableDomain@2025-11-25,2026-07-28" + const cliPuny = "cli.TestRenderQuestionURLWarnsOnPunycodeHost@2025-11-25,2026-07-28" register( C("elicitation-client-validate-responses", "mcpclient.TestElicitationAnswersValidatedAgainstRequestedSchema/2025-11-25/elicitation/wrong-typed-answer-is-32602-not-relayed", "mcpclient.TestElicitationAnswersValidatedAgainstRequestedSchema/2026-07-28/elicitation/input-required-wrong-typed-answer-is-rejected"), @@ -36,6 +45,12 @@ func init() { C("elicitation-client-user-approval-controls", human), C("elicitation-client-open-url-securely", human), C("elicitation-client-manual-retry-cancel-controls", cliAnswer), + C("elicitation-app-review-modify-responses", cliReviewApp, cliDefaultsApp), + C("elicitation-client-form-review-modify-responses", cliReview, cliDefaults), + C("elicitation-client-url-show-domain-and-consent", cliDomain, cliPuny), + C("elicitation-client-handle-urls-carefully", cliDomain, cliPuny), + C("elicitation-client-highlight-domain", cliDomain), + C("elicitation-client-warn-punycode", cliPuny), S("elicitation-state-storage-protected", storeProtected, storeMigrated), S("sampling-both-handle-sensitive-data", summaryEvents, retentionPrune), C("sampling-both-handle-sensitive-data", summaryEvents, retentionPrune), @@ -138,16 +153,10 @@ func init() { Gap{ID: "sampling-messages-not-retained-between-requests", Side: Client, Issue: "#255", Why: "terminal sampling rows are now pruned past the #1677 age bound, but a sampling request's messages are still retained in elicit.db between separate requests until that bound; the SHOULD NOT is not met"}, Gap{ID: "sampling-client-errors-user-rejected-and-tool-shape", Side: Client, Issue: "#1836", Why: "only the -32602 content half remains: sampling messages/results are not yet checked for a missing tool result or tool results mixed with other content (Phase 2 of #1834); the -1 half is covered -- a refusal reaches the upstream as -1 (typed CodedError, #1835)"}, Gap{ID: "sampling-server-avoid-includecontext-values", Side: Server, Issue: "#210", Why: "an upstream sampling request is relayed as-is: tools and includeContext reach a client that did not declare sampling.tools or sampling.context"}, - Gap{ID: "elicitation-app-review-modify-responses", Side: Client, Issue: "#255", Why: "mcpx elicit prints the raw request: no review step, no domain emphasis or punycode warning, no defaults pre-filled"}, - Gap{ID: "elicitation-client-form-review-modify-responses", Side: Client, Issue: "#255", Why: "mcpx elicit prints the raw request: no review step, no domain emphasis or punycode warning, no defaults pre-filled"}, - Gap{ID: "elicitation-client-url-show-domain-and-consent", Side: Client, Issue: "#255", Why: "mcpx elicit prints the raw request: no review step, no domain emphasis or punycode warning, no defaults pre-filled"}, - Gap{ID: "elicitation-client-handle-urls-carefully", Side: Client, Issue: "#255", Why: "mcpx elicit prints the raw request: no review step, no domain emphasis or punycode warning, no defaults pre-filled"}, - Gap{ID: "elicitation-client-highlight-domain", Side: Client, Issue: "#255", Why: "mcpx elicit prints the raw request: no review step, no domain emphasis or punycode warning, no defaults pre-filled"}, - Gap{ID: "elicitation-client-warn-punycode", Side: Client, Issue: "#255", Why: "mcpx elicit prints the raw request: no review step, no domain emphasis or punycode warning, no defaults pre-filled"}, Gap{ID: "elicitation-server-state-bound-to-user", Side: Server, Issue: "#257", Why: "mcpx has no authenticated user: state is bound to the request, the session id is whatever the caller sends"}, Gap{ID: "elicitation-server-stored-state-bound-to-user", Side: Server, Issue: "#257", Why: "mcpx has no authenticated user: state is bound to the request, the session id is whatever the caller sends"}, Gap{ID: "elicitation-server-no-trust-client-user-id", Side: Server, Issue: "#257", Why: "mcpx has no authenticated user: state is bound to the request, the session id is whatever the caller sends"}, - Gap{ID: "elicitation-server-follow-best-practices", Side: Server, Issue: "#255", Why: "requestState signing is sound; question storage is world-readable and there is no user identity"}, + Gap{ID: "elicitation-server-follow-best-practices", Side: Server, Issue: "#255", Why: "requestState signing is sound and question storage is owner-only (0700/0600, #1676); there is no user identity"}, Gap{ID: "elicitation-state-not-session-id-alone", Side: Server, Issue: "#257", Why: "state is bound to the request, not a user; there is no user to bind to"}, ) } diff --git a/pkgs/mcpx/internal/elicit/elicit.go b/pkgs/mcpx/internal/elicit/elicit.go index 1d44c1e8db..3ec0f4a471 100644 --- a/pkgs/mcpx/internal/elicit/elicit.go +++ b/pkgs/mcpx/internal/elicit/elicit.go @@ -778,11 +778,10 @@ func Route(r Request) (Audience, string) { } fields := schemaFields(r.Schema) for _, f := range fields { - lower := strings.ToLower(f.name) - switch { - case f.format == "password": - return ToHuman, "a password field cannot be answered by a model" - case containsAny(lower, "password", "secret", "token", "apikey", "api_key", "credential"): + if IsSensitiveField(f.name, f.format) { + if f.format == "password" { + return ToHuman, "a password field cannot be answered by a model" + } return ToHuman, "the field " + f.name + " looks like a credential" } } @@ -795,6 +794,19 @@ func Route(r Request) (Audience, string) { return ToAgent, "the agent has the context that raised this" } +// IsSensitiveField reports whether a form field looks like a credential: +// declared format "password", or a name carrying a credential-shaped +// substring. It is the one copy of the heuristics Route routes on, exported +// so the CLI can mask the same fields in its answer review (#1678) instead +// of growing a second, drifting copy. +func IsSensitiveField(name, format string) bool { + if format == "password" { + return true + } + return containsAny(strings.ToLower(name), + "password", "secret", "token", "apikey", "api_key", "credential") +} + type field struct{ name, typ, format string } func schemaFields(raw json.RawMessage) []field {