Skip to content

fix(alienvault): strip API key whitespace and improve auth error handling#6501

Closed
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-invalid-api-key-error
Closed

fix(alienvault): strip API key whitespace and improve auth error handling#6501
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-invalid-api-key-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 21, 2026

Users with valid OTX keys were getting AlienVault connector internal error: 'Invalid API Key' (HTTP 403) due to accidental leading/trailing whitespace in the configured key — a common copy-paste artifact.

Changes

  • client.py — call .strip() on the API key before passing it to OTXv2, neutralizing whitespace padding:

    self.otx = OTXv2(api_key.strip(), server=server)
  • connector.py — catch InvalidAPIKey specifically before the generic Exception handler; log an actionable message pointing to ALIENVAULT_API_KEY and https://otx.alienvault.com/api, then sys.exit(1) to stop the connector immediately rather than retrying indefinitely with a broken credential:

    except InvalidAPIKey:
        self._error(
            "AlienVault connector authentication failed: Invalid API key. "
            "Please verify the value of ALIENVAULT_API_KEY. "
            "You can find your OTX key at https://otx.alienvault.com/api"
        )
        sys.exit(1)

    Previously the generic handler surfaced "'Invalid API Key'" (with repr() quotes) and no remediation guidance.

… error message

Agent-Logs-Url: https://github.com/OpenCTI-Platform/connectors/sessions/ce53f7b9-f195-4c55-b2ac-115c01abe86e

Co-authored-by: SamuelHassine <1334279+SamuelHassine@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix AlienVault connector internal error due to invalid API key fix(alienvault): strip API key whitespace and improve auth error handling May 21, 2026
Copilot AI requested a review from SamuelHassine May 21, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AlienVault connector internal error: 'Invalid API Key'

2 participants