Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

squirrel 0.18 无法使用自行编译的插件 #877

Closed
thelastlin opened this issue May 6, 2024 · 4 comments · Fixed by #898
Closed

squirrel 0.18 无法使用自行编译的插件 #877

thelastlin opened this issue May 6, 2024 · 4 comments · Fixed by #898

Comments

@thelastlin
Copy link

thelastlin commented May 6, 2024

问题表现

Squirrel 0.18 无法使用自行编译的插件。在尝试加载自行编译的插件时,dlopen会给出错误:

code signature in <UUID> '/Library/Input Methods/Squirrel.app/Contents/Frameworks/rime-plugins/librime-<PLUGIN_NAME>.dylib' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs

自行重新编译或对原有的binary重新进行签名可避免此错误。

可能解决方案

@LEOYoon-Tsaw
Copy link
Member

LEOYoon-Tsaw commented May 6, 2024

可是這樣的話簽名就是個擺設了,思考一下
會有安全隱患嗎,比如用戶放了一個不安全的插件進去
以前插件是和librime綑綁的,換插件比較麻煩要連著librime一起換,現在可以單獨換插件,還是可能有很多人去加插件的
有沒有啥能兼顧一點安全的辦法

@thelastlin
Copy link
Author

thelastlin commented May 7, 2024

會有安全隱患嗎,比如用戶放了一個不安全的插件進去

输入法位于 /Library/Input\ Methods/,这一目录默认是只有root用户可修改。
如果用户将插件放到/Library/Input Methods/Squirrel.app/Contents/Frameworks/rime-plugins中的话,那可以认为具有管理员权限的用户一定授权了这一行为,应对此行为负责。

对于安全隐患,OpenSSH先前出现过一个类似的问题:CVE-2023-38408

有沒有啥能兼顧一點安全的辦法

也许确实没有。
作为参考,Apple在随Mac OS X自带的OpenSSH和sudo中带有一个类似的私有entitlement:com.apple.private.security.clear-library-validation,它们会在dlopen失败时禁用library的签名验证,对应的代码及文章说明可参见 apple-oss-distributions/OpenSSHhttps://theevilbit.github.io/posts/com.apple.private.security.clear-library-validation/

如果想要强化安全性的话,似乎可以考虑修改librime,只允许加载指定目录中的插件,并且在插件加载前先检查插件的所有者、权限和ACL,若非root用户具有写权限时则拒绝加载。

@Urie96
Copy link

Urie96 commented May 10, 2024

升级之后lua require so也会报签名错误,求助怎么解决

@LEOYoon-Tsaw
Copy link
Member

需要用第三方庫的先別升級,或者有能力的自己簽名吧,過不久再發一版,只是沒想好是否分成兩個版本,一般用戶就用安全版,想折騰的用戶去用不驗證動態庫的版本並自行承擔風險

@LEOYoon-Tsaw LEOYoon-Tsaw linked a pull request May 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants