Repository navigation
Conversation
- _send_greeting disabled certificate verification (CERT_NONE) on the same HTTPS calls that transmit the freshly created app_secret, exposing the credential to a network MITM; use the default verifying context instead - add a regression test asserting both greeting calls use CERT_REQUIRED with hostname checking enabled
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
During an internal security review of the bot-creator flow we found that
_send_greetinginsrc/octop/infra/gateway/bot_creators/feishu_bot_creator.pydisables certificate verification on its HTTPS calls:The very first of these calls POSTs
{"app_id": …, "app_secret": …}to<open_base>/open-apis/auth/v3/tenant_access_token/internal— i.e. a freshly minted app secret is transmitted over a connection that accepts any certificate, which is a realistic MITM credential-theft surface (the second call carries the tenant token).Root cause
The context returned by
ssl.create_default_context()was mutated to skip verification. There is no indication the endpoints involved need anything beyond standard verification (open.feishu.cn/open.larksuite.comserve publicly trusted certificates).Fix
Use the default verifying context as-is (the two mutation lines are removed). No behavior change other than restored verification.
Verification
test_send_greeting_uses_verifying_tls_context, which stubsurlopenand asserts both greeting-flow calls useCERT_REQUIREDwith hostname checking enabled — fails on the old code, passes with the fix.pytest tests/unit/gateway/test_feishu_bot_creator.py: 7 passed;ruff check/ruff format --checkclean on touched files.