release 载荷二进制内嵌 CI 构建机绝对路径(strip 后仍残留于 .rodata)

Open Beginner friendly
#66 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp
Domain
release

Research direction

Start by reading the release build workflow and the configuration that builds mcppls/bin/mcppls; the issue identifies the embedded paths as coming from dependency __FILE__ macros. Check how compiler flags are passed to the release build, then add an appropriate prefix map and inspect a rebuilt binary with strings -a for /home/runner paths. Done when the release payload no longer exposes those build paths.

Written by the indexing model from the issue text.

Description

环境
  • mcppls v0.0.16 payload-linux-x64.tar.gz(官方 release 载荷,非源码自建)
  • Linux x86_64
现象

mcppls/bin/mcppls 为静态链接且已 strip 的 ELF,但 strings 仍可见构建机绝对路径。它们来自依赖包源码中断言宏的 __FILE__,位于只读数据段,strip 无法去除:

$ strings -a bin/mcppls | grep -E '^/home/runner' | sort -u | head -4
/home/runner/.mcpp/registry/data/xpkgs/mcpplibs-x-openkal-llvm-runtime/0.15.1/openkal-llvm-runtime-0.15.1/llvm/libcxxabi/src/cxa_demangle.cpp
/home/runner/.mcpp/registry/data/xpkgs/mcpplibs-x-openkal-llvm-runtime/0.15.1/openkal-llvm-runtime-0.15.1/llvm/libcxxabi/src/demangle/ItaniumDemangle.h
/home/runner/.mcpp/registry/data/xpkgs/nlohmann-x-json/3.12.0/json-3.12.0/single_include/nlohmann/json.hpp
影响
  1. 断言/诊断消息会把 CI 机器路径打印给最终用户。
  2. 下游再分发的产物隐私/供应链扫描会因嵌入构建机路径而拒绝发布(meditor 的发布门禁即如此,无法放行包含构建环境路径的载荷)。
建议

release 构建加入 -ffile-prefix-map=<abs>=.(或等价的相对路径编译),使 __FILE__/断言消息不含 CI 绝对路径。参照:同载荷中 clangd/bin/clangd 使用 $ORIGIN 相对 RUNPATH 且无内嵌构建路径,说明流程上可以做到干净。

背景

meditor(https://github.com/speak-agent/meditor ,GPL-3.0-only,专注 mcpp 与 C++ Modules 的编辑器)按 SHA-256 固定引用 mcppls 官方 release 载荷随包分发。下游已用打包期处理临时解决,但希望上游在 release 流程根治,之后下游可直接升级 pin。

Dominant language
C++
Stars
25
Forks
2
Avg merge
21h 5m
Merged PRs (30d)
13

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Sunrisepeak/mcpp-language-server

All issues in Sunrisepeak/mcpp-language-server

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.