bugx-cli 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +190 -186
- package/core/README.md +2 -2
- package/core/agent/README.md +2 -1
- package/core/agent/agent_artifacts.py +8 -6
- package/core/agent/agent_eval.py +136 -54
- package/core/agent/agent_execution.py +218 -52
- package/core/agent/agent_orchestrator.py +14 -8
- package/core/agent/agent_targets.py +8 -2
- package/core/agent/feature_baseline.py +150 -0
- package/core/assets/axe-core/LICENSE-3RD-PARTY.txt +66 -0
- package/core/assets/axe-core/LICENSE.txt +362 -0
- package/core/assets/axe-core/UPSTREAM.md +10 -0
- package/core/assets/axe-core/axe.min.js +12 -0
- package/core/assets/bugx-hero-en.svg +74 -0
- package/core/assets/bugx-hero-zh.svg +74 -0
- package/core/assets/codex.png +0 -0
- package/core/assets/dsh.png +0 -0
- package/core/assets/webui-chatgpt.jpg +0 -0
- package/core/assets/webui-session.jpg +0 -0
- package/core/assets/webui-skills.jpg +0 -0
- package/core/assets/webui-studio.jpg +0 -0
- package/core/assets/webui-zcode.jpg +0 -0
- package/core/assets/zcode.png +0 -0
- package/core/autonomous_cve/SPEC.md +1 -1
- package/core/autonomous_cve/attack_graph_store.py +152 -106
- package/core/autonomous_cve/behavior_graph.py +8 -2
- package/core/autonomous_cve/verifier.py +4 -1
- package/core/bugx.md +1 -1
- package/core/bugx_paths.py +43 -8
- package/core/cli-help.txt +66 -0
- package/core/cloud_sync/SPEC.md +1 -1
- package/core/cloud_sync/cloud_client.py +25 -6
- package/core/cloud_sync/cloud_onboard.py +42 -1
- package/core/cloud_sync/flywheel_client.py +16 -7
- package/core/cloud_sync/network_transport.py +24 -3
- package/core/cloud_sync/sensitive_filter.py +2 -2
- package/core/cloud_sync/sync_push.py +12 -10
- package/core/contracts/AGENT_GUIDE.md +6 -9
- package/core/contracts/README.md +2 -2
- package/core/contracts/bugx-runtime-contract.md +1 -1
- package/core/contracts/bugx-worker.md +1 -1
- package/core/contracts/engine_gap_contracts.py +86 -3
- package/core/coverage/coverage_discovery.py +599 -29
- package/core/coverage/coverage_evidence.py +47 -0
- package/core/coverage/coverage_forensics.py +9 -0
- package/core/coverage/coverage_validate.py +6 -1
- package/core/dev_harness/SPEC.md +1 -1
- package/core/engine-integrity.json +591 -419
- package/core/fuzzing/concurrency_fuzzer.py +53 -0
- package/core/fuzzing/differential_oracle.py +562 -27
- package/core/fuzzing/fuzz_input.py +109 -6
- package/core/fuzzing/stateful_fuzzer.py +72 -0
- package/core/governance/secret_redactor.py +22 -10
- package/core/host_acp/SPEC.md +1 -1
- package/core/host_acp/__init__.py +4 -4
- package/core/host_acp/claude.py +59 -1
- package/core/host_acp/cline.py +64 -1
- package/core/host_acp/codex.py +56 -1
- package/core/host_acp/dsh.py +59 -1
- package/core/host_acp/opencode.py +56 -1
- package/core/host_acp/pi.py +59 -1
- package/core/host_acp/zcode.py +59 -1
- package/core/host_runtime/SPEC.md +1 -1
- package/core/host_runtime/adapters.py +1 -1
- package/core/host_runtime/cline.py +13 -0
- package/core/host_runtime/host_evaluators.py +44 -4
- package/core/host_runtime/host_probe.py +1 -1
- package/core/host_runtime/host_provider_arbitrator.py +116 -62
- package/core/host_runtime/host_registry.py +15 -8
- package/core/host_runtime/mcp_registry_gate.py +12 -1
- package/core/host_runtime/pi.py +102 -0
- package/core/host_runtime/provider_facts.py +66 -0
- package/core/hosts/SPEC.md +1 -1
- package/core/hosts/__init__.py +6 -2
- package/core/hosts/_dsh_usage.py +1 -1
- package/core/hosts/base.py +32 -4
- package/core/hosts/claude.py +55 -0
- package/core/hosts/cline.py +6 -2
- package/core/hosts/codex.py +58 -0
- package/core/hosts/dsh.py +9 -1
- package/core/hosts/opencode.py +6 -6
- package/core/hosts/pi.py +159 -2
- package/core/infra/README.md +4 -2
- package/core/infra/__init__.py +2 -0
- package/core/infra/build_info.py +22 -3
- package/core/infra/client_metadata.py +1 -1
- package/core/infra/json_utils.py +22 -0
- package/core/launch_phases/README.md +2 -2
- package/core/launch_phases/SPEC.md +1 -1
- package/core/launch_phases/common.py +21 -2
- package/core/launch_phases/finding_confirm_phase.py +5 -1
- package/core/launch_phases/finding_settlement.py +188 -1
- package/core/launch_phases/judge_phase.py +69 -12
- package/core/launch_phases/orchestrator_controls.py +11 -7
- package/core/launch_phases/post_coverage_sync.py +9 -2
- package/core/launch_phases/post_phase.py +139 -3
- package/core/launch_phases/post_receipt.py +12 -1
- package/core/launch_phases/pre_phase.py +3 -3
- package/core/launch_phases/pre_recon_scout.py +53 -36
- package/core/launch_phases/pre_state_builder.py +23 -176
- package/core/launch_phases/round_orchestrator.py +15 -32
- package/core/launch_phases/session_runtime.py +56 -9
- package/core/launch_phases/startup_gates.py +36 -8
- package/core/launch_phases/startup_interaction.py +68 -12
- package/core/launch_phases/startup_version_gate.py +9 -3
- package/core/launch_phases/supervisor_bridge.py +46 -17
- package/core/launch_phases/supervisor_coverage.py +8 -2
- package/core/launch_phases/supervisor_degraded.py +1 -9
- package/core/launch_phases/worker_barriers.py +15 -5
- package/core/launch_phases/worker_orchestrator.py +105 -25
- package/core/ledger/README.md +1 -1
- package/core/ledger/SPEC.md +1 -1
- package/core/ledger/_facade.py +2 -1
- package/core/ledger/archive_ops.py +60 -2
- package/core/ledger/cli.py +6 -1
- package/core/ledger/export_ops.py +6 -1
- package/core/ledger/finding_confirmation.py +48 -6
- package/core/ledger/finding_lifecycle.py +428 -5
- package/core/ledger/finding_verification.py +44 -8
- package/core/ledger/incidents.py +10 -4
- package/core/ledger/patterns.py +10 -7
- package/core/ledger/receipt_contract.py +17 -1
- package/core/ledger/sync_ops.py +21 -16
- package/core/ledger/tool_experience.py +2 -1
- package/core/ledger/verify_life.py +88 -17
- package/core/locales/en-US.json +2 -2
- package/core/locales/zh-CN.json +2 -2
- package/core/mcp_handlers/SPEC.md +1 -1
- package/core/mcp_handlers/base.py +23 -3
- package/core/mcp_handlers/channel_lifecycle.py +85 -30
- package/core/mcp_handlers/retrieval_handlers.py +11 -1
- package/core/mcp_handlers/rpc_server.py +6 -1
- package/core/mcp_handlers/supervisor_handlers.py +32 -6
- package/core/mcp_handlers/tool_table.py +15 -0
- package/core/mcp_runtime_support/environment.py +0 -38
- package/core/mcp_runtime_support/verifier.py +0 -52
- package/core/metadata.txt +2 -3
- package/core/planning/README.md +1 -1
- package/core/planning/domain_router.py +4 -2
- package/core/planning/dynamic_flow_analyzer.py +219 -14
- package/core/planning/judge_pipeline.py +87 -4
- package/core/planning/prompt_harness.py +7 -5
- package/core/planning/spec_harvester.py +4 -4
- package/core/probes/INTERFACE.md +11 -1
- package/core/probes/SPEC.md +11 -1
- package/core/probes/__init__.py +46 -40
- package/core/probes/android_probe.py +177 -9
- package/core/probes/codebase_memory_probe.py +57 -0
- package/core/probes/desktop_probe.py +104 -0
- package/core/probes/differential_probe.py +99 -21
- package/core/probes/efficiency_probe.py +64 -0
- package/core/probes/ios_binary_probe.py +105 -1
- package/core/probes/memory_probe.py +66 -0
- package/core/probes/miniprogram_probe.py +75 -13
- package/core/probes/mobile_probe.py +215 -30
- package/core/probes/native_probe.py +88 -0
- package/core/probes/openwiki_probe.py +70 -0
- package/core/probes/pattern_probe.py +106 -0
- package/core/probes/platform_probe.py +81 -0
- package/core/probes/probe_registry.py +108 -7
- package/core/probes/sast_fixture_corpus.py +340 -0
- package/core/probes/sast_probe.py +553 -52
- package/core/probes/sast_rules.py +668 -28
- package/core/probes/sca_scanner.py +48 -0
- package/core/probes/ui_accessibility.py +149 -0
- package/core/probes/ui_audit.py +513 -0
- package/core/probes/ui_contract.py +273 -0
- package/core/probes/ui_evidence.py +212 -0
- package/core/probes/ui_measurements.py +314 -0
- package/core/probes/ui_repair.py +250 -0
- package/core/probes/ui_review.py +133 -0
- package/core/probes/ui_storybook.py +107 -0
- package/core/probes/ui_tokens.py +185 -0
- package/core/probes/ui_visual_diff.py +131 -0
- package/core/probes/web_probe.py +373 -18
- package/core/project_profiler/SPEC.md +1 -1
- package/core/project_profiler/arbitrator.py +6 -1
- package/core/project_profiler/detector.py +8 -1
- package/core/project_profiler/strategy.py +51 -15
- package/core/prompts/command_routing_en.md +2 -2
- package/core/prompts/command_routing_zh.md +2 -2
- package/core/prompts/stages/stage_repair.md +1 -1
- package/core/repair/README.md +1 -1
- package/core/repair/l7_repair_loop.py +1 -4
- package/core/repair/rsi_fixer.py +4 -4
- package/core/repair/rsi_loop.py +1 -3
- package/core/repair/rsi_repair.py +7 -7
- package/core/repair/rsi_scope.py +27 -8
- package/core/report_engine/SPEC.md +1 -1
- package/core/report_engine/attestation.py +8 -4
- package/core/report_engine/finding_report.py +2 -1
- package/core/report_engine/models.py +7 -9
- package/core/report_engine/sast_bridge.py +2 -2
- package/core/report_engine/server.py +18 -8
- package/core/report_engine/web-conformance.md +123 -18
- package/core/report_engine/web_conformance.py +21 -52
- package/core/retrieval/README.md +1 -1
- package/core/retrieval/SPEC.md +1 -1
- package/core/retrieval/code_analyzer.py +50 -14
- package/core/retrieval/context_assembler.py +7 -1
- package/core/retrieval/knowledge_sync.py +108 -14
- package/core/retrieval/symbol_index.py +25 -6
- package/core/retrieval/universal_code_matcher.py +234 -49
- package/core/runtime/README.md +1 -1
- package/core/runtime/bugx_logging.py +78 -7
- package/core/runtime/fixture_solidify.py +5 -10
- package/core/runtime/incident_eval.py +1 -1
- package/core/runtime/model_runner.py +4 -41
- package/core/runtime/platform_adapter.py +2 -2
- package/core/runtime/prep_validate.py +4 -2
- package/core/runtime/project_settings.py +2 -1
- package/core/runtime/scenario_eval.py +50 -8
- package/core/skills/bugx_docs_mcp_server.py +3 -1
- package/core/skills/bugx_mcp_server.py +29 -2
- package/core/skills/tools_kb.py +1 -1
- package/core/supervisor/README.md +1 -1
- package/core/supervisor/SPEC.md +1 -1
- package/core/supervisor/budget_governor.py +503 -9
- package/core/supervisor/checkpoint_pipeline.py +248 -6
- package/core/supervisor/checkpoint_sync.py +13 -0
- package/core/supervisor/claim_events.py +1 -1
- package/core/supervisor/finding_workflow.py +22 -5
- package/core/supervisor/lease_manager.py +1 -1
- package/core/supervisor/lifecycle_blocks.py +6 -1
- package/core/supervisor/rejection_remedies.py +52 -5
- package/core/supervisor/serial_authorization.py +48 -4
- package/core/supervisor/task_scheduler.py +2 -2
- package/core/supervisor/worker_checkpoint.py +8 -1
- package/core/supervisor/worker_runtime.py +8 -2
- package/core/supervisor_types/worker_claim.py +9 -0
- package/core/webui/README.md +1 -1
- package/core/webui/SPEC.md +2 -1
- package/core/webui/adapters/claude.py +5 -1
- package/core/webui/adapters/cline.py +10 -2
- package/core/webui/adapters/codex.py +5 -1
- package/core/webui/adapters/dsh.py +5 -1
- package/core/webui/docs_session_service.py +2 -2
- package/core/webui/mcp_inspector.py +11 -7
- package/core/webui/static/00-base.css +1060 -0
- package/core/webui/static/01-monitoring.css +802 -0
- package/core/webui/static/02-header-actions.css +321 -0
- package/core/webui/static/03-trigger-popover.css +697 -0
- package/core/webui/static/04-composer.css +628 -0
- package/core/webui/static/05-skills-center.css +878 -0
- package/core/webui/static/06-mcp-center.css +623 -0
- package/core/webui/static/07-skill-detail.css +265 -0
- package/core/webui/static/08-files-management.css +167 -0
- package/core/webui/static/09-files-center.css +386 -0
- package/core/webui/static/10-icons.css +105 -0
- package/core/webui/static/11-project-options.css +185 -0
- package/core/webui/static/12-profile-tab.css +383 -0
- package/core/webui/static/design-tokens.css +113 -0
- package/core/webui/static/index.html +14 -1
- package/core/webui/workspace_service.py +1 -1
- package/docs/07_distribution/01_README_NPM.md +190 -186
- package/ecosystem/integrations/README.md +1 -1
- package/ecosystem/integrations/dsh/mcp/package.json +1 -1
- package/ecosystem/integrations/dsh/skills/bugx-dsh/SKILL.md +1 -1
- package/ecosystem/integrations/dsh/ui/package.json +1 -1
- package/ecosystem/integrations/opencode/bugx-mcp-manifest.json +4 -4
- package/ecosystem/integrations/opencode/mcp-lock.json +14 -6
- package/ecosystem/integrations/opencode/opencode.json +23 -12
- package/ecosystem/integrations/pi/extensions/bugx/manifest.json +1 -1
- package/ecosystem/integrations/qoder/connector-meta.json +1 -1
- package/ecosystem/integrations/workbuddy/connector-meta.json +1 -1
- package/ecosystem/integrations/workbuddy/skills/bugx/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/.claude-plugin/plugin.json +1 -1
- package/ecosystem/plugins/bugx/.codex-plugin/plugin.json +1 -1
- package/ecosystem/plugins/bugx/.zcode-plugin/plugin.json +1 -1
- package/ecosystem/plugins/bugx/skills/bugx/SKILL.md +2 -2
- package/ecosystem/plugins/bugx/skills/bugx-dsh/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx-opencode/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx-zcode/SKILL.md +1 -1
- package/interfaces/bin/bugx.js +37 -0
- package/interfaces/cli/bugx_cli/__init__.py +4 -2
- package/interfaces/cli/bugx_cli/cli.py +11 -4
- package/interfaces/cli/bugx_cli/commands/advisory.py +1 -1
- package/interfaces/cli/bugx_cli/commands/agent.py +339 -73
- package/interfaces/cli/bugx_cli/commands/audit.py +2 -2
- package/interfaces/cli/bugx_cli/commands/autonomous.py +1 -1
- package/interfaces/cli/bugx_cli/commands/cloud.py +4 -3
- package/interfaces/cli/bugx_cli/commands/doctor.py +449 -204
- package/interfaces/cli/bugx_cli/commands/interaction.py +5 -1
- package/interfaces/cli/bugx_cli/commands/knowledge.py +2 -0
- package/interfaces/cli/bugx_cli/commands/lifecycle.py +3 -3
- package/interfaces/cli/bugx_cli/commands/plugin.py +55 -20
- package/interfaces/cli/bugx_cli/commands/plugin_claude.py +7 -7
- package/interfaces/cli/bugx_cli/commands/plugin_funide.py +2 -1
- package/interfaces/cli/bugx_cli/commands/plugin_zcode.py +1 -1
- package/interfaces/cli/bugx_cli/commands/report.py +2 -6
- package/interfaces/cli/bugx_cli/commands/system.py +11 -11
- package/interfaces/cli/bugx_cli/common.py +15 -7
- package/interfaces/cli/bugx_cli/host_adapters.py +29 -54
- package/interfaces/cli/bugx_cli/hosts/registry.py +8 -6
- package/interfaces/cli/bugx_cli/infra/ai_advisor.py +157 -27
- package/interfaces/cli/bugx_cli/infra/engine_installer.py +18 -10
- package/interfaces/cli/bugx_cli/infra/host_sync.py +11 -8
- package/interfaces/cli/bugx_cli/infra/mcp_advisor.py +76 -5
- package/interfaces/cli/bugx_cli/infra/security.py +13 -6
- package/package.json +2 -1
- package/pyproject.toml +20 -8
- package/scripts/ensure-python.mjs +7 -7
- package/scripts/sync-version.mjs +10 -21
- package/scripts/test-npm-wrapper.mjs +1 -1
- package/core/webui/static/project-settings.css +0 -6458
- package/docs/07_distribution/README.md +0 -16
- package/docs/README.md +0 -121
- package/interfaces/README.md +0 -143
- package/interfaces/bin/README.md +0 -35
- package/interfaces/cli/README.md +0 -90
- package/scripts/README.md +0 -118
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1600 400" width="1600" height="400">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="bgGrad" x1="0" y1="0" x2="0" y2="1">
|
|
4
|
+
<stop offset="0%" stop-color="#0a0e14"/>
|
|
5
|
+
<stop offset="100%" stop-color="#06090d"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
<radialGradient id="ghostGlow" cx="0.5" cy="0.5" r="0.5">
|
|
8
|
+
<stop offset="0%" stop-color="#22d3ee" stop-opacity="0.20"/>
|
|
9
|
+
<stop offset="100%" stop-color="#22d3ee" stop-opacity="0"/>
|
|
10
|
+
</radialGradient>
|
|
11
|
+
<linearGradient id="jellyGrad" x1="0" y1="0" x2="1" y2="1">
|
|
12
|
+
<stop offset="0%" stop-color="#08b7d4"/>
|
|
13
|
+
<stop offset="100%" stop-color="#7be6f7"/>
|
|
14
|
+
</linearGradient>
|
|
15
|
+
<mask id="hollowMask">
|
|
16
|
+
<rect x="0" y="0" width="512" height="512" fill="#ffffff"/>
|
|
17
|
+
<ellipse cx="206" cy="225" rx="20" ry="28"/>
|
|
18
|
+
<ellipse cx="306" cy="225" rx="20" ry="28"/>
|
|
19
|
+
</mask>
|
|
20
|
+
<filter id="softGlow" x="-40%" y="-40%" width="180%" height="180%">
|
|
21
|
+
<feGaussianBlur stdDeviation="12" result="blur"/>
|
|
22
|
+
<feMerge>
|
|
23
|
+
<feMergeNode in="blur"/>
|
|
24
|
+
<feMergeNode in="SourceGraphic"/>
|
|
25
|
+
</feMerge>
|
|
26
|
+
</filter>
|
|
27
|
+
<style>
|
|
28
|
+
.wordmark { font-family: -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif; font-weight: 800; }
|
|
29
|
+
.tagline { font-family: -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif; }
|
|
30
|
+
</style>
|
|
31
|
+
</defs>
|
|
32
|
+
|
|
33
|
+
<!-- 背景 -->
|
|
34
|
+
<rect width="1600" height="400" fill="url(#bgGrad)"/>
|
|
35
|
+
|
|
36
|
+
<!-- logo + wordmark 组合整体居中(幽灵 197 宽 + 间隙 44 + BugX 约 300 宽 = 541 → 起点 529) -->
|
|
37
|
+
<ellipse cx="628" cy="150" rx="230" ry="140" fill="url(#ghostGlow)"/>
|
|
38
|
+
|
|
39
|
+
<!-- 幽灵光晕层 -->
|
|
40
|
+
<g transform="translate(402,-25) scale(0.85)" filter="url(#softGlow)" opacity="0.5">
|
|
41
|
+
<path d="M 140 260
|
|
42
|
+
C 140 150, 200 120, 256 120
|
|
43
|
+
C 312 120, 372 150, 372 260
|
|
44
|
+
C 372 280, 356 295, 340 280
|
|
45
|
+
C 324 265, 308 265, 292 280
|
|
46
|
+
C 276 295, 260 295, 244 280
|
|
47
|
+
C 228 265, 212 265, 196 280
|
|
48
|
+
C 180 295, 164 295, 148 280
|
|
49
|
+
C 140 272, 140 265, 140 260 Z"
|
|
50
|
+
fill="#7be6f7"/>
|
|
51
|
+
</g>
|
|
52
|
+
<!-- 幽灵主体 -->
|
|
53
|
+
<g transform="translate(402,-25) scale(0.85)">
|
|
54
|
+
<path d="M 140 260
|
|
55
|
+
C 140 150, 200 120, 256 120
|
|
56
|
+
C 312 120, 372 150, 372 260
|
|
57
|
+
C 372 280, 356 295, 340 280
|
|
58
|
+
C 324 265, 308 265, 292 280
|
|
59
|
+
C 276 295, 260 295, 244 280
|
|
60
|
+
C 228 265, 212 265, 196 280
|
|
61
|
+
C 180 295, 164 295, 148 280
|
|
62
|
+
C 140 272, 140 265, 140 260 Z"
|
|
63
|
+
fill="url(#jellyGrad)" mask="url(#hollowMask)"/>
|
|
64
|
+
</g>
|
|
65
|
+
|
|
66
|
+
<!-- Wordmark -->
|
|
67
|
+
<text class="wordmark" x="766" y="188" font-size="118" fill="#ffffff" letter-spacing="-1">BugX</text>
|
|
68
|
+
|
|
69
|
+
<!-- English tagline(母语构思,非互译) -->
|
|
70
|
+
<text class="tagline" x="800" y="300" font-size="34" fill="#e6edf6" text-anchor="middle"><tspan fill="#7be6f7" font-weight="700">BugX</tspan> makes it easy to audit AI-written code.</text>
|
|
71
|
+
|
|
72
|
+
<!-- 副标语 -->
|
|
73
|
+
<text class="tagline" x="800" y="348" font-size="19" fill="#8b9bb4" text-anchor="middle">An audit assistant that lives in the AI coding tools you already use — code review, functionality review, performance review.</text>
|
|
74
|
+
</svg>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1600 400" width="1600" height="400">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="bgGrad" x1="0" y1="0" x2="0" y2="1">
|
|
4
|
+
<stop offset="0%" stop-color="#0a0e14"/>
|
|
5
|
+
<stop offset="100%" stop-color="#06090d"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
<radialGradient id="ghostGlow" cx="0.5" cy="0.5" r="0.5">
|
|
8
|
+
<stop offset="0%" stop-color="#22d3ee" stop-opacity="0.20"/>
|
|
9
|
+
<stop offset="100%" stop-color="#22d3ee" stop-opacity="0"/>
|
|
10
|
+
</radialGradient>
|
|
11
|
+
<linearGradient id="jellyGrad" x1="0" y1="0" x2="1" y2="1">
|
|
12
|
+
<stop offset="0%" stop-color="#08b7d4"/>
|
|
13
|
+
<stop offset="100%" stop-color="#7be6f7"/>
|
|
14
|
+
</linearGradient>
|
|
15
|
+
<mask id="hollowMask">
|
|
16
|
+
<rect x="0" y="0" width="512" height="512" fill="#ffffff"/>
|
|
17
|
+
<ellipse cx="206" cy="225" rx="20" ry="28"/>
|
|
18
|
+
<ellipse cx="306" cy="225" rx="20" ry="28"/>
|
|
19
|
+
</mask>
|
|
20
|
+
<filter id="softGlow" x="-40%" y="-40%" width="180%" height="180%">
|
|
21
|
+
<feGaussianBlur stdDeviation="12" result="blur"/>
|
|
22
|
+
<feMerge>
|
|
23
|
+
<feMergeNode in="blur"/>
|
|
24
|
+
<feMergeNode in="SourceGraphic"/>
|
|
25
|
+
</feMerge>
|
|
26
|
+
</filter>
|
|
27
|
+
<style>
|
|
28
|
+
.wordmark { font-family: -apple-system, "SF Pro Display", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif; font-weight: 800; }
|
|
29
|
+
.tagline { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif; }
|
|
30
|
+
</style>
|
|
31
|
+
</defs>
|
|
32
|
+
|
|
33
|
+
<!-- 背景 -->
|
|
34
|
+
<rect width="1600" height="400" fill="url(#bgGrad)"/>
|
|
35
|
+
|
|
36
|
+
<!-- logo + wordmark 组合整体居中(幽灵 197 宽 + 间隙 44 + BugX 约 300 宽 = 541 → 起点 529) -->
|
|
37
|
+
<ellipse cx="628" cy="150" rx="230" ry="140" fill="url(#ghostGlow)"/>
|
|
38
|
+
|
|
39
|
+
<!-- 幽灵光晕层 -->
|
|
40
|
+
<g transform="translate(402,-25) scale(0.85)" filter="url(#softGlow)" opacity="0.5">
|
|
41
|
+
<path d="M 140 260
|
|
42
|
+
C 140 150, 200 120, 256 120
|
|
43
|
+
C 312 120, 372 150, 372 260
|
|
44
|
+
C 372 280, 356 295, 340 280
|
|
45
|
+
C 324 265, 308 265, 292 280
|
|
46
|
+
C 276 295, 260 295, 244 280
|
|
47
|
+
C 228 265, 212 265, 196 280
|
|
48
|
+
C 180 295, 164 295, 148 280
|
|
49
|
+
C 140 272, 140 265, 140 260 Z"
|
|
50
|
+
fill="#7be6f7"/>
|
|
51
|
+
</g>
|
|
52
|
+
<!-- 幽灵主体 -->
|
|
53
|
+
<g transform="translate(402,-25) scale(0.85)">
|
|
54
|
+
<path d="M 140 260
|
|
55
|
+
C 140 150, 200 120, 256 120
|
|
56
|
+
C 312 120, 372 150, 372 260
|
|
57
|
+
C 372 280, 356 295, 340 280
|
|
58
|
+
C 324 265, 308 265, 292 280
|
|
59
|
+
C 276 295, 260 295, 244 280
|
|
60
|
+
C 228 265, 212 265, 196 280
|
|
61
|
+
C 180 295, 164 295, 148 280
|
|
62
|
+
C 140 272, 140 265, 140 260 Z"
|
|
63
|
+
fill="url(#jellyGrad)" mask="url(#hollowMask)"/>
|
|
64
|
+
</g>
|
|
65
|
+
|
|
66
|
+
<!-- 文字标题 -->
|
|
67
|
+
<text class="wordmark" x="766" y="188" font-size="118" fill="#ffffff" letter-spacing="-1">BugX</text>
|
|
68
|
+
|
|
69
|
+
<!-- 中文 tagline -->
|
|
70
|
+
<text class="tagline" x="800" y="300" font-size="35" fill="#e6edf6" text-anchor="middle"><tspan fill="#7be6f7" font-weight="700">BugX</tspan>,让你轻松审计 AI 写的代码。</text>
|
|
71
|
+
|
|
72
|
+
<!-- 副行 -->
|
|
73
|
+
<text class="tagline" x="800" y="348" font-size="20" fill="#8b9bb4" text-anchor="middle">装进你现有开发工具的 AI 审计助手,可以协助你实现代码审查、功能审查、性能审查。</text>
|
|
74
|
+
</svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -21,5 +21,5 @@ from core.autonomous_cve import AutonomousRunner
|
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## 5. Maintenance & Verification
|
|
24
|
-
-
|
|
24
|
+
- Verification is performed with short-lived tests outside the repository; no persistent `tests/` registry is retained.
|
|
25
25
|
- Changes to exported interfaces must be synchronized via `python3 scripts/gen_interface_spec.py --package core/autonomous_cve --write`.
|
|
@@ -625,114 +625,159 @@ def _on_hypothesis_rejected(graph: LivingAttackGraph, payload: Mapping[str, Any]
|
|
|
625
625
|
)
|
|
626
626
|
# 2. 快照:此刻拓扑里还没有本次推测节点。
|
|
627
627
|
snapshot_id = graph.create_snapshot(tag=f"pre-reflex:{hyp_id}")
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
628
|
+
speculative_routes: list[str] = []
|
|
629
|
+
speculative_sinks: list[str] = []
|
|
630
|
+
decision: dict[str, Any] = {}
|
|
631
|
+
attempts = 0
|
|
632
|
+
fix: Any = None
|
|
633
|
+
final_status = ""
|
|
634
|
+
terminal = False
|
|
635
|
+
rolled_back = False
|
|
636
|
+
compensation_failed = False
|
|
637
|
+
pending_error: BaseException | None = None
|
|
638
|
+
|
|
639
|
+
try:
|
|
640
|
+
# 3. 推测拓扑入图(worker 在失败尝试中声称的端点/汇点)。
|
|
641
|
+
speculative_routes = _texts(payload.get("speculative_routes"))
|
|
642
|
+
speculative_sinks = _texts(payload.get("speculative_sinks"))
|
|
643
|
+
for row in payload.get("speculative") or []:
|
|
644
|
+
if isinstance(row, str):
|
|
645
|
+
# 允许只给 id:sink: 前缀归汇点,其余按端点处理。
|
|
646
|
+
if row.startswith("sink:"):
|
|
647
|
+
speculative_sinks.append(row)
|
|
648
|
+
else:
|
|
649
|
+
speculative_routes.append(row)
|
|
650
|
+
continue
|
|
651
|
+
if not isinstance(row, Mapping):
|
|
652
|
+
continue
|
|
653
|
+
try:
|
|
654
|
+
if row.get("kind"):
|
|
655
|
+
result = _on_sink(graph, {**row, "speculative": True}, ctx)
|
|
656
|
+
speculative_sinks.append(result.get("sink_id", ""))
|
|
657
|
+
else:
|
|
658
|
+
result = _on_endpoint(graph, row, ctx)
|
|
659
|
+
node = graph.routes.get(result.get("route_id"))
|
|
660
|
+
if isinstance(node, dict):
|
|
661
|
+
node["speculative"] = True
|
|
662
|
+
speculative_routes.append(result.get("route_id", ""))
|
|
663
|
+
except AttackGraphStoreError:
|
|
664
|
+
continue
|
|
665
|
+
for route_id in speculative_routes:
|
|
666
|
+
if route_id not in graph.routes:
|
|
667
|
+
graph.add_route(route_id, "GET", True, speculative=True, unit_id=_text(payload.get("unit_id")))
|
|
668
|
+
for sink_id in speculative_sinks:
|
|
669
|
+
if sink_id not in graph.sinks:
|
|
670
|
+
graph.add_sink(sink_id, _text(payload.get("kind")) or "unknown",
|
|
671
|
+
speculative=True, unit_id=_text(payload.get("unit_id")))
|
|
672
|
+
# 4. 反思回溯:历史直接别名在 graph.reflex 上,因此天然跨 Round 存活。
|
|
673
|
+
engine = ReflexiveBacktrackingEngine(graph)
|
|
674
|
+
history_before = len(engine.backtrack_history.get(hyp_id, []))
|
|
675
|
+
decision = engine.record_attempt(
|
|
676
|
+
hyp_id,
|
|
677
|
+
status_code=int(payload.get("status_code") or 0),
|
|
678
|
+
response_body=str(payload.get("response_body") or payload.get("body_snippet") or ""),
|
|
679
|
+
is_exploit_successful=bool(payload.get("is_exploit_successful", False)),
|
|
680
|
+
has_negative_control=bool(payload.get("has_negative_control", False)),
|
|
681
|
+
request_context=payload.get("request_context") if isinstance(payload.get("request_context"), Mapping) else None,
|
|
682
|
+
)
|
|
683
|
+
attempts = len(engine.backtrack_history.get(hyp_id, [])) - history_before
|
|
684
|
+
# 5. 自动修包产物**只作为图谱属性/reflex 记录**,绝不回写证据文件。
|
|
685
|
+
# 节点级属性留到回滚之后再写,否则会被自己刚恢复的快照抹掉。
|
|
686
|
+
fix = decision.get("heuristic_fix")
|
|
687
|
+
if isinstance(fix, Mapping):
|
|
688
|
+
suggestions = graph.reflex.setdefault("auto_fix_suggestions", [])
|
|
689
|
+
suggestions.append({"hypothesis_id": hyp_id, **dict(fix), "recorded_at": time.time()})
|
|
690
|
+
del suggestions[:-_ag.MAX_ROLLBACK_LOG]
|
|
691
|
+
# 有可尝试的补丁头 → 记录就地重放计划,交给有网络能力的消费者执行。
|
|
692
|
+
headers = fix.get("patch_headers")
|
|
693
|
+
if isinstance(headers, Mapping) and headers:
|
|
694
|
+
pending = graph.reflex.setdefault("replay_pending", [])
|
|
695
|
+
pending.append({
|
|
696
|
+
"hypothesis_id": hyp_id,
|
|
697
|
+
"patch_headers": dict(headers),
|
|
698
|
+
"unit_id": _text(payload.get("unit_id")),
|
|
699
|
+
# A replay plan is only useful when a later network-capable
|
|
700
|
+
# caller can prove it is still bound to the same target.
|
|
701
|
+
"target_fingerprint": _text(payload.get("target_fingerprint")) or None,
|
|
702
|
+
"queued_at": time.time(),
|
|
703
|
+
"attempts": attempts,
|
|
704
|
+
})
|
|
705
|
+
del pending[:-_ag.MAX_ROLLBACK_LOG]
|
|
706
|
+
# 6. 终结性拒绝的裁决数据。``terminal`` 由结算门禁裁定,而不是只信引擎的
|
|
707
|
+
# HTTP 启发式;final_status 必须等回滚之后才写回节点(见 finally)。
|
|
708
|
+
final_status = _text(decision.get("status"))
|
|
709
|
+
terminal = decision.get("action") in {"close_hypothesis", "abort_exhausted"} or _as_bool(
|
|
710
|
+
payload.get("terminal"), False
|
|
711
|
+
)
|
|
712
|
+
if terminal and final_status not in {"refuted", "not_applicable"}:
|
|
713
|
+
final_status = "refuted"
|
|
714
|
+
except BaseException as exc:
|
|
715
|
+
# 事务中途的任何失败都强制补偿:推测拓扑绝不能跨异常留存。
|
|
716
|
+
pending_error = exc
|
|
717
|
+
terminal = False
|
|
718
|
+
finally:
|
|
719
|
+
# 事务补偿:只要事务本应回滚(终态拒绝)或中途失败,就无条件尝试回滚。
|
|
720
|
+
# rollback_to_snapshot 幂等/可重入——向同一快照重复回滚是 no-op 且返回 True,
|
|
721
|
+
# 因此此处执行是安全的;终态裁决一律在回滚之后再写。
|
|
722
|
+
if terminal or pending_error is not None:
|
|
723
|
+
try:
|
|
724
|
+
rolled_back = graph.rollback_to_snapshot(snapshot_id)
|
|
725
|
+
except Exception as exc:
|
|
726
|
+
# fail-closed:补偿失败时绝不静默留下"已完成拒绝"的假象。
|
|
727
|
+
# 把假设显式标记为未完成,并保留失败原因与快照锚。
|
|
728
|
+
rolled_back = False
|
|
729
|
+
compensation_failed = True
|
|
730
|
+
marker = {
|
|
731
|
+
"status": "rollback_failed",
|
|
732
|
+
"status_reason": (
|
|
733
|
+
f"推测拓扑回滚补偿失败,假设未完成: {exc}"
|
|
734
|
+
),
|
|
735
|
+
"speculative_cleanup_failed": True,
|
|
736
|
+
"reflex_snapshot_id": snapshot_id,
|
|
737
|
+
}
|
|
738
|
+
survivor = graph.hypotheses.get(hyp_id)
|
|
739
|
+
if isinstance(survivor, dict):
|
|
740
|
+
survivor.update(marker)
|
|
741
|
+
else:
|
|
742
|
+
add_attrs = {k: v for k, v in marker.items() if k != "status"}
|
|
743
|
+
graph.add_hypothesis(hyp_id, kind, target, "rollback_failed", **add_attrs)
|
|
744
|
+
if not compensation_failed and terminal and rolled_back:
|
|
745
|
+
# 回滚把假设状态带回 snapshot 时刻的 testing,
|
|
746
|
+
# 所以终态必须在回滚之后再写一次。
|
|
747
|
+
node = graph.hypotheses.get(hyp_id)
|
|
748
|
+
if node is None:
|
|
749
|
+
graph.add_hypothesis(
|
|
750
|
+
hyp_id, kind, target, final_status or "refuted",
|
|
751
|
+
status_reason="假设被反驳,推测拓扑已回滚",
|
|
752
|
+
)
|
|
753
|
+
else:
|
|
754
|
+
graph.update_hypothesis_status(
|
|
755
|
+
hyp_id, final_status or "refuted",
|
|
756
|
+
_text(payload.get("reason")) or "假设被反驳,推测拓扑已回滚",
|
|
757
|
+
)
|
|
758
|
+
survivor = graph.hypotheses.get(hyp_id)
|
|
759
|
+
if isinstance(survivor, dict):
|
|
760
|
+
survivor["reflex_backtrack_depth"] = attempts
|
|
761
|
+
survivor["reflex_snapshot_id"] = snapshot_id
|
|
762
|
+
rollbacks = graph.reflex.setdefault("rollbacks", [])
|
|
763
|
+
rollbacks.append({
|
|
764
|
+
"snapshot_id": snapshot_id,
|
|
684
765
|
"hypothesis_id": hyp_id,
|
|
685
|
-
"
|
|
686
|
-
"
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
"
|
|
690
|
-
"
|
|
691
|
-
"attempts": attempts,
|
|
766
|
+
"reason": _text(decision.get("action")) or "terminal_rejection",
|
|
767
|
+
"rolled_back": rolled_back,
|
|
768
|
+
"compensation_failed": compensation_failed,
|
|
769
|
+
"routes_dropped": max(0, len(speculative_routes)),
|
|
770
|
+
"sinks_dropped": max(0, len(speculative_sinks)),
|
|
771
|
+
"at": time.time(),
|
|
692
772
|
})
|
|
693
|
-
del
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
terminal = decision.get("action") in {"close_hypothesis", "abort_exhausted"} or _as_bool(
|
|
702
|
-
payload.get("terminal"), False
|
|
703
|
-
)
|
|
704
|
-
if terminal and final_status not in {"refuted", "not_applicable"}:
|
|
705
|
-
final_status = "refuted"
|
|
706
|
-
rolled_back = False
|
|
707
|
-
if terminal:
|
|
708
|
-
rolled_back = graph.rollback_to_snapshot(snapshot_id)
|
|
709
|
-
if rolled_back:
|
|
710
|
-
node = graph.hypotheses.get(hyp_id)
|
|
711
|
-
if node is None:
|
|
712
|
-
graph.add_hypothesis(
|
|
713
|
-
hyp_id, kind, target, final_status or "refuted",
|
|
714
|
-
status_reason="假设被反驳,推测拓扑已回滚",
|
|
715
|
-
)
|
|
716
|
-
else:
|
|
717
|
-
graph.update_hypothesis_status(
|
|
718
|
-
hyp_id, final_status or "refuted",
|
|
719
|
-
_text(payload.get("reason")) or "假设被反驳,推测拓扑已回滚",
|
|
720
|
-
)
|
|
721
|
-
survivor = graph.hypotheses.get(hyp_id)
|
|
722
|
-
if isinstance(survivor, dict):
|
|
723
|
-
survivor["reflex_backtrack_depth"] = attempts
|
|
724
|
-
survivor["reflex_snapshot_id"] = snapshot_id
|
|
725
|
-
rollbacks = graph.reflex.setdefault("rollbacks", [])
|
|
726
|
-
rollbacks.append({
|
|
727
|
-
"snapshot_id": snapshot_id,
|
|
728
|
-
"hypothesis_id": hyp_id,
|
|
729
|
-
"reason": _text(decision.get("action")) or "terminal_rejection",
|
|
730
|
-
"rolled_back": rolled_back,
|
|
731
|
-
"routes_dropped": max(0, len(speculative_routes)),
|
|
732
|
-
"sinks_dropped": max(0, len(speculative_sinks)),
|
|
733
|
-
"at": time.time(),
|
|
734
|
-
})
|
|
735
|
-
del rollbacks[:-_ag.MAX_ROLLBACK_LOG]
|
|
773
|
+
del rollbacks[:-_ag.MAX_ROLLBACK_LOG]
|
|
774
|
+
|
|
775
|
+
if pending_error is not None:
|
|
776
|
+
raise pending_error
|
|
777
|
+
if compensation_failed:
|
|
778
|
+
raise AttackGraphStoreError(
|
|
779
|
+
f"推测拓扑回滚补偿失败,假设 {hyp_id} 已标记未完成 (snapshot={snapshot_id})"
|
|
780
|
+
)
|
|
736
781
|
survivor = graph.hypotheses.get(hyp_id)
|
|
737
782
|
if isinstance(survivor, dict) and isinstance(fix, Mapping):
|
|
738
783
|
survivor["auto_fix_action"] = _text(fix.get("action"))
|
|
@@ -750,6 +795,7 @@ def _on_hypothesis_rejected(graph: LivingAttackGraph, payload: Mapping[str, Any]
|
|
|
750
795
|
"backtrack_depth": attempts,
|
|
751
796
|
"terminal": terminal,
|
|
752
797
|
"rolled_back": rolled_back,
|
|
798
|
+
"compensation_failed": compensation_failed,
|
|
753
799
|
"snapshot_id": snapshot_id,
|
|
754
800
|
"history_total": len(engine.backtrack_history.get(hyp_id, [])),
|
|
755
801
|
}
|
|
@@ -79,6 +79,12 @@ PATTERNS: tuple[tuple[str, str, re.Pattern[str], float], ...] = (
|
|
|
79
79
|
)
|
|
80
80
|
|
|
81
81
|
|
|
82
|
+
def _strip_dot_prefix(path: str) -> str:
|
|
83
|
+
"""剥 "./" 前缀(F-029):str.lstrip("./") 是字符集剥离,会吃掉
|
|
84
|
+
点前缀文件名(.bugx/.tests/.github)的开头点——symbol_index.py:198
|
|
85
|
+
已记载该坑,本仓其余站点此番统一对齐。"""
|
|
86
|
+
return path[2:] if path.startswith("./") else path
|
|
87
|
+
|
|
82
88
|
def discover_surfaces(root: Path) -> list[dict]:
|
|
83
89
|
root = root.resolve()
|
|
84
90
|
surfaces: dict[tuple[str, str, str, str, int], Surface] = {}
|
|
@@ -242,10 +248,10 @@ def query_behavior_graph(
|
|
|
242
248
|
graph = build_behavior_graph(project_root)
|
|
243
249
|
|
|
244
250
|
if file_filter:
|
|
245
|
-
norm = file_filter.strip()
|
|
251
|
+
norm = _strip_dot_prefix(file_filter.strip()).rstrip("/")
|
|
246
252
|
|
|
247
253
|
def matches(path: str) -> bool:
|
|
248
|
-
path = str(path).replace("\\", "/")
|
|
254
|
+
path = _strip_dot_prefix(str(path).replace("\\", "/"))
|
|
249
255
|
return path == norm or path.startswith(norm + "/")
|
|
250
256
|
|
|
251
257
|
surfaces = [s for s in graph["surfaces"] if matches(s["path"])]
|
|
@@ -57,7 +57,10 @@ class AutoHuntVerifier:
|
|
|
57
57
|
controls = report.get("negative_controls", {})
|
|
58
58
|
total_controls = controls.get("total", 0)
|
|
59
59
|
suppressed_controls = controls.get("suppressed", 0)
|
|
60
|
-
|
|
60
|
+
# 零负对照 = 没有反假阳性证据,不能记满分(fail-open 会让
|
|
61
|
+
# status=PASS 的 driver 拿到 PASSED 收据,等于给"未做负对照"背书)。
|
|
62
|
+
# 无证据时记 0.0,收据只能 FAILED;有负对照才按抑制率计算。
|
|
63
|
+
neg_pass_rate = (suppressed_controls / total_controls) if total_controls > 0 else 0.0
|
|
61
64
|
|
|
62
65
|
now = datetime.datetime.now(datetime.timezone.utc)
|
|
63
66
|
receipt_dict: dict[str, Any] = {
|
package/core/bugx.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: bugx
|
|
3
3
|
# Frontmatter is host/Agent routing metadata. Human-facing usage guidance belongs in README.md and docs/.
|
|
4
4
|
description: Use BugX ONLY when explicitly asked to perform a deep project code audit, adversarial vulnerability hunting, or automated PoC bug reproduction and remediation. Do NOT use BugX for normal conversation, everyday coding, minor bug fixes, or documentation tasks. Normal development should proceed without activating BugX lifecycle.
|
|
5
|
-
version: 1.
|
|
5
|
+
version: 0.1.1
|
|
6
6
|
mode: all
|
|
7
7
|
temperature: 0.1
|
|
8
8
|
permission:
|
package/core/bugx_paths.py
CHANGED
|
@@ -43,8 +43,8 @@ CONTRACT_VERSION_RE = re.compile(
|
|
|
43
43
|
def contract_version(value: object) -> str | None:
|
|
44
44
|
"""Return the compatibility contract version (``x.y.z``).
|
|
45
45
|
|
|
46
|
-
预发布与构建后缀被忽略:``1.
|
|
47
|
-
``1.
|
|
46
|
+
预发布与构建后缀被忽略:``0.1.1+2``、``0.1.0rc1``、``v0.1.0`` 都归一到
|
|
47
|
+
``0.1.1``。这是门禁与 CLI 共用的唯一实现;任何一侧自行实现比较规则都会
|
|
48
48
|
重新引入"两个入口结论相反"的缺陷。
|
|
49
49
|
"""
|
|
50
50
|
if not isinstance(value, str):
|
|
@@ -104,6 +104,8 @@ def _version_from_text(path: Path, pattern: re.Pattern[str],
|
|
|
104
104
|
except (OSError, UnicodeError):
|
|
105
105
|
return None
|
|
106
106
|
value = match.group(1) if match else None
|
|
107
|
+
if value == "0.1.1":
|
|
108
|
+
value = os.environ.get("BUGX_VERSION", "0.1.1").strip()
|
|
107
109
|
return value if value and VERSION_RE.fullmatch(value) else None
|
|
108
110
|
|
|
109
111
|
|
|
@@ -242,14 +244,19 @@ def version_status(root: Path, engine_root: Path,
|
|
|
242
244
|
"cli": cli_version,
|
|
243
245
|
"engine_metadata": _version_from_text(
|
|
244
246
|
engine_root / "metadata.txt",
|
|
245
|
-
re.compile(
|
|
247
|
+
re.compile(
|
|
248
|
+
r'bugx_version:\s*"([\d.]+(?:\+[0-9A-Za-z.-]+)?|\$\{BUGX_VERSION\})"',
|
|
249
|
+
),
|
|
246
250
|
),
|
|
247
251
|
"engine_integrity": _version_from_json(
|
|
248
252
|
engine_root / "engine-integrity.json", "bugx_version",
|
|
249
253
|
),
|
|
250
254
|
"engine_descriptor": _version_from_text(
|
|
251
255
|
engine_root / "bugx.md",
|
|
252
|
-
re.compile(
|
|
256
|
+
re.compile(
|
|
257
|
+
r"^version:\s*([\d.]+(?:\+[0-9A-Za-z.-]+)?|\$\{BUGX_VERSION\})",
|
|
258
|
+
re.M,
|
|
259
|
+
),
|
|
253
260
|
),
|
|
254
261
|
}
|
|
255
262
|
legacy_manifest = _version_from_json(
|
|
@@ -403,6 +410,29 @@ def is_reparse_point(path: Path) -> bool:
|
|
|
403
410
|
return False
|
|
404
411
|
|
|
405
412
|
|
|
413
|
+
def _system_alias(path: Path) -> Path | None:
|
|
414
|
+
"""Return the real path for macOS's harmless ``/tmp`` and ``/var`` aliases.
|
|
415
|
+
|
|
416
|
+
这两个别名是系统安装时就存在的(``/tmp -> /private/tmp``、
|
|
417
|
+
``/var -> /private/var``),普通用户无法创建或篡改,不构成写入越界的
|
|
418
|
+
攻击面;把它们当成攻击特征会让「HOME 落在 /tmp」的隔离环境(mktemp
|
|
419
|
+
沙箱、CI)彻底装不了引擎。
|
|
420
|
+
|
|
421
|
+
判定必须**精确**:只有「父目录就是根、名字恰为 tmp/var、且确实解析到
|
|
422
|
+
``/private/<name>``」才算系统别名。用户区里的同名目录、以及其它顶层
|
|
423
|
+
符号链接(``/opt`` 之类)一律按普通符号链接拒绝——这正是旧实现
|
|
424
|
+
(``current.parent == anchor`` 不限名字)过宽的地方。
|
|
425
|
+
"""
|
|
426
|
+
if path.parent != Path(path.anchor) or path.name not in {"tmp", "var"}:
|
|
427
|
+
return None
|
|
428
|
+
try:
|
|
429
|
+
resolved = path.resolve(strict=True)
|
|
430
|
+
except OSError:
|
|
431
|
+
return None
|
|
432
|
+
expected = Path("/private") / path.name
|
|
433
|
+
return resolved if resolved == expected else None
|
|
434
|
+
|
|
435
|
+
|
|
406
436
|
def assert_no_symlink_components(
|
|
407
437
|
path: Path,
|
|
408
438
|
error_cls: type[Exception] = LayoutError,
|
|
@@ -419,13 +449,19 @@ def assert_no_symlink_components(
|
|
|
419
449
|
DES-17:组件判定统一走 :func:`is_reparse_point`,Windows 上同时覆盖
|
|
420
450
|
junction / reparse point;``src/bugx_cli/infra/security.py`` 与
|
|
421
451
|
``core/verify_life.py`` 均委托到本函数,不再各自维护一份实现。
|
|
452
|
+
|
|
453
|
+
``allow_var_alias`` 豁免的是 :func:`_system_alias` 认定的**系统别名**
|
|
454
|
+
(精确到 ``/tmp``、``/var`` 解析到 ``/private/<name>``),不是「任意顶层
|
|
455
|
+
符号链接」。``core/secure_atomic.reject_symlink_components`` 一直按这个
|
|
456
|
+
语义判定,此前本函数用「父目录是根」做条件,两者口径不一致,导致同一
|
|
457
|
+
路径在安装器里被拒、在原子写入里被接受。
|
|
422
458
|
"""
|
|
423
459
|
absolute = Path(os.path.abspath(str(path)))
|
|
424
460
|
current = Path(absolute.anchor)
|
|
425
461
|
for component in absolute.parts[1:]:
|
|
426
462
|
current /= component
|
|
427
463
|
if is_reparse_point(current):
|
|
428
|
-
if allow_var_alias and current
|
|
464
|
+
if allow_var_alias and _system_alias(current) is not None:
|
|
429
465
|
continue
|
|
430
466
|
if callable(message_formatter):
|
|
431
467
|
err_msg = message_formatter(current, path)
|
|
@@ -802,8 +838,7 @@ def _identity_mismatch(root: Path, manifest: dict) -> bool:
|
|
|
802
838
|
|
|
803
839
|
判定依旧锚定路径指纹:把 ``.bugx`` 拷进另一个项目必须被拒绝——清单只是
|
|
804
840
|
元数据,而账本、知识库、pollings 报告全在目录里,自动放行等于让源项目的
|
|
805
|
-
|
|
806
|
-
的 B4 红线)。
|
|
841
|
+
洞察/错题集/机密静默流进目标项目(B4 红线契约,以本注释为准)。
|
|
807
842
|
|
|
808
843
|
可移植性由**显式迁移**提供,而不是自动放行:``bugx project rebind --migrate``
|
|
809
844
|
把 ``project_id`` 重写为新根指纹,并保留持久化的 ``project_uid``——于是项目
|
|
@@ -1107,7 +1142,7 @@ def sync_global_projects(workspace: Path | None = None) -> list[dict[str, Any]]:
|
|
|
1107
1142
|
if active_ws not in known_map:
|
|
1108
1143
|
known_map[active_ws] = {}
|
|
1109
1144
|
|
|
1110
|
-
# 3. Discover sibling workspaces (e.g.
|
|
1145
|
+
# 3. Discover sibling workspaces (e.g. ~/workspace/*)
|
|
1111
1146
|
# 核心硬防线:如果父目录是系统临时目录、家目录或根目录,绝对禁止扫描兄弟目录;已隐藏项目绝不复活!
|
|
1112
1147
|
try:
|
|
1113
1148
|
ws_parent = active_ws.parent.resolve()
|