Rocky_Mountain_Vending/.pnpm-store/v10/files/43/7154f02136c0a58df7cb5b48a57e33a4b60fdc27cd6c8dab432f9908d0223cadf112dbdef64073af0bd7f2c220af2bcfae4e2664bb23fabb2c07a3e3d71788
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

75 lines
2.2 KiB
Text

import { MCP_REQUEST_ARGUMENT, MCP_TOOL_RESULT_PREFIX, MCP_PROMPT_RESULT_PREFIX, CLIENT_ADDRESS_ATTRIBUTE, CLIENT_PORT_ATTRIBUTE, MCP_LOGGING_MESSAGE_ATTRIBUTE, MCP_PROMPT_RESULT_DESCRIPTION_ATTRIBUTE, MCP_PROMPT_RESULT_MESSAGE_CONTENT_ATTRIBUTE, MCP_RESOURCE_URI_ATTRIBUTE, MCP_TOOL_RESULT_CONTENT_ATTRIBUTE } from './attributes.js';
/**
* PII attributes that should be removed when sendDefaultPii is false
* @internal
*/
const PII_ATTRIBUTES = new Set([
CLIENT_ADDRESS_ATTRIBUTE,
CLIENT_PORT_ATTRIBUTE,
MCP_LOGGING_MESSAGE_ATTRIBUTE,
MCP_PROMPT_RESULT_DESCRIPTION_ATTRIBUTE,
MCP_PROMPT_RESULT_MESSAGE_CONTENT_ATTRIBUTE,
MCP_RESOURCE_URI_ATTRIBUTE,
MCP_TOOL_RESULT_CONTENT_ATTRIBUTE,
]);
/**
* Checks if an attribute key should be considered PII.
*
* Returns true for:
* - Explicit PII attributes (client.address, client.port, mcp.logging.message, etc.)
* - All request arguments (mcp.request.argument.*)
* - Tool and prompt result content (mcp.tool.result.*, mcp.prompt.result.*) except metadata
*
* Preserves metadata attributes ending with _count, _error, or .is_error as they don't contain sensitive data.
*
* @param key - Attribute key to evaluate
* @returns true if the attribute should be filtered out (is PII), false if it should be preserved
* @internal
*/
function isPiiAttribute(key) {
if (PII_ATTRIBUTES.has(key)) {
return true;
}
if (key.startsWith(`${MCP_REQUEST_ARGUMENT}.`)) {
return true;
}
if (key.startsWith(`${MCP_TOOL_RESULT_PREFIX}.`) || key.startsWith(`${MCP_PROMPT_RESULT_PREFIX}.`)) {
if (!key.endsWith('_count') && !key.endsWith('_error') && !key.endsWith('.is_error')) {
return true;
}
}
return false;
}
/**
* Removes PII attributes from span data when sendDefaultPii is false
* @param spanData - Raw span attributes
* @param sendDefaultPii - Whether to include PII data
* @returns Filtered span attributes
*/
function filterMcpPiiFromSpanData(
spanData,
sendDefaultPii,
) {
if (sendDefaultPii) {
return spanData ;
}
return Object.entries(spanData).reduce(
(acc, [key, value]) => {
if (!isPiiAttribute(key)) {
acc[key] = value ;
}
return acc;
},
{} ,
);
}
export { filterMcpPiiFromSpanData };
//# sourceMappingURL=piiFiltering.js.map