Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Redact access_key and ticket from WebSocket lifecycle INFO logs

Open
#141 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
security

Research direction

Start at Client._connect() and _disconnect(), then inspect the existing lifecycle logging and regression-test structure. Done means both INFO messages redact only the access_key and ticket values while retaining other URL context, and websockets.connect() still receives the exact original URL.

Written by the indexing model from the issue text.

Description

Problem

Client._connect() and _disconnect() log the complete WebSocket connection URL at INFO level. The URL returned by the Lark WebSocket endpoint contains sensitive access_key and ticket query values, so normal lifecycle logs can disclose credentials to stdout, journals, or downstream log collectors.

The current default-branch code passes the original URL directly to both log calls:

  • logger.info(self._fmt_log("connected to {}", conn_url))
  • logger.info(self._fmt_log("disconnected to {}", self._conn_url))

Reproduce / evidence

Using only fictional values, suppose _get_conn_url() returns:

wss://msg-frontier.example.test/ws/v2?fpid=493&access_key=access-key-test-value&service_id=33554678&ticket=ticket-test-value

After a connection and disconnect, the INFO messages include both access-key-test-value and ticket-test-value verbatim. The same original URL is also correctly required by websockets.connect(); the connection input itself must not be changed.

I searched current issues, pull requests, and default-branch code for msg-frontier, access_key, ticket, connected to, redact websocket URL, and sanitize URL query. I did not find an issue or PR that covers redaction of both WebSocket lifecycle log messages.

Required fix

Please redact only the values of the access_key and ticket query parameters before formatting the connection and disconnection INFO messages, while preserving the original URL for connection state and websockets.connect().

The log-safe representation should preserve non-sensitive query parameters and enough endpoint context for diagnostics. Ideally it should also preserve query ordering, repeated parameters, percent-encoding, empty/value-less parameters, and fragments except for replacing the two sensitive values.

Please add regression tests proving that:

  1. neither lifecycle log contains the original access_key or ticket value;
  2. non-sensitive URL context remains visible;
  3. websockets.connect() receives the exact original URL; and
  4. both connection and disconnection logs use the redacted representation.
Dominant language
Python
Stars
559
Forks
102
PR merge metrics
No merged PRs in 30d

Getting set up

We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from larksuite/oapi-sdk-python

All issues in larksuite/oapi-sdk-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.