Skip to content

Trust a directory subtree instead of a single path? #3078

Open

Description

@ktherage

Context

Trust was introduced in #2924 to address #2923. Decisions are stored per exact directory in trust.json and are non-recursive: every project needs its own entry, either through the language server prompt or phpactor config:trust.

Problem

In a workspace containing several projects (~/Projets/professionnel/*), every project prompts once, and every new clone prompts again. config:trust only ever targets the current project, so there is no way to express "this whole workspace is mine".

Question

Is the per-path model intentional for security reasons, or would an explicit subtree grant be acceptable?

Something like:

phpactor config:trust --trust --subtree   # this directory and everything below it

storing a visible marker in trust.json (e.g. a trailing / or /* key), with exact entries taking precedence so a nested false can revoke a subtree.

Alternatives I considered

  • PHPACTOR_UNCONDITIONAL_TRUST=1: works, but trusts everything in the process, including repositories outside the workspace.
  • A script that enumerates projects and runs config:trust for each: works today with no core change, but needs to be re-run for every new clone.
  • Editor-side automation: answers the prompt automatically, but bypasses the review the prompt is meant to enforce.

Note

I opened #3077 implementing wildcard globs for this. I closed it: a glob language (and "longest pattern wins" precedence) is a much bigger change than the problem warrants, and it makes the semantics of a trust decision harder to reason about. This issue is the narrower question.

No code yet — I would rather agree on the shape first. Happy to implement whichever direction you prefer, including "no, keep it per-path".

Activity

  1. dantleech commented on Oct 20, 2026

    @dantleech
    Collaborator

    How big of an issue is this? How often are new sub-projects introduced? What's to stop you cloning a malicious project in the workspace?

    You can also disable trust altogether via. PHPACTOR_UNCONDITIONAL_TRUST.

    There is also the fact that Phpactor does not currently support workspace folders - I'm not sure but that may mean that ne phpactor.json can serve many workspace folders if that were implemented and so this problem would be avoided that way.

  2. ktherage commented on Oct 20, 2026

    @ktherage
    Author

    How big of an issue is this?

    This is more about UX I concede. Not a real issue.

    How often are new sub-projects introduced?

    No this much as you suggest it.

    What's to stop you cloning a malicious project in the workspace?

    And there's nothing stopping you or anybody from this if you'll allow a wider workspace from an upper level of the folder tree. But even when you install dependencies you can be expose to supply chain attacks. Do we want to blacklist this ?

    You can also disable trust altogether via. PHPACTOR_UNCONDITIONAL_TRUST.

    I saw that and I found that this "all or nothing" way of managing trust is lacking of flexibility in between and so, for those reasons, I was more like opening the discussion on that topic to see what can be done.

    If it's a "we won't do it" that's fine too. I mean it's still a contribution 😉.

    There is also the fact that Phpactor does not currently support workspace folders - I'm not sure but that may mean that ne phpactor.json can serve many workspace folders if that were implemented and so this problem would be avoided that way.

    I don't really get this but IIUC this pull could solve this issue ?

  3. dantleech commented on Oct 20, 2026

    @dantleech
    Collaborator

    I don't really get this but IIUC this pull could solve this issue ?

    that PR is just a brain dump suggesting ways that the LSP workspace feature could be implemented. But it would essentially mean supporting multiple "sub-projects" (workspace folders) in a single LSP session, although I be guess trust would still need to be established somehow and each project would have its own config

  4. pinned and unpinned a comment on Oct 20, 2026
  5. ktherage commented on Oct 21, 2026

    @ktherage
    Author

    although I be guess trust would still need to be established somehow and each project would have its own config

    So you mean having a phpactor.json in each workspace ?
    This could ease edition and so reduce friction of "searching" for the config file and adding the trusted folder.
    Having this at the root of the workspace can IMHO improve UX and so this could be enough to me.

  6. dantleech commented on Oct 21, 2026

    @dantleech
    Collaborator

    Not necessarily - it's just a feature that's realting directly to managing multiple "workspaces" so a solution might be found in that work (or not).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions