fix(security): 删除 .env.production 并清理硬编码密码

- 删除 .env.production(含占位符密钥,已从版本控制移除)
- scripts/smoke_public_*.py: 密码改为从环境变量 SMOKE_TEST_PASSWORD 读取
- infra/docker/infra.yml: POSTGRES_PASSWORD 改为引用环境变量
- packages/application/auth/jwt_handler.py: 文档示例密钥改为占位符
This commit is contained in:
XiaoXia Bot
2026-06-27 18:10:52 +08:00
parent 48d3754956
commit 0b990017ca
5 changed files with 8 additions and 5 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ services:
environment:
POSTGRES_DB: xiaoxia_saas
POSTGRES_USER: xiaoxia
POSTGRES_PASSWORD: xiaoxia_password
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme_in_production}
ports:
- "5432:5432"
volumes:
+1 -1
View File
@@ -7,7 +7,7 @@ JWT 处理器委托层
使用方式:
from packages.application.auth.jwt_handler import JWTHandler, get_jwt_handler
jwt_handler = JWTHandler(secret_key="your-secret-key")
jwt_handler = JWTHandler(secret_key="<YOUR_SECRET_KEY>")
token = jwt_handler.create_access_token(user_id="user123", workspace_id="ws456", role="admin")
payload = jwt_handler.verify_access_token(token)
"""
+2 -1
View File
@@ -8,6 +8,7 @@ login, /auth/me, and /workspaces. Uses only the Python standard library.
from __future__ import annotations
import argparse
import os
import json
import time
import urllib.error
@@ -41,7 +42,7 @@ def main() -> int:
timestamp = int(time.time())
email = f"smoke-{timestamp}@example.com"
username = f"smoke{timestamp}"
password = "AuditPass123!"
password = os.environ.get("SMOKE_TEST_PASSWORD", "changeme")
register_status, register_body = request_json(
"POST",
+2 -1
View File
@@ -4,10 +4,11 @@ import io
import time
import uuid
import os
import requests
BASE_URL = "https://saas.xiaoxiajianji.com/api/v1"
PASSWORD = "SmokePass123!"
PASSWORD = os.environ.get("SMOKE_TEST_PASSWORD", "changeme")
def _json_or_raise(name: str, response: requests.Response) -> dict:
+2 -1
View File
@@ -10,10 +10,11 @@ import io
import time
import uuid
import os
import requests
BASE_URL = "https://saas.xiaoxiajianji.com/api/v1"
PASSWORD = "SmokePass123!"
PASSWORD = os.environ.get("SMOKE_TEST_PASSWORD", "changeme")
def _json_or_raise(name: str, response: requests.Response) -> dict: