{
  "generated_at": "2026-09-20T11:07:34.522781+00:00",
  "reference_commit": "036a20b3ca712ac9175bba68c8ff1d9f2f2aecde",
  "image_id": "sha256:42357c39e76d906d451ff2fb54c88666078691d6e5b4787f5476a0faf00fb003",
  "anthropic_version": "0.94.0",
  "scope": "Archived adapter helper extracted with AST; actual loopback HTTP requests, no external network or LLM. Not full agent execution, concurrency test or retrospective score change.",
  "runs": [
    {
      "id": "baseline",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. Bearer-only construction leaves\n    ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) and\n    sends dual auth — X-Api-Key *and* Authorization: Bearer — on every Portal/MiniMax/OAuth/Entra\n    request; clear it whenever we intentionally authenticated via auth_token.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    return client",
      "sha256": "40128a54b62d7c06498b751b2f6626144924887ec11a634b9e03109d290c01b0",
      "checks": {
        "api_key_original": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "unchanged_helper"
    },
    {
      "id": "upstream-reference",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached, sending exactly ONE credential.\n\n    The SDK fills whichever of ``api_key`` / ``auth_token`` we left unset from ANTHROPIC_API_KEY /\n    ANTHROPIC_AUTH_TOKEN in the environment (both loaded from ~/.hermes/.env) and then sends dual\n    auth — x-api-key *and* Authorization: Bearer — shipping a foreign credential to Portal / MiniMax\n    / OAuth / Entra / third-party endpoints (#26970, #105774). An ``Omit()`` default header is the\n    SDK-sanctioned way to drop the other header, and unlike an attribute clear it survives\n    ``with_options()``, which re-runs the constructor and re-reads the environment.\"\"\"\n    merged = dict(headers)\n    if \"api_key\" in kwargs and \"auth_token\" not in kwargs:\n        merged[\"Authorization\"] = sdk.Omit()\n    elif \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        merged[\"X-Api-Key\"] = sdk.Omit()\n    if merged:\n        kwargs[\"default_headers\"] = merged\n    return sdk.Anthropic(**kwargs)",
      "sha256": "fa8f4c431abb9ce39ad5ce666970c6528b23d2236aae46ea19aa960e58763bc0",
      "checks": {
        "api_key_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": false,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": true,
          "request_captured": true,
          "authorization_present": false,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        }
      },
      "mechanism": "header_omit"
    },
    {
      "id": "hermes-deepseekv4.1flash-ep1-f005-r7",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. Bearer-only construction leaves\n    ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) and\n    sends dual auth — X-Api-Key *and* Authorization: Bearer *** on every Portal/MiniMax/OAuth/Entra\n    request; clear it whenever we intentionally authenticated via auth_token. Symmetrically,\n    api_key-only construction (a custom provider with its own key) must clear ``auth_token``: the SDK\n    falls back to ANTHROPIC_AUTH_TOKEN from the environment when ``auth_token`` is not passed and\n    would attach that unrelated credential as a Bearer header alongside our x-api-key. Passing\n    ``auth_token=None`` does NOT suppress it — None *means* \"fall back to env\" to the SDK — so the\n    env-sourced token must be cleared on the constructed client.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    elif \"api_key\" in kwargs and \"auth_token\" not in kwargs:\n        client.auth_token = None  # never let a foreign ANTHROPIC_AUTH_TOKEN ride along\n    return client",
      "sha256": "f96b92d9d42b561ca0401dd269e96bf915ceecffcff398101112ee56bdeb109b",
      "checks": {
        "api_key_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": false,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "attribute_clear"
    },
    {
      "id": "hermes-deepseekv4.1flash-ep1-f005-r8",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. The SDK independently env-fills both\n    ``api_key`` (ANTHROPIC_API_KEY) and ``auth_token`` (ANTHROPIC_AUTH_TOKEN), and sends whichever\n    are set — ``auth_headers`` is ``{X-Api-Key} | {Authorization: Bearer}``. Two consequences:\n\n    * Bearer-only construction leaves ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY\n      (loaded from ~/.hermes/.env) and sends dual auth — X-Api-Key *and* Authorization: Bearer —\n      on every Portal/MiniMax/OAuth/Entra request; clear it whenever we intentionally authenticated\n      via auth_token.\n    * Key-only construction leaves ``auth_token`` unset, so the SDK fills it from\n      ANTHROPIC_AUTH_TOKEN (commonly an unrelated account/proxy credential) and leaks it to the\n      endpoint alongside our own x-api-key; clear it whenever we intentionally authenticated via\n      api_key. ``auth_token=None`` is not enough — the SDK treats None as \"fall back to env\", so the\n      attribute must be cleared after construction. Explicit OAuth/setup-token and Entra flows pass\n      ``auth_token`` themselves and keep their Bearer header.\n    \"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    elif \"api_key\" in kwargs and \"auth_token\" not in kwargs:\n        client.auth_token = None\n    return client",
      "sha256": "ac4ee1271172ea431185896669a4e1679195b92fc022691eb459d8fad8234f77",
      "checks": {
        "api_key_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": false,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "attribute_clear"
    },
    {
      "id": "hermes-deepseekv4pro-ep1-f005-r11",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. Bearer-only construction leaves\n    ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) and\n    sends dual auth — X-Api-Key *and* Authorization: Bearer — on every Portal/MiniMax/OAuth/Entra\n    request; clear it whenever we intentionally authenticated via auth_token.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    if \"api_key\" in kwargs and \"auth_token\" not in kwargs:\n        client.auth_token = None\n    return client",
      "sha256": "b826ef6f0399fc70e91502e7ac1c40d24dde2c24d7e792e9a49f3c7364f31cae",
      "checks": {
        "api_key_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": false,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "attribute_clear"
    },
    {
      "id": "hermes-deepseekv4pro-ep1-f005-r12",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. Bearer-only construction leaves\n    ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) and\n    sends dual auth — X-Api-Key *and* Authorization: Bearer *** on every Portal/MiniMax/OAuth/Entra\n    request; clear it whenever we intentionally authenticated via auth_token. Similarly, api_key-only\n    construction (third-party providers) must clear auth_token so the SDK doesn't leak\n    ANTHROPIC_AUTH_TOKEN from the environment to a foreign endpoint.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    if \"api_key\" in kwargs and \"auth_token\" not in kwargs:\n        client.auth_token = None\n    return client",
      "sha256": "b3eaeddfef8c3a1b7554d6504f3cfcb7bc62089ef7ade44f30337a73dae527ad",
      "checks": {
        "api_key_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": false,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "attribute_clear"
    },
    {
      "id": "hermes-gemini3.8flash-ep1-f005-r7",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. Bearer-only construction leaves\n    ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) and\n    sends dual auth — X-Api-Key *and* Authorization: Bearer *** on every Portal/MiniMax/OAuth/Entra\n    request; clear it whenever we intentionally authenticated via auth_token. Conversely, when\n    authenticated via api_key, clear auth_token so the SDK does not fall back to\n    ANTHROPIC_AUTH_TOKEN from the environment.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    elif \"api_key\" in kwargs and \"auth_token\" not in kwargs:\n        client.auth_token = None\n    return client",
      "sha256": "74409453b222d123a457911d0ba4439ddaa646260538e533add3592c4eb87918",
      "checks": {
        "api_key_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": false,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "attribute_clear"
    },
    {
      "id": "hermes-gemini3.8flash-ep1-f005-r8",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. Bearer-only construction leaves\n    ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) and\n    sends dual auth — X-Api-Key *and* Authorization: Bearer — on every Portal/MiniMax/OAuth/Entra\n    request; clear it whenever we intentionally authenticated via auth_token.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    elif \"api_key\" in kwargs and \"auth_token\" not in kwargs:\n        client.auth_token = None\n    return client",
      "sha256": "8dbb3ea5c12172efc2aaf5446af0b116cf1337734d4627c9757098389f656045",
      "checks": {
        "api_key_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": false,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "attribute_clear"
    },
    {
      "id": "hermes-glm5.3flash-ep1-f005-r7",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. Bearer-only construction leaves\n    ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) and\n    sends dual auth — X-Api-Key *and* Authorization: Bearer — on every Portal/MiniMax/OAuth/Entra\n    request; clear it whenever we intentionally authenticated via auth_token.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    return client",
      "sha256": "40128a54b62d7c06498b751b2f6626144924887ec11a634b9e03109d290c01b0",
      "checks": {
        "api_key_original": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "unchanged_helper"
    },
    {
      "id": "hermes-glm5.3flash-ep1-f005-r8",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. Bearer-only construction leaves\n    ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) and\n    sends dual auth — X-Api-Key *and* Authorization: Bearer — on every Portal/MiniMax/OAuth/Entra\n    request; clear it whenever we intentionally authenticated via auth_token.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    return client",
      "sha256": "40128a54b62d7c06498b751b2f6626144924887ec11a634b9e03109d290c01b0",
      "checks": {
        "api_key_original": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "unchanged_helper"
    },
    {
      "id": "hermes-glm5.3-ep1-f005-r13",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. Bearer-only construction leaves\n    ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) and\n    sends dual auth — X-Api-Key *and* Authorization: Bearer — on every Portal/MiniMax/OAuth/Entra\n    request; clear it whenever we intentionally authenticated via auth_token.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    return client",
      "sha256": "40128a54b62d7c06498b751b2f6626144924887ec11a634b9e03109d290c01b0",
      "checks": {
        "api_key_original": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "unchanged_helper"
    },
    {
      "id": "hermes-glm5.3-ep1-f005-r14",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. Bearer-only construction leaves\n    ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) and\n    sends dual auth — X-Api-Key *and* Authorization: Bearer — on every Portal/MiniMax/OAuth/Entra\n    request; clear it whenever we intentionally authenticated via auth_token.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    return client",
      "sha256": "40128a54b62d7c06498b751b2f6626144924887ec11a634b9e03109d290c01b0",
      "checks": {
        "api_key_original": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "unchanged_helper"
    },
    {
      "id": "hermes-claudefable51-ep1-f005-r9",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. Bearer-only construction leaves\n    ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) and\n    sends dual auth — X-Api-Key *and* Authorization: Bearer — on every Portal/MiniMax/OAuth/Entra\n    request; clear it whenever we intentionally authenticated via auth_token. Symmetrically,\n    api-key-only construction leaves ``auth_token`` unset, so the SDK fills it from\n    ANTHROPIC_AUTH_TOKEN and sends that foreign credential as Authorization: Bearer *** alongside\n    the provider's x-api-key (F-005). Passing ``auth_token=None`` does not help — the SDK treats\n    None as \"fall back to env\" — so it must be cleared on the constructed client.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    elif \"api_key\" in kwargs and \"auth_token\" not in kwargs:\n        client.auth_token = None\n    return client",
      "sha256": "979118dfea713391fdfe5163ef0e4c3539dd06cca70c698feb34219b276e9d40",
      "checks": {
        "api_key_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": false,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "attribute_clear"
    },
    {
      "id": "hermes-claudefable51-ep1-f005-r10",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. Bearer-only construction leaves\n    ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) and\n    sends dual auth — X-Api-Key *and* Authorization: Bearer — on every Portal/MiniMax/OAuth/Entra\n    request; clear it whenever we intentionally authenticated via auth_token. Symmetrically,\n    api_key-only construction leaves ``auth_token`` unset, so the SDK fills it from\n    ANTHROPIC_AUTH_TOKEN and sends the env token as ``Authorization: Bearer`` to whatever\n    endpoint this client targets (e.g. a third-party ``api_mode: anthropic`` provider) — a\n    credential leak. Passing ``auth_token=None`` does not opt out (None means \"read env\"), so\n    the attribute must be cleared on the constructed client.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    elif \"api_key\" in kwargs and \"auth_token\" not in kwargs:\n        client.auth_token = None\n    return client",
      "sha256": "ae48dd7ade28682a9d611b07ef056c320f45bc37682676994b172b46cdd7ac32",
      "checks": {
        "api_key_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": false,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "attribute_clear"
    },
    {
      "id": "hermes-gpt6astra-ep1-f005-r9",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. Bearer-only construction leaves\n    ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) and\n    sends dual auth — X-Api-Key *and* Authorization: Bearer — on every Portal/MiniMax/OAuth/Entra\n    request; clear it whenever we intentionally authenticated via auth_token.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    elif \"api_key\" in kwargs and \"auth_token\" not in kwargs:\n        # Clear the SDK's ANTHROPIC_AUTH_TOKEN fallback, not the provider's key.\n        client.auth_token = None\n    return client",
      "sha256": "23fea048bd4a7d4577401d5dca33011211e480f5c2c3669c87e1d440b0d1a0a4",
      "checks": {
        "api_key_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": false,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "attribute_clear"
    },
    {
      "id": "hermes-gpt6astra-ep1-f005-r10",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. Bearer-only construction leaves\n    ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) and\n    sends dual auth — X-Api-Key *and* Authorization: Bearer — on every Portal/MiniMax/OAuth/Entra\n    request; clear it whenever we intentionally authenticated via auth_token.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    elif \"api_key\" in kwargs and \"auth_token\" not in kwargs:\n        # The SDK also falls back to ANTHROPIC_AUTH_TOKEN; never send that\n        # unrelated credential alongside the configured provider's API key.\n        client.auth_token = None\n    return client",
      "sha256": "4488cdc7bc8251a507fd76f2fb5d6aec15c8f93d5a25ac98e9ed51566bdbe4c7",
      "checks": {
        "api_key_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": false,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "attribute_clear"
    },
    {
      "id": "hermes-kimik3-ep1-f005-r15",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. Bearer-only construction leaves\n    ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) and\n    sends dual auth — X-Api-Key *and* Authorization: Bearer *** on every Portal/MiniMax/OAuth/Entra\n    request; clear it whenever we intentionally authenticated via auth_token. Conversely, when\n    ``api_key`` was explicitly passed (third-party provider) but ``auth_token`` was not, the SDK\n    silently reads ANTHROPIC_AUTH_TOKEN from the environment and attaches it as a Bearer header —\n    leaking an unrelated credential to a third-party endpoint; clear it to suppress.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    if \"api_key\" in kwargs and \"auth_token\" not in kwargs:\n        client.auth_token = None\n    return client",
      "sha256": "29fd30ca283b4fb4db8a8b70d5a12493e1f344f64384045fc28ac864e1fdc258",
      "checks": {
        "api_key_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": false,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "attribute_clear"
    },
    {
      "id": "hermes-kimik3-ep1-f005-r16",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. Bearer-only construction leaves\n    ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) and\n    sends dual auth — X-Api-Key *and* Authorization: Bearer — on every Portal/MiniMax/OAuth/Entra\n    request; clear it whenever we intentionally authenticated via auth_token.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    # The SDK treats auth_token=None as an instruction to read ANTHROPIC_AUTH_TOKEN.\n    # Suppress that environment fallback when authenticating with a provider API key.\n    if \"api_key\" in kwargs and \"auth_token\" not in kwargs:\n        env_auth_token = os.environ.pop(\"ANTHROPIC_AUTH_TOKEN\", None)\n        try:\n            client = sdk.Anthropic(**kwargs)\n        finally:\n            if env_auth_token is not None:\n                os.environ[\"ANTHROPIC_AUTH_TOKEN\"] = env_auth_token\n    else:\n        client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    return client",
      "sha256": "1470fb5c7f4a9ebe00ebae23ef8d335ec3f8d93830e5783c258b4b05099cb22d",
      "checks": {
        "api_key_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": false,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "environment_pop"
    },
    {
      "id": "hermes-grok4.6-ep1-f005-r17",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. The SDK infers missing credentials\n    from the environment, which dual-auths every request: Bearer-only construction leaves\n    ``api_key`` unset so ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) is sent as X-Api-Key\n    alongside Authorization on Portal/MiniMax/OAuth/Entra; api-key construction leaves\n    ``auth_token`` unset so ANTHROPIC_AUTH_TOKEN is sent as Bearer to third-party endpoints.\n    Passing None does not suppress the env fallback — clear the unused credential on the\n    client after construction. Explicit OAuth/bearer ``auth_token`` is left intact.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    if \"api_key\" in kwargs and \"auth_token\" not in kwargs:\n        client.auth_token = None\n    return client",
      "sha256": "3f260b10d224483eccabe22eadb43611f0b9b52f47421b41cf924a835ec96c27",
      "checks": {
        "api_key_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": false,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "attribute_clear"
    },
    {
      "id": "hermes-grok4.6-ep1-f005-r18",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. Bearer-only construction leaves\n    ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) and\n    sends dual auth — X-Api-Key *and* Authorization: Bearer *** on every Portal/MiniMax/OAuth/Entra\n    request; clear it whenever we intentionally authenticated via auth_token. The inverse leak\n    is the same: api-key construction leaves ``auth_token`` unset, so the SDK fills it from\n    ANTHROPIC_AUTH_TOKEN and attaches a foreign Bearer header to third-party endpoints. Passing\n    ``auth_token=None`` does not suppress that fallback; clear the unused credential after\n    construction. Explicit OAuth/bearer ``auth_token`` values are left intact.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    if \"api_key\" in kwargs and \"auth_token\" not in kwargs:\n        client.auth_token = None\n    return client",
      "sha256": "749d82819636146b0b25e4fa55be5299a5b5259aa31730313e30f7ade55daadb",
      "checks": {
        "api_key_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": false,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "attribute_clear"
    },
    {
      "id": "hermes-glm5.3-ep1-f005-r101",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. Bearer-only construction leaves\n    ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) and\n    sends dual auth — X-Api-Key *and* Authorization: Bearer *** on every Portal/MiniMax/OAuth/Entra\n    request; clear it whenever we intentionally authenticated via auth_token. Symmetrically,\n    api_key-only construction leaves ``auth_token`` unset, so the SDK fills it from\n    ANTHROPIC_AUTH_TOKEN — e.g. a shell token for an unrelated account/proxy — and attaches it as\n    an extra ``Authorization: Bearer`` on every request to the configured (often third-party)\n    endpoint; clear it whenever we intentionally authenticated via api_key. Passing ``None`` to\n    the constructor does NOT suppress these: ``None`` means \"fall back to env\" in the SDK, so the\n    env-sourced credential must be cleared on the built client.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    if \"api_key\" in kwargs and \"auth_token\" not in kwargs:\n        client.auth_token = None\n    return client",
      "sha256": "03119d361bc9cc6f9b1c42f211ffd3e4c4dabafcba21c55e25559c02a131d0ba",
      "checks": {
        "api_key_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": false,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "attribute_clear"
    },
    {
      "id": "hermes-glm5.3-ep1-f005-r102",
      "helper": "def _new_sdk_client(sdk, kwargs: Dict[str, Any], headers: Dict[str, str]):\n    \"\"\"``sdk.Anthropic(**kwargs)`` with ``headers`` attached. Bearer-only construction leaves\n    ``api_key`` unset, so the SDK fills it from ANTHROPIC_API_KEY (loaded from ~/.hermes/.env) and\n    sends dual auth — X-Api-Key *and* Authorization: Bearer *** on every Portal/MiniMax/OAuth/Entra\n    request; clear it whenever we intentionally authenticated via auth_token. Symmetrically,\n    api_key-only construction leaves ``auth_token`` unset, so the SDK fills it from\n    ANTHROPIC_AUTH_TOKEN (Hermes never reads that var itself) and attaches the foreign Bearer\n    credential alongside our x-api-key on every request — sending an unrelated account's token to\n    a third-party endpoint (F-005). ``auth_token=None`` does NOT suppress the fallback (None means\n    \"read env\" to the SDK), so the attribute is cleared on the built client, post-construction.\"\"\"\n    if headers:\n        kwargs[\"default_headers\"] = headers\n    client = sdk.Anthropic(**kwargs)\n    if \"auth_token\" in kwargs and \"api_key\" not in kwargs:\n        client.api_key = None\n    if \"api_key\" in kwargs and \"auth_token\" not in kwargs:\n        client.auth_token = None  # suppress SDK's ANTHROPIC_AUTH_TOKEN env fallback (F-005)\n    return client",
      "sha256": "f21a39d85aef3986333534d738e9dc88372bc4435bd762bc5ee25a2e7983bee5",
      "checks": {
        "api_key_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": false,
          "x_api_key_present": true
        },
        "api_key_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        },
        "bearer_original": {
          "pass": true,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": false
        },
        "bearer_copy": {
          "pass": false,
          "request_captured": true,
          "authorization_present": true,
          "x_api_key_present": true
        }
      },
      "mechanism": "attribute_clear"
    }
  ]
}
