Skip to content

[FEATURE]: more general external_directory permissions #4991

Closed

Description

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

I looked at the implementation of of external_directory and it seems to be extremely narrow, as in for a couple of tools. Would it not make sense to check if any path like thing is in the CLI arguments regardless of the command, and if it looks like it matches something on the filesystem invoke the external_directory permissions?

Matching the path-like to actual filepaths should avoid invoking it on false positives.

Activity

  1. github-actions commented on Dec 2, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    These issues all touch on making the permission system more flexible and generalizable beyond specific hardcoded tools. Feel free to ignore if your specific case isn't addressed by these.

  2. rekram1-node commented on Dec 2, 2025

    @rekram1-node
    Contributor

    Yeah it could definitely be better

    and if it looks like it matches something on the filesystem invoke the external_directory permissions?

    What does this mean?

  3. benceferdinandy-signifyd commented on Dec 2, 2025

    @benceferdinandy-signifyd
    Author

    Yeah it could definitely be better

    and if it looks like it matches something on the filesystem invoke the external_directory permissions?

    What does this mean?

    So imagine a command that has an argument that looks like a path but isn't, or is a path, but not relevant on the machine (for the first, maybe some script that does API calls, but the base URL is embedded so you have something like http GET /api/lookup for the latter something like ssh remotemachine ls /var/lib/). In both cases it would look like path outside of the CWD, but the first one is not a path, the latter is not a path on the machine. So my suggestion would be to parse CLI arguments for path like things, but verify if those things are actually paths that exist on the current machine. Such a check (that probably should be glob aware) would tell opencode that /api/lookup is not a path on this machine, so no need to apply external_directory permissions.

    Does that make sense? I feel this would remove the need to hardcode specific commands (although some common commands could still get their own special rules if needed).

  4. rekram1-node commented on Dec 2, 2025

    @rekram1-node
    Contributor

    Yeah I see what you mean

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

Metadata

Metadata

Assignees

Labels

discussionUsed for feature requests, proposals, ideas, etc. Open discussion

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions