T09 · Insecure Skill Coding Practices
- Location
test_basic.py:32- Finding
Hardcoded Feishu Application Credentials in a Network-Enabled Test
- Content
View full analysis
Vulnerability Details
File Location:
test_basic.py, lines 32-43
Vulnerability Type: Hardcoded secrets and authenticated external API access
Risk Level: HighVulnerable Code
python os.environ["FEISHU_APP_ID"] = "cli_a956c03ffcb9dcbb" os.environ["FEISHU_APP_SECRET"] = "HHEZEDoNZwfNdoediXiGSbaRFKDmpB71" os.environ["FEISHU_BITABLE_TOKEN"] = "AO6rbfj7aa8nbGsG7Rfc90honjK" os.environ["FEISHU_TABLE_ID"] = "tbl0T6d9uTv4Fk3c" manager = FeishuStorageManager() try: results = manager.search_storage_item("梳子")The credentials are consumed by the following authentication request in
storage_manager.py, lines 29-36:python url = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" data = { "app_id": self.app_id, "app_secret": self.app_secret } response = requests.post(url, json=data, timeout=10)Technical Analysis
The test source contains credential-shaped Feishu application identifiers, an application secret, a Bitable token, and a table identifier. Unlike a mocked unit test,
test_search_function()instantiates the production manager and performs a real outbound authentication and Bitable query.Anyone who obtains the package can extract these values without executing the code. If the credentials remain valid, the application ID and secret can be exchanged for a tenant access token. The resulting privileges depend on the permissions granted to the Feishu application. The embedded Bitable token and table ID identify the resource subsequently queried by the test.
The audit did not validate whether the exposed credentials are currently active. Nevertheless, committing non-placeholder secret values and wiring them into live network calls is an insecure coding practice and requires immediate rotation.
Attack Path
- An attacker downloads or otherwise reads the distributed project.
- The attacker extracts the four values from `test_basi ...[truncated 1367 chars]
- Remediation
View remediation
Remediation Suggestions
- Immediately revoke and rotate the exposed Feishu application secret.
- Review Feishu access logs and Bitable audit history for unauthorized activity.
- Remove all real credentials and resource identifiers from the repository and its version history.
- Replace the values with unmistakable placeholders or inject test configuration through a protected CI secret store.
- Mock
requests.post()andrequests.get()in unit tests so tests never contact Feishu. - Keep live integration tests separate, disabled by default, and require an explicit opt-in flag.
- Add secret scanning to local hooks and CI, covering Feishu application secrets and Bitable tokens.
- Grant the Feishu application only the narrowest required Bitable and upload scopes.
