Language: TypeScript
Label: safe
CWE: CWE-863 \u2014 Incorrect Authorization
The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.

Code:
              ...(details.responseHeaders || {}),
              'access-control-allow-origin': '*'
            }
          });
        } else {
          const corsHeaders = details.responseHeaders?.['access-control-allow-origin'] || [];
          const corsHeader = corsHeaders.join(',');
          callback({
            cancel: corsHeader !== '*'
          });
        }
        return;
      }
    }
    callback({});
  });