github montevive/autocache v1.0.1

latest releases: v1.1.1, v1.1.0, pr-videos...
9 months ago

What's Changed

  • Fix API key header forwarding bug by @roblesjm in #2

Changes

Bug Fixes

API Key Header Forwarding (#2)

Fixed critical bug where API keys passed via request headers were not being properly forwarded to the Anthropic API, causing authentication errors when running without ANTHROPIC_API_KEY environment variable.

Problem:

  • Case-sensitivity bug where duplicate API key headers were sent
  • When headers like 'X-Api-Key' were sent, they were preserved AND a new 'x-api-key' header was added
  • Duplicate headers caused authentication failures with Anthropic API

Solution:

  • Remove all variations of API key headers (case-insensitive) before adding normalized 'x-api-key'
  • Add debug logging to trace API key extraction and header setup
  • Add maskAPIKey helper function for secure logging
  • Update ExtractAPIKey, SetupAuthHeader, and CreateHeadersMap functions

Technical Details

  • Fixed in internal/client/anthropic.go
  • All tests pass, golangci-lint clean
  • Proper handling of Authorization, X-Api-Key, and anthropic-api-key headers

Full Changelog: v1.0.0...v1.0.1

Don't miss a new autocache release

NewReleases is sending notifications on new releases.