Problem
Surfaced during expert DX review of #1535.
The args.<vendor>_access_token pattern in adopter extractContext implementations is widespread — every v5 adapter we ship reads it, and the pattern recurs in adapter-side fan-out paths because extractContext's args: Record<string, unknown> makes the unsafe read trivial.
Runtime rejection via credentialPolicy: 'authInfo-only' (#1535) catches these at dispatch time, but build-time detection beats runtime detection — adopters see the issue when they write the code, not when a buyer's request hits production.
Proposal
Ship @adcp/sdk/lint (or npx adcp-doctor mode) — a static-analysis tool that scans adopter codebases for the extractContext-credential-read antipattern.
Concrete starting rule set:
no-credential-read-from-args — flag args.<word>_access_token / args.<word>_secret / args.<word>_password / args.context.<word>_access_token reads in any function whose name matches /^extract(Context|Operational)Context$/ or whose declaring object has OperationalPlatform as a type.
require-account-store-resolve-for-credentials — flag any args.access_token read outside a resolveAccount callback or extractContext.
prefer-authinfo-credential-channel — suggestion-level: code that reads from args.<credential> should consider ctx.authInfo.token / ctx.authInfo.credential instead.
Distribution:
- (a) ESLint plugin (
@adcp/sdk/eslint-plugin) — fits adopter CI, low integration cost
- (b)
npx adcp-doctor mode — one-shot scan, useful for adopters not on ESLint
Recommend (a) primary, (b) as wrapper.
Related
Problem
Surfaced during expert DX review of #1535.
The
args.<vendor>_access_tokenpattern in adopterextractContextimplementations is widespread — every v5 adapter we ship reads it, and the pattern recurs in adapter-side fan-out paths becauseextractContext'sargs: Record<string, unknown>makes the unsafe read trivial.Runtime rejection via
credentialPolicy: 'authInfo-only'(#1535) catches these at dispatch time, but build-time detection beats runtime detection — adopters see the issue when they write the code, not when a buyer's request hits production.Proposal
Ship
@adcp/sdk/lint(ornpx adcp-doctormode) — a static-analysis tool that scans adopter codebases for theextractContext-credential-read antipattern.Concrete starting rule set:
no-credential-read-from-args— flagargs.<word>_access_token/args.<word>_secret/args.<word>_password/args.context.<word>_access_tokenreads in any function whose name matches/^extract(Context|Operational)Context$/or whose declaring object hasOperationalPlatformas a type.require-account-store-resolve-for-credentials— flag anyargs.access_tokenread outside aresolveAccountcallback orextractContext.prefer-authinfo-credential-channel— suggestion-level: code that reads fromargs.<credential>should considerctx.authInfo.token/ctx.authInfo.credentialinstead.Distribution:
@adcp/sdk/eslint-plugin) — fits adopter CI, low integration costnpx adcp-doctormode — one-shot scan, useful for adopters not on ESLintRecommend (a) primary, (b) as wrapper.
Related