Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions packages/frames.js/src/getAddressForFid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,20 @@ export async function getAddressForFid<
const {
fallbackToCustodyAddress = true,
hubHttpUrl = DEFAULT_HUB_API_URL,
hubRequestOptions = {
headers: {
api_key: DEFAULT_HUB_API_KEY,
},
},
hubRequestOptions = {},
} = options;

const requestOptions = {
...hubRequestOptions,
headers: {
...(hubRequestOptions.headers ?? {}),
api_key: DEFAULT_HUB_API_KEY,
Comment on lines +30 to +31

@vercel vercel Bot Sep 2, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getAddressForFid unconditionally injects Neynar's public DEFAULT_HUB_API_KEY into request headers after the caller's headers, overriding any user-supplied api_key and leaking the Neynar key to custom (non-Neynar) hubs.

Fix on Vercel

},
};

const response = await fetch(
`${hubHttpUrl}/v1/verificationsByFid?fid=${fid}`,
hubRequestOptions
requestOptions
);
const { messages } = (await response
.clone()
Expand Down
16 changes: 10 additions & 6 deletions packages/frames.js/src/getAddressesForFid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,19 @@ export async function getAddressesForFid({
}): Promise<AddressWithType[]> {
const {
hubHttpUrl = DEFAULT_HUB_API_URL,
hubRequestOptions = {
headers: {
api_key: DEFAULT_HUB_API_KEY,
},
},
hubRequestOptions = {},
} = options;

const requestOptions = {
...hubRequestOptions,
headers: {
...(hubRequestOptions.headers ?? {}),
api_key: DEFAULT_HUB_API_KEY,
Comment on lines +40 to +41

@vercel vercel Bot Sep 2, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getAddressesForFid forces api_key: DEFAULT_HUB_API_KEY after spreading user headers, overriding any caller-supplied api_key and leaking Neynar's public key to custom hubs.

Fix on Vercel

},
};

const [verificationsResponse, custodyAddress] = await Promise.all([
fetch(`${hubHttpUrl}/v1/verificationsByFid?fid=${fid}`, hubRequestOptions),
fetch(`${hubHttpUrl}/v1/verificationsByFid?fid=${fid}`, requestOptions),
getCustodyAddressForFid(fid),
]);

Expand Down
22 changes: 13 additions & 9 deletions packages/frames.js/src/getUserDataForFid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,22 @@ export async function getUserDataForFid<
}): Promise<UserDataReturnType> {
const {
hubHttpUrl = DEFAULT_HUB_API_URL,
hubRequestOptions = {
headers: {
api_key: DEFAULT_HUB_API_KEY,
},
},
hubRequestOptions = {},
} = options;

const requestHeaders = {
api_key: DEFAULT_HUB_API_KEY,
...(hubRequestOptions.headers ?? {}),
};

const requestOptions = {
...hubRequestOptions,
headers: requestHeaders,
};
Comment on lines +22 to +30

@vercel vercel Bot Sep 2, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getUserDataForFid unconditionally injects Neynar's public api_key header even for custom (non-Neynar) hubs, leaking the default key contrary to the intended design used elsewhere in the codebase.

Fix on Vercel


const userDataResponse = await fetch(
`${hubHttpUrl}/v1/userDataByFid?fid=${fid}`,
hubRequestOptions
requestOptions
);

const { messages } = (await userDataResponse
Expand Down Expand Up @@ -59,9 +65,7 @@ export async function getUserDataForFid<
const { type, value } = message.data.userDataBody;
const foundValue = acc[type];

if (foundValue && foundValue.timestamp < timestamp) {
acc[type] = { value, timestamp };
} else {
if (!foundValue || foundValue.timestamp < timestamp) {
acc[type] = { value, timestamp };
Comment thread
vercel[bot] marked this conversation as resolved.
}
} catch (error) {
Expand Down
7 changes: 2 additions & 5 deletions packages/frames.js/src/validateFrameMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ export async function validateFrameMessage(
body: FrameActionPayload,
{
hubHttpUrl = DEFAULT_HUB_API_URL,
hubRequestOptions = {
headers: {
api_key: DEFAULT_HUB_API_KEY,
},
},
hubRequestOptions = {},
}: HubHttpUrlOptions = {}
): Promise<{
isValid: boolean;
Expand All @@ -55,6 +51,7 @@ export async function validateFrameMessage(
headers: {
"Content-Type": "application/octet-stream",
...headers,
api_key: DEFAULT_HUB_API_KEY,
Comment on lines 53 to +54

@vercel vercel Bot Sep 2, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validateFrameMessage unconditionally sends Neynar's public api_key and overrides any user-supplied api_key header, breaking auth against custom hubs.

Fix on Vercel

},
body: hexStringToUint8Array(body.trustedData.messageBytes),
...rest,
Expand Down