File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -957,10 +957,27 @@ export class SocketSdk {
957957 const results = await Promise . allSettled (
958958 components . map ( async ( { purl } ) => {
959959 const urlPath = `/${ encodeURIComponent ( purl ) } `
960+ // Public endpoint — copy all headers except Authorization
961+ // (case-insensitive per RFC 7230 §3.2), keep agent/signal/timeout.
962+ const publicHeaders : Record < string , string > = {
963+ __proto__ : null ,
964+ } as unknown as Record < string , string >
965+ const srcHeaders = this . #reqOptions. headers as
966+ | Record < string , string >
967+ | undefined
968+ if ( srcHeaders ) {
969+ const keys = Object . keys ( srcHeaders )
970+ for ( let i = 0 , { length } = keys ; i < length ; i += 1 ) {
971+ const key = keys [ i ] !
972+ if ( key . toLowerCase ( ) !== 'authorization' ) {
973+ publicHeaders [ key ] = srcHeaders [ key ] !
974+ }
975+ }
976+ }
960977 const response = await createGetRequest (
961978 SOCKET_FIREWALL_API_URL ,
962979 urlPath ,
963- this . #reqOptions,
980+ { ... this . #reqOptions, headers : publicHeaders } ,
964981 )
965982 if ( ! isResponseOk ( response ) ) return undefined
966983 const json = await getResponseJson ( response )
You can’t perform that action at this time.
0 commit comments