Skip to content

Credentials are read from the generic ACCESS_KEY / SECRET_KEY environment variables #236

Closed

Description

@MarTrepodi

Component

SwgohComlink / SwgohComlinkAsync (clients)

Problem or Use Case

When no keys are passed to the constructor, both clients fall back to os.environ.get("ACCESS_KEY") and os.environ.get("SECRET_KEY") (src/swgoh_comlink/_base.py). These names are generic. If another tool in the same environment sets them, HMAC turns on silently, and that tool's access key goes to Comlink in the Authorization header. The default URL is plain HTTP, so the header travels unencrypted.

Reproduced on develop (9cc3760):

os.environ["ACCESS_KEY"] = "other-tool"; os.environ["SECRET_KEY"] = "s"
c = SwgohComlink(url="http://comlink.example.com:3000")
c.hmac, c.access_key  # (True, 'other-tool')

A second problem: when only one of the two variables is set, HMAC stays off and nothing tells the user.

Proposed Solution

  • Read COMLINK_ACCESS_KEY and COMLINK_SECRET_KEY first.
  • Fall back to ACCESS_KEY and SECRET_KEY with a DeprecationWarning that names the new variables.
  • Log a warning when only one of a pair is set.
  • Explicit constructor arguments still override every environment variable.

Acceptance

  • The new names take precedence when both old and new are set.
  • The old names still work and emit exactly one DeprecationWarning per client.
  • Constructor arguments beat all environment variables.
  • Entries in README.md and docs/migration.md.

Alternatives Considered

  • Drop the old names at once. That would break existing deployments, so they go through a deprecation cycle and are removed in v3.

Activity

  1. added
    enhancement
    on Nov 7, 2026
  2. github-actions commented on Nov 7, 2026

    @github-actions
    Contributor

    Addressed by #258, which is now merged into develop. This issue will close automatically when that change is released to main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions