fix(chv-muse-r11fix): authd 层 5 去掉 store helper,chv-sync 回落改 fail-closed
round-11 真机测试证实:镜像 /etc/gitconfig 的 [credential] helper = store 把 authd 释放的长效 token 写进了客内 /home/chv/.git-credentials(0600)。改动:build.sh 不再设 store helper;chv-sync boot 在 authd socket/helper 缺失时直接 die,不再把 token 写进 .git-credentials(旧落盘回落废止); authd helper 是唯一凭证 helper,且自身绝不落盘。旧镜像上 boot 现在会直接失败,须用含 authd 的新镜像。测试:无 authd 时 boot 失败且 .git-credentials 不产生、干跑不再含 store helper;P3 差距表 §3.5 更新为已关闭。
This commit is contained in:
1 parent
9f593d62ef
commit
f093558c0d
5 files changed
+60
-27
No files matched your search
@@ -732,6 +732,31 @@ class ChvSyncTest(unittest.TestCase):
|
||||
r = self._sync("boot", env_extra={"CHV_GUEST_ENV": env_file})
|
||||
self.assertNotEqual(r.returncode, 0)
|
||||
|
||||
def test_boot_without_authd_fails_closed_no_credentials_file(self):
|
||||
# round-11 真机修复(层 5):authd 不在时 boot 直接失败,
|
||||
# 绝不把 token 写进 ~/.git-credentials(旧落盘回落已废止;
|
||||
# 即使 guest-env 里有 token 也不写)。
|
||||
if os.getuid() != 0:
|
||||
self.skipTest("boot 须以 root 运行")
|
||||
env_file = os.path.join(self.dir, "guest-env")
|
||||
with open(env_file, "w") as fh:
|
||||
fh.write("GITEA_URL=https://gitea.tose.top\n"
|
||||
"GITEA_USER=admin\n"
|
||||
"SYNC_REPO=admin/chv-sync-test\n"
|
||||
"GITEA_TOKEN=fake-token-for-test\n")
|
||||
home = os.path.join(self.dir, "home")
|
||||
os.makedirs(home, exist_ok=True)
|
||||
r = self._sync("boot", env_extra={
|
||||
"CHV_GUEST_ENV": env_file,
|
||||
"CHV_USER_HOME": home,
|
||||
"CHV_USER": "root",
|
||||
"CHV_AUTHD_SOCKET": os.path.join(self.dir, "no-authd.sock"),
|
||||
})
|
||||
self.assertNotEqual(r.returncode, 0)
|
||||
self.assertIn("chv-authd 未运行", r.stderr)
|
||||
self.assertFalse(
|
||||
os.path.exists(os.path.join(home, ".git-credentials")))
|
||||
|
||||
|
||||
# -- (6) 中途死亡 → interrupted → 断点续跑闭环 ---------------------------
|
||||
class MidDeathLoopTest(ChvGapCase):
|
||||
|
||||
@@ -632,6 +632,10 @@ class BuildDryRunTest(unittest.TestCase):
|
||||
self.assertIn(needle, out, needle)
|
||||
# P1 文件不在本分支:干跑只警告、不失败。
|
||||
self.assertIn("vsock_notify.py 不在仓库里", out)
|
||||
# round-11 真机修复(层 5):镜像不再设 store helper
|
||||
#(authd helper 是唯一凭证 helper),git user 仍配。
|
||||
self.assertNotIn("credential.helper store", out)
|
||||
self.assertIn("git config --system user.name chv", out)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user