[GH-ISSUE #6504] [Bug] Browser Link metadata uses the last repeated rel parameter instead of the first #3899

Closed
opened 2026-10-31 00:45:03 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @coygeek on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/6504

Before submitting

  • I searched open issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

Evidence, artifacts, or reconstruction

Observed behavior

The projected relation is ["preload"] and agentHints is empty. The first rel="mcp" is overwritten.

Observed at the production metadata-projection boundary with a synthetic CDP response. This is not a browser end-to-end reproduction.

Reproduction

From the built checkout, run this with the repository-pinned Node.js:

node --input-type=module <<'JS'
import { safeResponseMetadata } from './dist/browser/CdpSafeMetadata.js';
const origin = 'https://example.test';
const link = '</agent>; rel="mcp"; rel="preload"';
const result = safeResponseMetadata(
  'request', origin + '/page',
  { mimeType: 'text/html', headers: { Link: link } },
  new Set([origin]),
);
console.log(JSON.stringify({
  rel: result.response.links[0]?.rel,
  agentHints: result.agentHints,
}));
JS

The executed probe passed these exact arguments to the helper. This case and the ordinary </agent>; rel="mcp" control each ran once. The control projected rel: ["mcp"] and one link_rel hint. No post-draft replay is claimed.

Expected behavior

RFC 8288 section 3.3 requires parsers to keep the first rel parameter and ignore later occurrences. The projected relation should be ["mcp"], with the same untrusted Link-derived hint as the control.

Contract: RFC 8288. REA documents structured Link metadata and derived untrusted agent hints in docs/browser-observation.md.

Impact and scope

Repeated rel parameters yield incorrect relation evidence and can suppress a declared agent link or invent one when the parameter order is reversed. Only suppression was executed; the reverse-order consequence is source-derived. Frequency on real targets is NOT_ENOUGH_INFO; only the supplied fixture was exercised. No automatic general workaround was tested.

REA version

Source revision 4c547008c53ee9f0ff2368e7d874a2c3347aa235, package version 6.7.0. Built current main; the published package was not separately replayed.

Runtime and platform

Node.js v24.18.0; Linux x86_64. No browser or CDP connection was started.

Target and artifact context

Synthetic ordinary HTTP Link metadata for https://example.test/page, with all fixture URLs on the selected origin. Header: </agent>; rel="mcp"; rel="preload".

Interface

Other

Production browser metadata helper; CLI/MCP reachability is source-derived.

Earliest failure stage

Capture or observation

Relevant output or evidence

Observed result projection:

{"rel":["preload"],"agentHints":[]}

The public inspect-web-page capture path calls this helper from CdpCaptureEventHandlers.ts:409, then appends its response metadata and agent hints unchanged. The relevant parser is CdpSafeMetadata.ts.

Evidence provenance: observed helper result, with source-derived public reachability. Local verification: reproduced at the producer boundary. Browser acquisition and a full CLI/MCP capture remain untested.

Typed outcome or recovery expected

For this input, retain rel: ["mcp"] and the ordinary page-declared-untrusted hint. The existing single-rel control must keep working.

Analysis or suspected cause

linkParameters writes every occurrence into a Map with set, so later values replace the first. Keeping the first rel value is independent of quoted-string decoding and anchor handling.

Additional context

Targeted open-issue searches for CdpSafeMetadata, Link anchor, Link rel, Link duplicate, and quoted-pair found no matching report. Closed issues were not searched. No source changes were made.

Triage assessment

  • Impact level: P2
  • Assessment status: supported
  • Impact basis: The production projection emits incorrect structured metadata for the concrete Link header above, with a discriminating ordinary-header control.
  • Workaround status: unverified
  • Workaround basis: The source header can be interpreted manually outside this projection, but no general automated recovery workflow for captured targets was tested.
Originally created by @coygeek on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/6504 ## Before submitting - [x] I searched open issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ## Area Evidence, artifacts, or reconstruction ## Observed behavior The projected relation is `["preload"]` and `agentHints` is empty. The first `rel="mcp"` is overwritten. Observed at the production metadata-projection boundary with a synthetic CDP response. This is not a browser end-to-end reproduction. ## Reproduction From the built checkout, run this with the repository-pinned Node.js: ```sh node --input-type=module <<'JS' import { safeResponseMetadata } from './dist/browser/CdpSafeMetadata.js'; const origin = 'https://example.test'; const link = '</agent>; rel="mcp"; rel="preload"'; const result = safeResponseMetadata( 'request', origin + '/page', { mimeType: 'text/html', headers: { Link: link } }, new Set([origin]), ); console.log(JSON.stringify({ rel: result.response.links[0]?.rel, agentHints: result.agentHints, })); JS ``` The executed probe passed these exact arguments to the helper. This case and the ordinary `</agent>; rel="mcp"` control each ran once. The control projected `rel: ["mcp"]` and one `link_rel` hint. No post-draft replay is claimed. ## Expected behavior RFC 8288 section 3.3 requires parsers to keep the first rel parameter and ignore later occurrences. The projected relation should be `["mcp"]`, with the same untrusted Link-derived hint as the control. Contract: [RFC 8288](https://www.rfc-editor.org/rfc/rfc8288.html#section-3.3). REA documents structured Link metadata and derived untrusted agent hints in [docs/browser-observation.md](https://github.com/morluto/rea/blob/4c547008c53ee9f0ff2368e7d874a2c3347aa235/docs/browser-observation.md#L328). ## Impact and scope Repeated rel parameters yield incorrect relation evidence and can suppress a declared agent link or invent one when the parameter order is reversed. Only suppression was executed; the reverse-order consequence is source-derived. Frequency on real targets is NOT_ENOUGH_INFO; only the supplied fixture was exercised. No automatic general workaround was tested. ## REA version Source revision `4c547008c53ee9f0ff2368e7d874a2c3347aa235`, package version `6.7.0`. Built current main; the published package was not separately replayed. ## Runtime and platform Node.js `v24.18.0`; Linux x86_64. No browser or CDP connection was started. ## Target and artifact context Synthetic ordinary HTTP Link metadata for `https://example.test/page`, with all fixture URLs on the selected origin. Header: `</agent>; rel="mcp"; rel="preload"`. ## Interface Other Production browser metadata helper; CLI/MCP reachability is source-derived. ## Earliest failure stage Capture or observation ## Relevant output or evidence Observed result projection: ```json {"rel":["preload"],"agentHints":[]} ``` The public `inspect-web-page` capture path calls this helper from [CdpCaptureEventHandlers.ts:409](https://github.com/morluto/rea/blob/4c547008c53ee9f0ff2368e7d874a2c3347aa235/src/browser/CdpCaptureEventHandlers.ts#L409), then appends its response metadata and agent hints unchanged. The relevant parser is [CdpSafeMetadata.ts](https://github.com/morluto/rea/blob/4c547008c53ee9f0ff2368e7d874a2c3347aa235/src/browser/CdpSafeMetadata.ts#L245-L256). Evidence provenance: observed helper result, with source-derived public reachability. Local verification: reproduced at the producer boundary. Browser acquisition and a full CLI/MCP capture remain untested. ## Typed outcome or recovery expected For this input, retain `rel: ["mcp"]` and the ordinary page-declared-untrusted hint. The existing single-rel control must keep working. ## Analysis or suspected cause `linkParameters` writes every occurrence into a Map with `set`, so later values replace the first. Keeping the first rel value is independent of quoted-string decoding and anchor handling. ## Additional context Targeted open-issue searches for `CdpSafeMetadata`, `Link anchor`, `Link rel`, `Link duplicate`, and `quoted-pair` found no matching report. Closed issues were not searched. No source changes were made. ## Triage assessment - Impact level: P2 - Assessment status: supported - Impact basis: The production projection emits incorrect structured metadata for the concrete Link header above, with a discriminating ordinary-header control. - Workaround status: unverified - Workaround basis: The source header can be interpreted manually outside this projection, but no general automated recovery workflow for captured targets was tested.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#3899
No description provided.