bi-safe-query
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "bi-safe-query" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-9fa1a8ef11f31b7a7196b17453b922fc853d300608adf8edee0869efd8c0ff12. Verify the upstream source and version against https://skillhub.cn/skills/user_03fbb66c/guoyuanxin-bi-safe-query before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Secure BI operational query example. Uses a CloudBase MySQL read-only account (bi_ro) to perform business data queries limited to SELECT; external channels enforce data masking and full auditing is retained. Serves as a runnable sample for BI reports/operational analysis or as a reference template for a "read-only account + masking agreement" for approvals or bidding reuse.
Introduction source: third_party · user_03fbb66c · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: bi-safe-query
description: BI 经营分析安全查询实例(integration-contract 的第一个跑通样本)。使用 CloudBase MySQL 只读账号 bi_ro 查询业务数据,仅 SELECT,对外渠道强制脱敏,全量审计留痕。当需要做 BI 报表/经营分析查询、或作为"只读账号+脱敏契约"的参考模板给 K审批/招投标 复用时的样板。
slug: guoyuanxin-bi-safe-query
displayName: BI 安全查询(只读+脱敏)
version: 1.0.0
summary: BI 经营分析安全查询实例,使用只读账号仅 SELECT 查询,对外渠道强制脱敏,全量审计留痕,是「只读账号+脱敏契约」的参考样板。
license: MITBI 安全查询(契约第一个实例)
本 skill 是
integration-contract五条契约在 BI 场景的已跑通样板。 创建日期:2026-07-14。状态:沙箱跑通,待接真实业务 schema。
契约履行情况(对照 integration-contract)
| 契约 | 本实例做法 | 状态 |
|---|---|---|
| 只读账号 | CloudBase MySQL 账号 bi_ro@%,GRANT SELECT ON bi_sandbox.* 唯一授权 |
✅ 已建已验证 |
| 只增不删 | query_bi.py 用 is_select_only() 拒绝任何非 SELECT;连接账号无写权限 |
✅ |
| 脱敏 | desensitize.py 按 PERSONA.md 剥离 customer_name/amount/sales_manager |
✅ 已跑通 |
| 异常熔断 | 查询超时 connect_timeout=5;非 SELECT 直接 PermissionError | ✅ 基础版 |
| 全量留痕 | audit() 写 audit/audit.log.jsonl(操作人/时间/SQL/行数/渠道) |
✅ 已跑通 |
文件结构
bi-safe-query/
├── SKILL.md
├── config.local.example.json # 演示连接配置(生产由环境变量注入)
├── scripts/
│ ├── query_bi.py # 查询执行件(仅 SELECT,云函数环境运行)
│ └── desensitize.py # 脱敏 + 审计模块(本机可跑演示)
审计日志在运行时生成于
audit/audit.log.jsonl(本发布包不含演示日志)。
如何使用
本机演示脱敏逻辑(无需 DB 网络)
python scripts/desensitize.py
输出内部渠道原样 + 对外渠道脱敏 + 审计记录。
云函数内真实查询(同 VPC 可直连 172.17.0.6:3306)
from scripts.query_bi import run_bi_query
safe_rows = run_bi_query(
"SELECT region,customer_name,amount,sales_manager FROM bi_sandbox.sales_monthly ORDER BY amount DESC",
channel='external', # 飞书/企微 → 脱敏;internal → 原样
operator='guo_yuanxin'
)
生产替换三步(接真实 BI 数据)
- 指向真实库:把
bi_ro的 GRANT 改为真实业务 schema(如GRANT SELECT ON bi_prod.* TO 'bi_ro'@'%'),更新config.local.example.json的database。 - 删除沙箱:
DROP SCHEMA bi_sandbox(仅演示数据)。 - 渠道路由:对飞书/企微调用传
channel='external'自动脱敏;本地/内部会话传internal。
安全提示
bi_ro口令存于config.local.example.json(演示用)。生产环境由 CloudBase 环境变量注入,勿提交真实口令。- 本账号仅有 SELECT,即便凭据泄露也无法篡改业务数据(只读账号契约)。
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供企业 BI 安全查询的完整解决方案
- 实现只读账号+脱敏+审计三重安全保障
- 具备生产环境复用价值
Highlights
- 触发词精准覆盖 BI 报表、经营分析等核心场景
- 明确区分 internal/external 渠道处理逻辑
Areas to improve
-
缺少 When to Use 显式章节 Reported severity: Minor
文档有使用方式说明但未使用标准章节命名
Recommendation: 建议增加显式的 When to Use 章节提升规范性
Highlights
- 契约履行情况表格清晰展示合规状态
- 生产替换三步指南实用性强
- 代码示例完整可执行
Highlights
- 多层安全防护机制(只读账号+SQL校验+脱敏)
- 完善的异常处理与熔断机制
- 审计留痕满足合规要求
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.