Skip to main content

盟府 · 凭据治理规范(mengfu)

道统算子谱单算子仓:mengfu 及其全量用例。总谱(17 枚算子 + 总控进化 + MCP 门面)见 daotong-ops 总仓。

定名语义

  • 道统出处:勋藏盟府,司盟之府
  • 工程映射:密钥治理政策层,永不存真实钥匙

这是什么

一个纯标准库的凭据治理政策层:凭据只登记「引用名 + 治理政策」,钥匙本身永远不进册。提供轮换到期体检、注销重发、只追加的治理审计簿,以及只报位置不回显内容的泄漏体检。适合给「哪把钥匙该换了、谁动过政策、文本里有没有误藏密钥」出一本明白账。

道统映射

道统名 内核对象 职责
盟府 VaultPolicy 凭据只登记引用与政策,钥匙形态内容一律拒收
轮换 due_for_rotation 按登记时刻起算轮换期,到期即报,未登记不静默
注销重发 revoke / reissue 注销入册留痕,重发必须凭完整新政策重新起算
审计簿 audit_trail 只追加,seq 连续,只记动作元数据不记政策值
泄漏体检 scan_text 找出文本中疑似密钥片段,只报行/列/长度,绝不回显内容

快速开始

from mengfu import VaultPolicy, scan_text

vault = VaultPolicy()
vault.register("env/ATOMGIT_TOKEN_PATH",
               {"rotation_days": 90, "scope": "push", "storage": "kernel-file"})

vault.due_for_rotation("env/ATOMGIT_TOKEN_PATH", as_of=89 * 86400)  # (False, 1.0)
vault.revoke("env/ATOMGIT_TOKEN_PATH", reason="轮换到期")
vault.reissue("env/ATOMGIT_TOKEN_PATH",
              {"rotation_days": 90, "scope": "push", "storage": "kernel-file"})

scan_text("配置里混入 aabb... 长随机串")  # 只报位置,不回显内容

命令行:

python tools/mengfu.py register --ref env/TOKEN_PATH --rotation-days 90 --scope push --storage kernel-file
python tools/mengfu.py rotation --ref env/TOKEN_PATH
python tools/mengfu.py revoke --ref env/TOKEN_PATH --reason 轮换到期
python tools/mengfu.py scan --file path/to/scan.py
python tools/mengfu.py audit

MCP 门面(mcp-name: io.github.tanbopiao/mengfu)

盟府已拧成可对外服务的 MCP 服务器(stdio),内核保持纯标准库,门面依赖 mcp>=1.0:

{
  "mcpServers": {
    "mengfu": {
      "command": "python3",
      "args": ["run_mcp_server.py"],
      "cwd": "<仓库根目录>",
      "env": { "MENGFU_STATE": "/path/to/mengfu_state.json" }
    }
  }
}

工具面:

工具 职责 契约
scan_text 泄漏体检 只报 line/col/length 坐标,绝不回显命中内容
register_credential 登记引用与政策 钥匙形态内容(长随机串)一律拒收
check_rotation 轮换体检 到期即报,未登记不静默
list_credentials 在册概览 只回引用名,不回显政策值
revoke_credential 注销留痕 理由同样不得是钥匙形态;重发走 reissue 流程
audit_intact 审计核验 seq 连续无断链,删改当场现形

机器可读元数据见根目录 server.json。状态册为 JSON(MENGFU_STATE,默认 ./mengfu_state.json),结构上只含引用名、政策字段与注销理由,放不进钥匙。

设计约定

  • 纯标准库,无第三方依赖。
  • 盟府永不存真实钥匙:引用名、政策值、注销理由凡形似密钥(长度≥32 的随机 hex/base64 串)一律拒收。
  • 已注销的引用不接受直接登记,重发必须走 reissue() 凭完整新政策。
  • 审计簿只追加、只含元数据;泄漏体检只报坐标不回显内容。

回归

regression.md 登记十二条回归铁律(登记契约、轮换契约、注销契约、审计契约、体检契约、工程契约)。运行:

python3 -m unittest discover -s . -p "test_*.py"

许可证

MIT Licensed


生态导航:本作品属于 元枢工具货架(21 件 MCP,自动聚合)。 同门:tanze(深研) · pialuo(网页提取) · wengu(跨会话记忆) · jiwei(像素特效) · constraint-runtime(约束治理) · agent-eval-engine(可验证评测) · 全部作品

Metadata

Release files for mengfu 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mengfu 0.2.0
File Size Uploaded Provenance Actions
mengfu-0.2.0.tar.gz 8.6 kB Without provenance Details for mengfu-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mengfu 0.2.0
File Interpreter ABI Platform Actions
mengfu-0.2.0-py3-none-any.whl Python 3 none any Details for mengfu-0.2.0-py3-none-any.whl

Total release size: 19.0 kB

Release files / mengfu-0.2.0.tar.gz

Download URL mengfu-0.2.0.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8daf5958b31230595e8f05f878f80a4372fc6796c12d7e86c817f6d190a12177
BLAKE2b-256 checksum
How to use checksums
b9adeddd4b17c95cfb52203ae42be2ee9f6ce9fbec405adf2e5f2364d523196e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / mengfu-0.2.0-py3-none-any.whl

Download URL mengfu-0.2.0-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d7f64644a303862cd6f242a7226e78df89dcee2320b154c7daf4e23b3d185fe3
BLAKE2b-256 checksum
How to use checksums
b8c1680c3cef6b7336fd53f0b02e00ffbe6ee3551c6324fb7b45e255c0026d26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for mengfu 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page