@adcp/sdk 7.1.0 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/adcp-config.js +10 -1
- package/bin/adcp.js +376 -22
- package/dist/lib/auth/oauth/authorization-required.d.ts +17 -0
- package/dist/lib/auth/oauth/authorization-required.d.ts.map +1 -1
- package/dist/lib/auth/oauth/authorization-required.js +20 -0
- package/dist/lib/auth/oauth/authorization-required.js.map +1 -1
- package/dist/lib/auth/oauth/index.d.ts +1 -1
- package/dist/lib/auth/oauth/index.d.ts.map +1 -1
- package/dist/lib/auth/oauth/index.js +2 -1
- package/dist/lib/auth/oauth/index.js.map +1 -1
- package/dist/lib/core/AgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.js +13 -2
- package/dist/lib/core/SingleAgentClient.js.map +1 -1
- package/dist/lib/discovery/property-crawler.d.ts +13 -1
- package/dist/lib/discovery/property-crawler.d.ts.map +1 -1
- package/dist/lib/discovery/property-crawler.js +40 -14
- package/dist/lib/discovery/property-crawler.js.map +1 -1
- package/dist/lib/discovery/resolve-agent-properties.d.ts +103 -0
- package/dist/lib/discovery/resolve-agent-properties.d.ts.map +1 -0
- package/dist/lib/discovery/resolve-agent-properties.js +182 -0
- package/dist/lib/discovery/resolve-agent-properties.js.map +1 -0
- package/dist/lib/discovery/types.d.ts +41 -2
- package/dist/lib/discovery/types.d.ts.map +1 -1
- package/dist/lib/discovery/types.js +2 -1
- package/dist/lib/discovery/types.js.map +1 -1
- package/dist/lib/discovery/validate-adagents.d.ts +114 -0
- package/dist/lib/discovery/validate-adagents.d.ts.map +1 -0
- package/dist/lib/discovery/validate-adagents.js +417 -0
- package/dist/lib/discovery/validate-adagents.js.map +1 -0
- package/dist/lib/errors/index.d.ts +42 -5
- package/dist/lib/errors/index.d.ts.map +1 -1
- package/dist/lib/errors/index.js +64 -9
- package/dist/lib/errors/index.js.map +1 -1
- package/dist/lib/index.d.ts +3 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +17 -10
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/protocols/a2a.d.ts.map +1 -1
- package/dist/lib/protocols/a2a.js +70 -11
- package/dist/lib/protocols/a2a.js.map +1 -1
- package/dist/lib/protocols/mcp.d.ts.map +1 -1
- package/dist/lib/protocols/mcp.js +61 -5
- package/dist/lib/protocols/mcp.js.map +1 -1
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/signing/fetch-async.d.ts.map +1 -1
- package/dist/lib/signing/fetch-async.js +5 -0
- package/dist/lib/signing/fetch-async.js.map +1 -1
- package/dist/lib/signing/fetch.d.ts.map +1 -1
- package/dist/lib/signing/fetch.js +11 -0
- package/dist/lib/signing/fetch.js.map +1 -1
- package/dist/lib/testing/compliance/comply.d.ts +17 -2
- package/dist/lib/testing/compliance/comply.d.ts.map +1 -1
- package/dist/lib/testing/compliance/comply.js +10 -0
- package/dist/lib/testing/compliance/comply.js.map +1 -1
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/docs/llms.txt +10 -2
- package/package.json +1 -1
- package/skills/call-adcp-agent/SKILL.md +1 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `adagents.json` discovery + validation with the ads.txt `MANAGERDOMAIN`
|
|
3
|
+
* one-hop fallback (adcp#4175 / adcontextprotocol/adcp PR #4173, adcp-client#1717).
|
|
4
|
+
*
|
|
5
|
+
* Discovery order:
|
|
6
|
+
* 1. `https://{publisher}/.well-known/adagents.json` (direct)
|
|
7
|
+
* - if the file carries `authoritative_location`, follow one redirect
|
|
8
|
+
* and report `discovery_method = 'authoritative_location'`
|
|
9
|
+
* 2. On HTTP 404 only — fetch `https://{publisher}/ads.txt`, parse the
|
|
10
|
+
* `MANAGERDOMAIN=` directive, and attempt
|
|
11
|
+
* `https://{managerdomain}/.well-known/adagents.json`.
|
|
12
|
+
* Reports `discovery_method = 'ads_txt_managerdomain'` and
|
|
13
|
+
* `manager_domain`.
|
|
14
|
+
*
|
|
15
|
+
* Per the #4173 resolution of the RFC's open questions:
|
|
16
|
+
* - Only the IAB directive form `MANAGERDOMAIN=example.com` counts;
|
|
17
|
+
* the comment form `# managerdomain=example.com` is rejected.
|
|
18
|
+
* - Duplicate `MANAGERDOMAIN` lines: last-wins (rather than the RFC's
|
|
19
|
+
* fail-closed default — IAB-aligned).
|
|
20
|
+
*
|
|
21
|
+
* Other safety rules from the RFC carry through:
|
|
22
|
+
* - Fallback fires only on 404 (not 5xx / timeout / invalid JSON).
|
|
23
|
+
* - Exactly one hop. The manager-domain file is fetched once, never
|
|
24
|
+
* recursed into.
|
|
25
|
+
* - `publisher → publisher` cycle is rejected.
|
|
26
|
+
* - `#noagents` trailing comment on a `MANAGERDOMAIN` line excludes
|
|
27
|
+
* that entry from fallback discovery.
|
|
28
|
+
* - Manager-domain failure is terminal — never a silent pass.
|
|
29
|
+
*/
|
|
30
|
+
import { type LogLevel } from '../utils/logger';
|
|
31
|
+
import type { AdAgentsJson } from './types';
|
|
32
|
+
/** How the validator located the authoritative `adagents.json` for a publisher. */
|
|
33
|
+
export type DiscoveryMethod = 'direct' | 'authoritative_location' | 'ads_txt_managerdomain';
|
|
34
|
+
export interface AdAgentsValidationResult {
|
|
35
|
+
/** Whether a valid `adagents.json` was discovered for this publisher. */
|
|
36
|
+
valid: boolean;
|
|
37
|
+
/** The publisher domain the caller asked us to validate. */
|
|
38
|
+
publisher_domain: string;
|
|
39
|
+
/**
|
|
40
|
+
* Which discovery path was used. Defaults to `'direct'`: a failure on
|
|
41
|
+
* the publisher's own `.well-known/adagents.json` reports `'direct'`
|
|
42
|
+
* even when no file was retrieved. `'authoritative_location'` and
|
|
43
|
+
* `'ads_txt_managerdomain'` only appear once the validator has
|
|
44
|
+
* committed to that path (followed the pointer / parsed a directive).
|
|
45
|
+
*/
|
|
46
|
+
discovery_method: DiscoveryMethod;
|
|
47
|
+
/**
|
|
48
|
+
* The manager domain consulted when `discovery_method ===
|
|
49
|
+
* 'ads_txt_managerdomain'`. Populated even on manager-domain failure
|
|
50
|
+
* so callers can surface "we tried <manager>" in error reports.
|
|
51
|
+
*
|
|
52
|
+
* Note for chained validators: re-invoking `validateAdAgents` against
|
|
53
|
+
* `manager_domain` to walk N hops re-enters the discovery flow from
|
|
54
|
+
* scratch. This validator's one-hop guarantee is per-call, not
|
|
55
|
+
* per-chain — callers stringing multiple invocations together are
|
|
56
|
+
* responsible for their own loop guard.
|
|
57
|
+
*/
|
|
58
|
+
manager_domain?: string;
|
|
59
|
+
/** URL the `adagents.json` was ultimately loaded from. Omitted when nothing loaded. */
|
|
60
|
+
resolved_url?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Parsed authoritative file. Omitted on failure.
|
|
63
|
+
*
|
|
64
|
+
* **Counterparty-controlled.** This JSON came verbatim from the
|
|
65
|
+
* publisher (or their declared manager domain). Treat as untrusted
|
|
66
|
+
* input: do NOT splice into LLM system prompts, log-aggregator
|
|
67
|
+
* indices, or any context that interprets text as instructions
|
|
68
|
+
* without first stripping or sanitizing. Field names like
|
|
69
|
+
* `authorized_for` (free-text) and `properties[].name` are obvious
|
|
70
|
+
* vectors; less-obvious ones include arbitrary `$schema` URLs and
|
|
71
|
+
* structured `tags`.
|
|
72
|
+
*/
|
|
73
|
+
adagents?: AdAgentsJson;
|
|
74
|
+
/** One or more reasons validation failed. Empty when `valid === true`. */
|
|
75
|
+
errors: string[];
|
|
76
|
+
}
|
|
77
|
+
export interface ValidateAdAgentsOptions {
|
|
78
|
+
/** Per-request timeout in ms (default 10_000). */
|
|
79
|
+
timeoutMs?: number;
|
|
80
|
+
/** Optional User-Agent suffix (validated via `validateUserAgent`). */
|
|
81
|
+
userAgent?: string;
|
|
82
|
+
/** Logger level (default `'warn'`). */
|
|
83
|
+
logLevel?: LogLevel;
|
|
84
|
+
/**
|
|
85
|
+
* Build the URL for a `domain` + well-known `path` pair. Defaults to
|
|
86
|
+
* `https://{domain}{path}`. Provide a custom builder to point the
|
|
87
|
+
* validator at a loopback test server (`http://...`), an internal
|
|
88
|
+
* mirror, or a CDN-rewriting host.
|
|
89
|
+
*/
|
|
90
|
+
urlForDomain?: (domain: string, path: string) => string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Validate `adagents.json` for a publisher domain. Implements the
|
|
94
|
+
* ads.txt `MANAGERDOMAIN` one-hop fallback specified in adcp#4175.
|
|
95
|
+
*/
|
|
96
|
+
export declare function validateAdAgents(publisherDomain: string, options?: ValidateAdAgentsOptions): Promise<AdAgentsValidationResult>;
|
|
97
|
+
/**
|
|
98
|
+
* Parse a MANAGERDOMAIN directive out of an ads.txt body. Returns the
|
|
99
|
+
* lowercased host token (last-wins on duplicates) or `undefined` when
|
|
100
|
+
* no eligible directive is present.
|
|
101
|
+
*
|
|
102
|
+
* Eligibility rules (per adcp-client#1717 / adcp#4175 + #4173 resolution):
|
|
103
|
+
* - Directive form `MANAGERDOMAIN=<host>` only. Case-insensitive on
|
|
104
|
+
* the key; the value preserves no case. Comment-only lines like
|
|
105
|
+
* `# managerdomain=...` are rejected.
|
|
106
|
+
* - Value must be a host token (no scheme, no path, no whitespace).
|
|
107
|
+
* - Trailing inline comment containing `noagents` (case-insensitive)
|
|
108
|
+
* opts that entry out of fallback discovery.
|
|
109
|
+
* - Duplicate eligible entries: the last one wins.
|
|
110
|
+
*
|
|
111
|
+
* Exported for direct unit testing.
|
|
112
|
+
*/
|
|
113
|
+
export declare function parseManagerDomain(adsTxt: string): string | undefined;
|
|
114
|
+
//# sourceMappingURL=validate-adagents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-adagents.d.ts","sourceRoot":"","sources":["../../../src/lib/discovery/validate-adagents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAgB,KAAK,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+
exports.parseManagerDomain = parseManagerDomain;
|
|
5
|
+
/**
|
|
6
|
+
* `adagents.json` discovery + validation with the ads.txt `MANAGERDOMAIN`
|
|
7
|
+
* one-hop fallback (adcp#4175 / adcontextprotocol/adcp PR #4173, adcp-client#1717).
|
|
8
|
+
*
|
|
9
|
+
* Discovery order:
|
|
10
|
+
* 1. `https://{publisher}/.well-known/adagents.json` (direct)
|
|
11
|
+
* - if the file carries `authoritative_location`, follow one redirect
|
|
12
|
+
* and report `discovery_method = 'authoritative_location'`
|
|
13
|
+
* 2. On HTTP 404 only — fetch `https://{publisher}/ads.txt`, parse the
|
|
14
|
+
* `MANAGERDOMAIN=` directive, and attempt
|
|
15
|
+
* `https://{managerdomain}/.well-known/adagents.json`.
|
|
16
|
+
* Reports `discovery_method = 'ads_txt_managerdomain'` and
|
|
17
|
+
* `manager_domain`.
|
|
18
|
+
*
|
|
19
|
+
* Per the #4173 resolution of the RFC's open questions:
|
|
20
|
+
* - Only the IAB directive form `MANAGERDOMAIN=example.com` counts;
|
|
21
|
+
* the comment form `# managerdomain=example.com` is rejected.
|
|
22
|
+
* - Duplicate `MANAGERDOMAIN` lines: last-wins (rather than the RFC's
|
|
23
|
+
* fail-closed default — IAB-aligned).
|
|
24
|
+
*
|
|
25
|
+
* Other safety rules from the RFC carry through:
|
|
26
|
+
* - Fallback fires only on 404 (not 5xx / timeout / invalid JSON).
|
|
27
|
+
* - Exactly one hop. The manager-domain file is fetched once, never
|
|
28
|
+
* recursed into.
|
|
29
|
+
* - `publisher → publisher` cycle is rejected.
|
|
30
|
+
* - `#noagents` trailing comment on a `MANAGERDOMAIN` line excludes
|
|
31
|
+
* that entry from fallback discovery.
|
|
32
|
+
* - Manager-domain failure is terminal — never a silent pass.
|
|
33
|
+
*/
|
|
34
|
+
const logger_1 = require("../utils/logger");
|
|
35
|
+
const version_1 = require("../version");
|
|
36
|
+
const validate_user_agent_1 = require("../utils/validate-user-agent");
|
|
37
|
+
const ssrf_fetch_1 = require("../net/ssrf-fetch");
|
|
38
|
+
const probe_policy_1 = require("../utils/probe-policy");
|
|
39
|
+
const DEFAULT_TIMEOUT_MS = 10_000;
|
|
40
|
+
const MAX_ADAGENTS_BYTES = 256 * 1024;
|
|
41
|
+
const MAX_ADS_TXT_BYTES = 256 * 1024;
|
|
42
|
+
const FETCH_HEADERS = {
|
|
43
|
+
Accept: 'application/json, text/plain, */*',
|
|
44
|
+
'Accept-Language': 'en-US,en;q=0.9',
|
|
45
|
+
'Accept-Encoding': 'gzip, deflate, br',
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Validate `adagents.json` for a publisher domain. Implements the
|
|
49
|
+
* ads.txt `MANAGERDOMAIN` one-hop fallback specified in adcp#4175.
|
|
50
|
+
*/
|
|
51
|
+
async function validateAdAgents(publisherDomain, options = {}) {
|
|
52
|
+
if (!publisherDomain || typeof publisherDomain !== 'string') {
|
|
53
|
+
throw new Error('publisherDomain must be a non-empty string');
|
|
54
|
+
}
|
|
55
|
+
if (options.userAgent) {
|
|
56
|
+
(0, validate_user_agent_1.validateUserAgent)(options.userAgent);
|
|
57
|
+
}
|
|
58
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
59
|
+
const logger = (0, logger_1.createLogger)({ level: options.logLevel ?? 'warn' }).child('validateAdAgents');
|
|
60
|
+
const userAgentHeader = `adcp-validate-adagents/${version_1.LIBRARY_VERSION} (+https://adcontextprotocol.org)`;
|
|
61
|
+
const fromHeader = options.userAgent
|
|
62
|
+
? `adcp-validate-adagents@adcontextprotocol.org (${options.userAgent}; v${version_1.LIBRARY_VERSION})`
|
|
63
|
+
: `adcp-validate-adagents@adcontextprotocol.org (v${version_1.LIBRARY_VERSION})`;
|
|
64
|
+
const publisher = publisherDomain.toLowerCase();
|
|
65
|
+
const buildUrl = options.urlForDomain ?? ((domain, path) => `https://${domain}${path}`);
|
|
66
|
+
const publisherUrl = buildUrl(publisher, '/.well-known/adagents.json');
|
|
67
|
+
// Step 1: try the publisher's canonical location.
|
|
68
|
+
const direct = await fetchJsonOrStatus(publisherUrl, {
|
|
69
|
+
timeoutMs,
|
|
70
|
+
maxBodyBytes: MAX_ADAGENTS_BYTES,
|
|
71
|
+
userAgentHeader,
|
|
72
|
+
fromHeader,
|
|
73
|
+
});
|
|
74
|
+
if (direct.kind === 'ok') {
|
|
75
|
+
const data = coerceAdAgentsObject(direct.data);
|
|
76
|
+
if (!data) {
|
|
77
|
+
return {
|
|
78
|
+
valid: false,
|
|
79
|
+
publisher_domain: publisher,
|
|
80
|
+
discovery_method: 'direct',
|
|
81
|
+
resolved_url: publisherUrl,
|
|
82
|
+
errors: ['adagents.json fetch failed: invalid JSON: response is not a JSON object'],
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
// Handle `authoritative_location` indirection: a pointer file with no
|
|
86
|
+
// inline `authorized_agents` should be followed exactly once.
|
|
87
|
+
if (data.authoritative_location && !data.authorized_agents) {
|
|
88
|
+
const target = data.authoritative_location;
|
|
89
|
+
// Production: HTTPS-only. Loopback test runs (gated by
|
|
90
|
+
// ADCP_ALLOW_INTERNAL_PROBES=1) may use `http://` against a
|
|
91
|
+
// 127.0.0.1 server — the same opt-in that lets `ssrfSafeFetch`
|
|
92
|
+
// touch loopback in the first place.
|
|
93
|
+
const allowHttp = (0, probe_policy_1.isInternalProbesAllowed)();
|
|
94
|
+
if (!target.startsWith('https://') && !(allowHttp && target.startsWith('http://'))) {
|
|
95
|
+
return {
|
|
96
|
+
valid: false,
|
|
97
|
+
publisher_domain: publisher,
|
|
98
|
+
discovery_method: 'authoritative_location',
|
|
99
|
+
resolved_url: publisherUrl,
|
|
100
|
+
errors: [`authoritative_location must use https://, got: ${target}`],
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
// Normalize before cycle-comparing — string equality misses
|
|
104
|
+
// trivial bounce variants (trailing slash, `?query`, fragment,
|
|
105
|
+
// uppercase scheme). Worst case of missing one of these is a
|
|
106
|
+
// wasted RTT against the publisher's own server, not SSRF
|
|
107
|
+
// (still routed through `ssrfSafeFetch`), but the right check
|
|
108
|
+
// is on origin+pathname.
|
|
109
|
+
if (sameOriginAndPath(target, publisherUrl)) {
|
|
110
|
+
return {
|
|
111
|
+
valid: false,
|
|
112
|
+
publisher_domain: publisher,
|
|
113
|
+
discovery_method: 'authoritative_location',
|
|
114
|
+
resolved_url: publisherUrl,
|
|
115
|
+
errors: ['authoritative_location points back to the publisher (cycle)'],
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
const followed = await fetchJsonOrStatus(target, {
|
|
119
|
+
timeoutMs,
|
|
120
|
+
maxBodyBytes: MAX_ADAGENTS_BYTES,
|
|
121
|
+
userAgentHeader,
|
|
122
|
+
fromHeader,
|
|
123
|
+
});
|
|
124
|
+
if (followed.kind !== 'ok') {
|
|
125
|
+
return {
|
|
126
|
+
valid: false,
|
|
127
|
+
publisher_domain: publisher,
|
|
128
|
+
discovery_method: 'authoritative_location',
|
|
129
|
+
resolved_url: target,
|
|
130
|
+
errors: [`authoritative_location fetch failed: ${describeOutcome(followed)}`],
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const followedAdAgents = coerceAdAgentsObject(followed.data);
|
|
134
|
+
if (!followedAdAgents) {
|
|
135
|
+
return {
|
|
136
|
+
valid: false,
|
|
137
|
+
publisher_domain: publisher,
|
|
138
|
+
discovery_method: 'authoritative_location',
|
|
139
|
+
resolved_url: target,
|
|
140
|
+
errors: ['authoritative_location target returned a non-object JSON value'],
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
valid: true,
|
|
145
|
+
publisher_domain: publisher,
|
|
146
|
+
discovery_method: 'authoritative_location',
|
|
147
|
+
resolved_url: target,
|
|
148
|
+
adagents: followedAdAgents,
|
|
149
|
+
errors: [],
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
valid: true,
|
|
154
|
+
publisher_domain: publisher,
|
|
155
|
+
discovery_method: 'direct',
|
|
156
|
+
resolved_url: publisherUrl,
|
|
157
|
+
adagents: data,
|
|
158
|
+
errors: [],
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
// Step 2: managerdomain fallback only fires on 404. Other failures
|
|
162
|
+
// (5xx, timeout, malformed JSON, SSRF refusal) are terminal under the
|
|
163
|
+
// RFC's "Only trigger fallback on 404" rule.
|
|
164
|
+
if (direct.kind !== 'not_found') {
|
|
165
|
+
return {
|
|
166
|
+
valid: false,
|
|
167
|
+
publisher_domain: publisher,
|
|
168
|
+
discovery_method: 'direct',
|
|
169
|
+
errors: [`adagents.json fetch failed: ${describeOutcome(direct)}`],
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
// Step 3: fetch ads.txt and look for a MANAGERDOMAIN= directive.
|
|
173
|
+
const adsTxtUrl = buildUrl(publisher, '/ads.txt');
|
|
174
|
+
const adsTxt = await fetchTextOrStatus(adsTxtUrl, {
|
|
175
|
+
timeoutMs,
|
|
176
|
+
maxBodyBytes: MAX_ADS_TXT_BYTES,
|
|
177
|
+
userAgentHeader,
|
|
178
|
+
fromHeader,
|
|
179
|
+
});
|
|
180
|
+
if (adsTxt.kind !== 'ok') {
|
|
181
|
+
return {
|
|
182
|
+
valid: false,
|
|
183
|
+
publisher_domain: publisher,
|
|
184
|
+
discovery_method: 'direct',
|
|
185
|
+
errors: [`adagents.json missing (404) and ads.txt unavailable: ${describeOutcome(adsTxt)}`],
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
const managerDomain = parseManagerDomain(adsTxt.text);
|
|
189
|
+
if (!managerDomain) {
|
|
190
|
+
return {
|
|
191
|
+
valid: false,
|
|
192
|
+
publisher_domain: publisher,
|
|
193
|
+
discovery_method: 'direct',
|
|
194
|
+
errors: ['adagents.json missing (404) and no eligible MANAGERDOMAIN directive in ads.txt'],
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
if (managerDomain === publisher) {
|
|
198
|
+
return {
|
|
199
|
+
valid: false,
|
|
200
|
+
publisher_domain: publisher,
|
|
201
|
+
discovery_method: 'direct',
|
|
202
|
+
errors: [`MANAGERDOMAIN references the publisher domain itself (cycle): ${managerDomain}`],
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
// Step 4: fetch the manager domain's adagents.json. One hop only —
|
|
206
|
+
// even if this file has its own `authoritative_location`, we do NOT
|
|
207
|
+
// follow it (the RFC restricts to one hop publisher → managerdomain).
|
|
208
|
+
const managerUrl = buildUrl(managerDomain, '/.well-known/adagents.json');
|
|
209
|
+
const manager = await fetchJsonOrStatus(managerUrl, {
|
|
210
|
+
timeoutMs,
|
|
211
|
+
maxBodyBytes: MAX_ADAGENTS_BYTES,
|
|
212
|
+
userAgentHeader,
|
|
213
|
+
fromHeader,
|
|
214
|
+
});
|
|
215
|
+
if (manager.kind !== 'ok') {
|
|
216
|
+
logger.debug(`Manager domain ${managerDomain} adagents.json fetch failed: ${describeOutcome(manager)}`);
|
|
217
|
+
return {
|
|
218
|
+
valid: false,
|
|
219
|
+
publisher_domain: publisher,
|
|
220
|
+
discovery_method: 'ads_txt_managerdomain',
|
|
221
|
+
manager_domain: managerDomain,
|
|
222
|
+
errors: [`Manager domain adagents.json fetch failed: ${describeOutcome(manager)}`],
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
const managerAdAgents = coerceAdAgentsObject(manager.data);
|
|
226
|
+
if (!managerAdAgents) {
|
|
227
|
+
return {
|
|
228
|
+
valid: false,
|
|
229
|
+
publisher_domain: publisher,
|
|
230
|
+
discovery_method: 'ads_txt_managerdomain',
|
|
231
|
+
manager_domain: managerDomain,
|
|
232
|
+
errors: ['Manager domain adagents.json returned a non-object JSON value'],
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
return {
|
|
236
|
+
valid: true,
|
|
237
|
+
publisher_domain: publisher,
|
|
238
|
+
discovery_method: 'ads_txt_managerdomain',
|
|
239
|
+
manager_domain: managerDomain,
|
|
240
|
+
resolved_url: managerUrl,
|
|
241
|
+
adagents: managerAdAgents,
|
|
242
|
+
errors: [],
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Narrow `JSON.parse` output to a plain object — rejects `null`,
|
|
247
|
+
* arrays, primitives. Empty-body responses decode to `null` and
|
|
248
|
+
* pass the JSON parser; downstream code paths assume an object and
|
|
249
|
+
* would crash on null without this guard (#1720 review).
|
|
250
|
+
*/
|
|
251
|
+
function coerceAdAgentsObject(value) {
|
|
252
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
253
|
+
return null;
|
|
254
|
+
return value;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Parse a MANAGERDOMAIN directive out of an ads.txt body. Returns the
|
|
258
|
+
* lowercased host token (last-wins on duplicates) or `undefined` when
|
|
259
|
+
* no eligible directive is present.
|
|
260
|
+
*
|
|
261
|
+
* Eligibility rules (per adcp-client#1717 / adcp#4175 + #4173 resolution):
|
|
262
|
+
* - Directive form `MANAGERDOMAIN=<host>` only. Case-insensitive on
|
|
263
|
+
* the key; the value preserves no case. Comment-only lines like
|
|
264
|
+
* `# managerdomain=...` are rejected.
|
|
265
|
+
* - Value must be a host token (no scheme, no path, no whitespace).
|
|
266
|
+
* - Trailing inline comment containing `noagents` (case-insensitive)
|
|
267
|
+
* opts that entry out of fallback discovery.
|
|
268
|
+
* - Duplicate eligible entries: the last one wins.
|
|
269
|
+
*
|
|
270
|
+
* Exported for direct unit testing.
|
|
271
|
+
*/
|
|
272
|
+
function parseManagerDomain(adsTxt) {
|
|
273
|
+
if (!adsTxt)
|
|
274
|
+
return undefined;
|
|
275
|
+
// Strip BOM if present — common on Windows-authored ads.txt files.
|
|
276
|
+
// `charCodeAt` + `slice` is clearer than a regex match against a
|
|
277
|
+
// literal U+FEFF (per #1720 review).
|
|
278
|
+
const body = adsTxt.charCodeAt(0) === 0xfeff ? adsTxt.slice(1) : adsTxt;
|
|
279
|
+
let last;
|
|
280
|
+
for (const rawLine of body.split(/\r?\n/)) {
|
|
281
|
+
// Split off any inline comment so the directive parser only sees
|
|
282
|
+
// the code part, but keep the comment text around for the
|
|
283
|
+
// `#noagents` opt-out check.
|
|
284
|
+
const hashIdx = rawLine.indexOf('#');
|
|
285
|
+
const code = (hashIdx === -1 ? rawLine : rawLine.slice(0, hashIdx)).trim();
|
|
286
|
+
const comment = hashIdx === -1 ? '' : rawLine.slice(hashIdx + 1);
|
|
287
|
+
if (!code)
|
|
288
|
+
continue;
|
|
289
|
+
// Directive form only: KEY=VALUE on its own line, key matched
|
|
290
|
+
// case-insensitively. We parse with `indexOf('=')` rather than a
|
|
291
|
+
// regex because `code` is uncontrolled network input — any regex
|
|
292
|
+
// shape like `^KEY\s*=\s*(...)$` invites polynomial-ReDoS backtracking
|
|
293
|
+
// on pathological whitespace-heavy lines (flagged by CodeQL).
|
|
294
|
+
const eq = code.indexOf('=');
|
|
295
|
+
if (eq === -1)
|
|
296
|
+
continue;
|
|
297
|
+
if (code.slice(0, eq).trim().toLowerCase() !== 'managerdomain')
|
|
298
|
+
continue;
|
|
299
|
+
const value = code.slice(eq + 1).trim();
|
|
300
|
+
if (!value)
|
|
301
|
+
continue;
|
|
302
|
+
if (!isEligibleHostToken(value))
|
|
303
|
+
continue;
|
|
304
|
+
if (/\bnoagents\b/i.test(comment))
|
|
305
|
+
continue;
|
|
306
|
+
last = value.toLowerCase();
|
|
307
|
+
}
|
|
308
|
+
return last;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* URL equality for cycle detection. Compares lowercased origin
|
|
312
|
+
* (scheme + host + port) and pathname; ignores trailing slashes,
|
|
313
|
+
* query strings, fragments, and scheme case. Returns false on
|
|
314
|
+
* unparseable URLs (callers treat unparseable as "not a cycle" so
|
|
315
|
+
* `ssrfSafeFetch` can produce a cleaner error downstream).
|
|
316
|
+
*/
|
|
317
|
+
function sameOriginAndPath(a, b) {
|
|
318
|
+
try {
|
|
319
|
+
const ua = new URL(a);
|
|
320
|
+
const ub = new URL(b);
|
|
321
|
+
if (ua.origin.toLowerCase() !== ub.origin.toLowerCase())
|
|
322
|
+
return false;
|
|
323
|
+
const pathA = ua.pathname.replace(/\/+$/, '');
|
|
324
|
+
const pathB = ub.pathname.replace(/\/+$/, '');
|
|
325
|
+
return pathA === pathB;
|
|
326
|
+
}
|
|
327
|
+
catch {
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
function isEligibleHostToken(value) {
|
|
332
|
+
if (!value)
|
|
333
|
+
return false;
|
|
334
|
+
// Reject anything with whitespace, slashes, or query strings.
|
|
335
|
+
if (/[\s/?#]/.test(value))
|
|
336
|
+
return false;
|
|
337
|
+
// Reject anything that looks like a URL (`scheme:` prefix). The single
|
|
338
|
+
// `:` permitted in a host token is the port separator handled below —
|
|
339
|
+
// so look for the colon-before-slash-or-end shape `scheme:...`.
|
|
340
|
+
if (/^[a-z][a-z0-9+.-]*:[^0-9]/i.test(value))
|
|
341
|
+
return false;
|
|
342
|
+
// Split off an optional `:port` suffix. Port must be 1–5 digits.
|
|
343
|
+
const portMatch = value.match(/^(.*?):([0-9]{1,5})$/);
|
|
344
|
+
const host = portMatch?.[1] ?? value;
|
|
345
|
+
// Minimal hostname shape — at least one dot, labels per RFC 1035-ish.
|
|
346
|
+
// Reject `example` (no TLD) and obvious junk like `..` or `-foo.com`.
|
|
347
|
+
if (!/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i.test(host))
|
|
348
|
+
return false;
|
|
349
|
+
return true;
|
|
350
|
+
}
|
|
351
|
+
async function fetchJsonOrStatus(url, opts) {
|
|
352
|
+
const raw = await rawFetch(url, opts);
|
|
353
|
+
if (raw.kind !== 'ok-text')
|
|
354
|
+
return raw;
|
|
355
|
+
try {
|
|
356
|
+
return { kind: 'ok', data: JSON.parse(raw.text) };
|
|
357
|
+
}
|
|
358
|
+
catch (err) {
|
|
359
|
+
return { kind: 'parse_error', message: err instanceof Error ? err.message : 'invalid JSON' };
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
async function fetchTextOrStatus(url, opts) {
|
|
363
|
+
const raw = await rawFetch(url, opts);
|
|
364
|
+
if (raw.kind === 'ok-text')
|
|
365
|
+
return { kind: 'ok', text: raw.text };
|
|
366
|
+
return raw;
|
|
367
|
+
}
|
|
368
|
+
async function rawFetch(url, opts) {
|
|
369
|
+
try {
|
|
370
|
+
const result = await (0, ssrf_fetch_1.ssrfSafeFetch)(url, {
|
|
371
|
+
timeoutMs: opts.timeoutMs,
|
|
372
|
+
allowPrivateIp: (0, probe_policy_1.isInternalProbesAllowed)(),
|
|
373
|
+
maxBodyBytes: opts.maxBodyBytes,
|
|
374
|
+
headers: {
|
|
375
|
+
...FETCH_HEADERS,
|
|
376
|
+
'User-Agent': opts.userAgentHeader,
|
|
377
|
+
From: opts.fromHeader,
|
|
378
|
+
},
|
|
379
|
+
});
|
|
380
|
+
if (result.status === 404)
|
|
381
|
+
return { kind: 'not_found' };
|
|
382
|
+
if (result.status < 200 || result.status >= 300) {
|
|
383
|
+
return { kind: 'http_error', status: result.status };
|
|
384
|
+
}
|
|
385
|
+
// Always decode as text — JSON parsing is the caller's choice. This
|
|
386
|
+
// lets ads.txt and adagents.json share the same fetch primitive.
|
|
387
|
+
const decoded = (0, ssrf_fetch_1.decodeBodyAsJsonOrText)(result.body, 'text/plain');
|
|
388
|
+
const text = typeof decoded === 'string' ? decoded : JSON.stringify(decoded);
|
|
389
|
+
return { kind: 'ok-text', text };
|
|
390
|
+
}
|
|
391
|
+
catch (err) {
|
|
392
|
+
if (err instanceof ssrf_fetch_1.SsrfRefusedError) {
|
|
393
|
+
return { kind: 'ssrf_refused', message: err.message };
|
|
394
|
+
}
|
|
395
|
+
return { kind: 'transport_error', message: err instanceof Error ? err.message : String(err) };
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Render a fetch failure into a short, log-safe string. Callers only
|
|
400
|
+
* pass failures here — the `'ok'` branch is excluded at the type level
|
|
401
|
+
* so we don't keep a dead "ok" string lying around (#1720 review).
|
|
402
|
+
*/
|
|
403
|
+
function describeOutcome(outcome) {
|
|
404
|
+
switch (outcome.kind) {
|
|
405
|
+
case 'not_found':
|
|
406
|
+
return 'HTTP 404';
|
|
407
|
+
case 'http_error':
|
|
408
|
+
return `HTTP ${outcome.status}`;
|
|
409
|
+
case 'transport_error':
|
|
410
|
+
return outcome.message;
|
|
411
|
+
case 'parse_error':
|
|
412
|
+
return `invalid JSON: ${outcome.message}`;
|
|
413
|
+
case 'ssrf_refused':
|
|
414
|
+
return `[SSRF refused] ${outcome.message}`;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
//# sourceMappingURL=validate-adagents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-adagents.js","sourceRoot":"","sources":["../../../src/lib/discovery/validate-adagents.ts"],"names":[],"mappings":";;AAiHA,4CA+MC;AA6BD,gDA8BC;AA3XD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,4CAA8D;AAC9D,wCAA6C;AAC7C,sEAAiE;AACjE,kDAA4F;AAC5F,wDAAgE;AAkEhE,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,kBAAkB,GAAG,GAAG,GAAG,IAAI,CAAC;AACtC,MAAM,iBAAiB,GAAG,GAAG,GAAG,IAAI,CAAC;AAErC,MAAM,aAAa,GAAG;IACpB,MAAM,EAAE,mCAAmC;IAC3C,iBAAiB,EAAE,gBAAgB;IACnC,iBAAiB,EAAE,mBAAmB;CACvC,CAAC;AAEF;;;GAGG;AACI,KAAK,UAAU,gBAAgB,CACpC,eAAuB,EACvB,UAAmC,EAAE;IAErC,IAAI,CAAC,eAAe,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE,CAAC;QAC5D,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,C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BAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IAC/C,CAAC;AACH,CAAC"}
|
|
@@ -118,12 +118,39 @@ export interface OAuthMetadataInfo {
|
|
|
118
118
|
/** Issuer identifier */
|
|
119
119
|
issuer?: string;
|
|
120
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Subset of the parsed `WWW-Authenticate` challenge surfaced on
|
|
123
|
+
* {@link AuthenticationRequiredError}. Mirrors the public shape of
|
|
124
|
+
* `WWWAuthenticateChallenge` from `@adcp/sdk/auth/oauth` without forcing the
|
|
125
|
+
* errors module to depend on the auth subtree (the dependency would invert
|
|
126
|
+
* the build graph).
|
|
127
|
+
*
|
|
128
|
+
* `scheme` is lowercased per RFC 9110 §11.6.1.
|
|
129
|
+
*/
|
|
130
|
+
export interface AuthChallengeInfo {
|
|
131
|
+
scheme: string;
|
|
132
|
+
realm?: string;
|
|
133
|
+
scope?: string;
|
|
134
|
+
error?: string;
|
|
135
|
+
error_description?: string;
|
|
136
|
+
}
|
|
121
137
|
/**
|
|
122
138
|
* Error thrown when authentication is required to access an MCP endpoint
|
|
123
139
|
*
|
|
124
140
|
* This error is thrown during MCP endpoint discovery when the server returns
|
|
125
|
-
* a 401 Unauthorized response.
|
|
126
|
-
* the
|
|
141
|
+
* a 401 Unauthorized response. The shape of the remediation depends on what
|
|
142
|
+
* the 401 disclosed:
|
|
143
|
+
*
|
|
144
|
+
* - OAuth metadata (RFC 9728 PRM walk succeeded) → `oauthMetadata` set,
|
|
145
|
+
* message points at the authorization endpoint.
|
|
146
|
+
* - A `WWW-Authenticate` challenge with a non-Bearer scheme (e.g. Basic
|
|
147
|
+
* behind an Apigee/Kong/AWS API GW gateway) → `challenge` set, message
|
|
148
|
+
* names the scheme and the SDK / CLI surface that configures it.
|
|
149
|
+
* - Plain 401 with no metadata → fallback "provide auth_token" message.
|
|
150
|
+
*
|
|
151
|
+
* Consumers branching on `error.challenge?.scheme === 'basic'` can route
|
|
152
|
+
* straight to `auth: { type: 'basic', username, password }` instead of
|
|
153
|
+
* retrying Bearer indefinitely.
|
|
127
154
|
*
|
|
128
155
|
* @example
|
|
129
156
|
* ```typescript
|
|
@@ -131,12 +158,15 @@ export interface OAuthMetadataInfo {
|
|
|
131
158
|
* await client.getProducts({ brief: 'test' });
|
|
132
159
|
* } catch (error) {
|
|
133
160
|
* if (error instanceof AuthenticationRequiredError) {
|
|
134
|
-
* if (error.
|
|
161
|
+
* if (error.challenge?.scheme === 'basic') {
|
|
162
|
+
* // Gateway-fronted agent — configure HTTP Basic
|
|
163
|
+
* reconnect({ auth: { type: 'basic', username, password } });
|
|
164
|
+
* } else if (error.oauthMetadata) {
|
|
135
165
|
* // Redirect user to OAuth flow
|
|
136
166
|
* const authUrl = error.oauthMetadata.authorization_endpoint;
|
|
137
167
|
* console.log(`Please authenticate at: ${authUrl}`);
|
|
138
168
|
* } else {
|
|
139
|
-
* console.log('Authentication required but
|
|
169
|
+
* console.log('Authentication required but no scheme metadata available');
|
|
140
170
|
* }
|
|
141
171
|
* }
|
|
142
172
|
* }
|
|
@@ -145,8 +175,9 @@ export interface OAuthMetadataInfo {
|
|
|
145
175
|
export declare class AuthenticationRequiredError extends ADCPError {
|
|
146
176
|
readonly agentUrl: string;
|
|
147
177
|
readonly oauthMetadata?: OAuthMetadataInfo | undefined;
|
|
178
|
+
readonly challenge?: AuthChallengeInfo | undefined;
|
|
148
179
|
readonly code = "AUTHENTICATION_REQUIRED";
|
|
149
|
-
constructor(agentUrl: string, oauthMetadata?: OAuthMetadataInfo | undefined, message?: string);
|
|
180
|
+
constructor(agentUrl: string, oauthMetadata?: OAuthMetadataInfo | undefined, message?: string, challenge?: AuthChallengeInfo | undefined);
|
|
150
181
|
/**
|
|
151
182
|
* Check if OAuth authentication is available
|
|
152
183
|
*/
|
|
@@ -155,6 +186,12 @@ export declare class AuthenticationRequiredError extends ADCPError {
|
|
|
155
186
|
* Get the authorization URL if OAuth is available
|
|
156
187
|
*/
|
|
157
188
|
get authorizationUrl(): string | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* Lowercased scheme from the `WWW-Authenticate` challenge, when present.
|
|
191
|
+
* `'basic'` is the common non-OAuth case — gateway-fronted agents speaking
|
|
192
|
+
* RFC 7617.
|
|
193
|
+
*/
|
|
194
|
+
get suggestedScheme(): string | undefined;
|
|
158
195
|
}
|
|
159
196
|
/**
|
|
160
197
|
* Error thrown when a request reused an `idempotency_key` with a different
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/errors/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,8BAAsB,SAAU,SAAQ,KAAK;IAKlC,OAAO,CAAC,EAAE,OAAO;IAJ1B,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAG7B,OAAO,EAAE,MAAM,EACR,OAAO,CAAC,EAAE,OAAO,YAAA;CAK3B;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;aAI3B,MAAM,EAAE,MAAM;aACd,OAAO,EAAE,MAAM;IAJjC,QAAQ,CAAC,IAAI,kBAAkB;gBAGb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM;CAIlC;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,SAAS;aAIhC,MAAM,EAAE,MAAM;aACd,WAAW,EAAE,MAAM;IAJrC,QAAQ,CAAC,IAAI,wBAAwB;gBAGnB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM;CAItC;AAED;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,SAAS;aAGlB,KAAK,EAAE,MAAM;IAFzC,QAAQ,CAAC,IAAI,mBAAmB;gBAEJ,KAAK,EAAE,MAAM;CAG1C;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;aAI3B,MAAM,EAAE,MAAM;aACd,MAAM,CAAC,EAAE,MAAM;IAJjC,QAAQ,CAAC,IAAI,kBAAkB;gBAGb,MAAM,EAA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