You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add an option to disable reading project config file or dangerous options in it #2923
I am concerned that malicious .phpactor.json file in the project can lead to arbitrary code execution via configuration options like language_server_psalm.bin with only minimal interaction.
All it would take is to download malicious package and try to inspect its content, depending on the editor and lsp client setup.
For example, default neovim nvim-lspconfig autostart feature with .phpactor.json as one of the default root markers would allow it to be anywhere too. Just open any php file below it in the tree, phpactor would be started automatically and we got got.
Ideally, project config should be explicitly marked as trusted, much like most IDEs are doing, before any unsafe options are allowed to be used. Ability to disable them entirely at project level would be a reasonably good enuf solution in the short term.
@dantleech This looks like a great change in terms of security, but using the vim plugin (without the CLI installed), I'm unclear how to trust a project's .phpactor.json file.
When I try to do something like :PhpactorContextMenu, I'm getting this error within Neovim:
Error detected while processing function phpactor#ContextMenu[1]..phpactor#rpc[19]..function phpactor#ContextMenu[1]..phpactor#rpc:line 18:
E605: Exception not caught: Could not parse response from Phpactor: Vim(let):E474: Unidentified byte: Local config ".phpactor.json" f
If I try to run my keymap for :PhpactorImportClass, I get this error:
E5108: Error executing lua: vim/_editor.lua:0: nvim_exec2()[1]..function phpactor#ImportClass[1]..phpactor#rpc, line 18: Could not parse response from Phpactor: Vim(let):E474: Unidentified byte: Local config ".phpactor.json" found but it's in an untrusted directory, run `phpactor config:trust` if you want it to be loaded
{"version":"1.0.0","action":"input_callback","parameters":{"inputs":[{"name":"qualified_name","type":"list","parameters":{"default":null,"label":"Select class:","choices":{"Illuminate\\Support\\Carbon":"Illuminate\\Support\\Carbon","Carbon\\Carbon":"Carbon\\Carbon"},"keyMap":[],"multi":false}}],"callback":{"action":"import_class","parameters":{"qualified_name":null,"alias":null,"source":"<?php\n\nnamespace App\\Settings;\n\nuse Spatie\\LaravelSettings\\Settings;\n\nclass BannerNotification extends Settings\n{\n public bool $active;\n\n public string $message;\n\n public Carbon $test;\n\n public static function group(): string\n {\n return 'banner';\n }\n}","offset":181,"path":"\/Users\/nexxai\/code\/ipms\/app\/Settings\/BannerNotification.php"}}}}
stack traceback:
[C]: in function 'nvim_exec2'
vim/_editor.lua: in function 'cmd'
/Users/nexxai/.config/nvim/lua/config/keymaps.lua:39: in function </Users/nexxai/.config/nvim/lua/config/keymaps.lua:35>
I've looked and don't see any :PhpactorConfigTrust or anything similar, so I assume this is just due to this change not being cemented yet, but I also could be missing something super obvious too.
I'm experiencing the same behavior as @nexxai, strange thing is that even with the latest tag at the moment: 2025.07.25.0
the config:trust command is not available (Command "config:trust" is not defined.). I've also tried to add the core.trust key manually using the config:set option but then after running any command I have the warning: Phpactor\MapResolver\InvalidMap: Key(s) "core.trust" are not known
I've bypassed the whole trust logic by adding the env variable PHPACTOR_UNCONDITIONAL_TRUST=1 to my terminal.
Please let me know if you need any extra information.
I've suppressed the error when the incoming call is from the legacy RPC (i.e. the VIM plugin), I've also added :PhpactorTrust and :PhpactorUntrust commands to the VIM plugin.
I'm experiencing the same behavior as @nexxai, strange thing is that even with the latest tag at the moment
the version with this feature hasn't been tagged yet, so that is strange - possibly you have two versions of Phpactor?
You're right, Mason takes the bin from the tag but Lazy is taking data directly from the master branch. Thanks for adding the extra commands for us vim users 😄
Activity
gh-2923: Ask permission to load `.phpactor.json` in project root
dantleech commentedon Sep 6, 2025
That's a very valid concern, can you test: #2924 ?
gh-2923: Ask permission to load `.phpactor.json` in project root
gh-2923: Ask permission to load `.phpactor.json` in project root
gh-2923: Ask permission to load `.phpactor.json` in project root
gh-2923: Ask permission to load `.phpactor.json` in project root
gh-2923: Ask permission to load `.phpactor.json` in project root
Ask permission to load `.phpactor.json` in project root (#2924)
Xerkus commentedon Sep 6, 2025
That was fast. Thank you
nexxai commentedon Sep 21, 2025
@dantleech This looks like a great change in terms of security, but using the vim plugin (without the CLI installed), I'm unclear how to trust a project's
.phpactor.jsonfile.When I try to do something like
:PhpactorContextMenu, I'm getting this error within Neovim:If I try to run my keymap for
:PhpactorImportClass, I get this error:I've looked and don't see any
:PhpactorConfigTrustor anything similar, so I assume this is just due to this change not being cemented yet, but I also could be missing something super obvious too.przepompownia commentedon Sep 22, 2025
Try
./bin/phpactor config:trust(relative to the plugin directory) while such Vim command not defined yet.michel-cetina commentedon Sep 23, 2025
I'm experiencing the same behavior as @nexxai, strange thing is that even with the latest tag at the moment: 2025.07.25.0
the config:trust command is not available (Command "config:trust" is not defined.). I've also tried to add the core.trust key manually using the config:set option but then after running any command I have the warning: Phpactor\MapResolver\InvalidMap: Key(s) "core.trust" are not known
I've bypassed the whole trust logic by adding the env variable PHPACTOR_UNCONDITIONAL_TRUST=1 to my terminal.
Please let me know if you need any extra information.
dantleech commentedon Sep 28, 2025
the version with this feature hasn't been tagged yet, so that is strange - possibly you have two versions of Phpactor?
gh-2923: Avoid fatal crash in VIM plugin
Gh 2923: (vim plugin) do not corrupt JSON response with trust message (…
dantleech commentedon Sep 28, 2025
I've suppressed the error when the incoming call is from the legacy RPC (i.e. the VIM plugin), I've also added
:PhpactorTrustand:PhpactorUntrustcommands to the VIM plugin.michel-cetina commentedon Oct 1, 2025
You're right, Mason takes the bin from the tag but Lazy is taking data directly from the master branch. Thanks for adding the extra commands for us vim users 😄