Security Policy¶
Supported Versions¶
Security fixes are released for the latest major version only.
| Version | Supported |
|---|---|
| 2.x | ✅ Yes |
| 1.x | ❌ No: upgrade to 2.x (see the CHANGELOG migration map) |
| < 1.0 | ❌ No |
Reporting a Vulnerability¶
Please do not report security vulnerabilities in public issues, discussions or pull requests.
Report them privately through GitHub: Report a vulnerability (the repository's Security tab → Report a vulnerability). This opens a draft advisory that only you and the maintainers can see.
Please include:
- the affected version (
pip show pyeye-mcp, or the commit if running from source) - what an attacker can do, and what they need to be able to control (for example the analysed source tree, the MCP client's tool arguments, or a configuration file)
- steps to reproduce, ideally a minimal project or tool call
- any suggested fix or mitigation
What to Expect¶
This is a small, maintainer-run project with no service-level commitment. What we aim for:
- Acknowledgement: we reply on the advisory as soon as we've seen it.
- Assessment: we tell you whether we can reproduce the issue, and how severe we think it is.
- Fix: a patch release for confirmed issues as soon as one is ready, with the advisory published at the same time. You'll be credited in the advisory unless you prefer not to be.
Please give us a reasonable chance to release a fix before disclosing publicly.
Scope¶
In scope¶
Vulnerabilities in pyeye itself, for example:
- reading or writing files outside what the user asked pyeye to analyse, beyond the documented behaviour below
- code execution triggered by analysing a project's source
- injection through MCP tool arguments, configuration files or analysed source
- a vulnerable dependency that is actually exploitable through pyeye
Out of scope¶
- issues that need an attacker who already controls the machine or the user's account
- findings from automated scanners with no demonstrated impact on pyeye
- vulnerabilities in dependencies that pyeye's usage doesn't expose (report those upstream)
Security Model¶
How pyeye behaves, so you can judge what counts as a vulnerability. The values
in this section are generated from pyeye's code (scripts/docs_facts.py), so
they can't drift from it.
- Static analysis only. pyeye parses and analyses Python source with Jedi. It doesn't import or run the analysed project's code. Calls in the server's code that start a process:
none.
Jedi itself runs a helper process, the server's own Python interpreter, to
introspect compiled modules. It is always the server's own, even when
VIRTUAL_ENV or CONDA_PREFIX names another environment. The project's
environment (its virtualenv) is read from disk, its site-packages and the
plain-path lines of its .pth files, and its Python is never run; a .pth
line that would run code is never run. For an editable install whose .pth
imports a finder module, that module is read as text instead, under these limits:
- it must sit beside the .pth file, isn't followed through a symlink, and must be within MAX_FINDER_BYTES (in pyeye.environment, far below the .pth bound);
- it's opened without following links and checked on the same file handle;
- each one is parsed at most once, and at most MAX_FINDER_MODULES are read per environment;
- it's parsed with ast, never imported, and only two plain-literal shapes are taken from it (setuptools' MAPPING/NAMESPACES, and map_module calls; #1035).
A target's root is the directory above it, so a target directly in a home directory makes that home an import root, as a plain .pth line naming it could. Each root still gets the restricted-location check below. The environment, wherever it was found
(the config, the project, VIRTUAL_ENV or CONDA_PREFIX), and each path it
adds are checked once their symlinks are resolved: one that is, is inside,
or contains a restricted directory or credential store is skipped with a
warning. Reading its .pth files is bounded in size and paths
(#993). pyeye's Jedi setting load_unsafe_extensions is
off, so Jedi
loads compiled extensions only from the server's Python environment, never
from the analysed project or a configured package.
- docs-facts never imports or runs the analysed repository's code. The
documentation tooling (scripts/docs_facts.py, pyeye.docs_facts) takes a
repository's facts from source text and data files only. Its per-repository
config is data, and a value that names code to import is refused. A Python
constant is folded from the syntax tree, and the file's imports are never
followed. YAML is read with yaml.safe_load only
(#1091).
- It reads what the MCP client points it at. Tools take a project_path,
and configure_packages can add package, namespace and standalone-script
paths. pyeye reads those paths with the permissions of the user running the
server.
Every caller-supplied path goes through the input check in the form the tool
will finally use: a relative path anchored on the call's project_path (or,
for project_path itself, on the server's working directory), checked both as
spelled and with symlinks followed
(#856). That covers:
project_path, andresolve_at'sfile;resolve's file forms (path/to/file.pyandpath/to/file.py:42);- a plugin tool's
scope="package:<path>"; configure_packages'packages,namespacespaths andstandalone_dirs;- the
packagesentries, thenamespacespaths and thestandalone.dirspaths in a.pyeye.jsonor other config, which are skipped with a warning when refused, rather than failing the call.configure_packageslists them inrejected_paths.
A refused tool argument is an error, never a "not found". A path is rejected for:
- anywhere in the path: null bytes, suspicious triple dots;
- a target matching one of these anchored patterns, ignoring case:
^/etc/,^/private/etc/,^/root/,^/proc/,^/sys/,^/dev/,^/boot/,^/run/secrets/,^/var/run/secrets/,^/private/var/run/secrets/,^/var/root/,^/private/var/root/; - a credential store directly below a user home, or anything inside it, ignoring case:
.ssh,.aws,.gnupg,.config/gcloud,.azure,.kube,.docker,.config/gh,.netrc,.pypirc,.pgpass,.git-credentials,.npmrc; a user home is one of^/home/[^/]+/,^/Users/[^/]+/,^/root/, or the server's own home; - forms checked: the deny-list checks the target's lexical and resolved forms.
A directory pyeye scans (a plugin scope, or a configured package, namespace or standalone directory) is also refused when it is an ancestor of one of the anchored directories above:
/, /private, /private/var, /private/var/run, /run, /var, /var/run. That includes the
scan project_path="/" implies for scope main. project_path itself and
single-file inputs are not affected. Every directory walk also skips a
directory whose resolved form is one of them, so a symlink inside a scanned
tree can't lead a walk into one.
Results are checked the same way. Jedi follows symlinks when it looks up an
import, so a symlink inside the project, or inside the project's virtualenv
site-packages, can point a lookup into one of these directories. A
definition whose file is in one, either as spelled or once its symlinks are
resolved (the same forms and the same rule as for a tool argument, #1019),
is refused: it is reported as not
found, with a detail saying it is in a restricted directory, and an edge
that would point at it lists it among the edge's unresolved targets, by the
source's own spelling, instead. Nothing is drawn from it through a project
symbol either: no inherited signature or parameter default, no base class
or inherited field, and no type annotation's handle (#999). A path that
can't be resolved, such as a symlink loop, counts as restricted. On Windows
only a loop does: other failures to resolve a path strictly (access denied
on a parent, a WindowsApps alias) fall back to a normal resolve, which is
still checked, so readable files aren't refused by mistake (#1005). A symlink into any other directory works as
before.
The credential stores are different: they define no ancestors. A scan of
~, /home or /Users works and simply skips them. A project placed inside
one, such as a repository at ~/.config/gh/x, is refused, as intended. A
user home is matched by pattern, so a home created after the server started
is covered too. When /home, /Users or /root is itself a symlink (BSD's
/home pointing at /usr/home), the homes are also matched where it points,
so a walk through /home/bob still skips /usr/home/bob/.ssh. Each root is
resolved once per process, not on every check, and a root that can't be
resolved yet is matched by its spelling and tried again at the next rebuild
of the store list (#1030). The
server's own home is read once, when the process starts, and is matched both
as $HOME spells it and as it resolves, so a symlinked home (an NFS or
autofs /home/u that points at /data/u) is covered under either name.
When $HOME isn't the user's home in the password database (a service
started with HOME=/srv/app), that home counts as the server's own too
(#1030). A failed lookup (LDAP or SSSD down) is retried, not remembered; a
check made while the lookup runs waits for it, for a short bounded time, so
only a failed or hung lookup leaves that home's stores to the spelled
patterns. A
credential store below the server's home that is itself a
symlink (~/.ssh pointing at /data/keys, or a Windows junction) is also
matched where it points, so a file reached through the target is refused
and a walk skips it. A store linked, removed or repointed while the server
runs (a profile switcher relinking ~/.aws) is matched at its new target
at once: the change is noticed through the times of ~ and ~/.config,
which also catch an mtime set back with touch -d on Linux and macOS,
since the inode change time can't be set back. A walk looks at the stores
once, so a relink during a walk applies from the next one. Limits (#1019,
#1030):
- a store that links to a second link outside ~ and ~/.config, where
that second link is repointed, keeps its old target until ~ or
~/.config next changes, or the server restarts; paths spelled through
the store itself are still refused;
- on Windows, where a directory's change time isn't available, a relink
whose directory's modification time is then set back to exactly its
old value isn't noticed;
- a home on a filesystem whose clock runs well behind the server's (NFS
clock skew) can hide a relink made within the same timestamp tick as
an earlier one;
- another user's store that is a symlink (/home/bob/.ssh pointing at
/data/bob) is refused by its spelling only, not where it points:
finding those would mean reading every user's home (#1030);
- /home, /Users or /root relinked while the server runs is seen after
a restart (#1030);
- one user's home that is itself a symlink (/home/bob2 pointing at
/data/bob2), when it isn't the server's own: a walk through
/home/bob2 reaches /data/bob2/.ssh, which no home pattern names.
Results are still refused, because their spelled form under /home is
checked too (#1030);
- a store below the password-database home that is linked or repointed
while the server runs, when that home isn't $HOME, is matched at its
new target only when the store list is next rebuilt (a change in $HOME's
store directories) or after a restart. Checking it on every call would
stat that home each time, which hangs every check if it's on a dead
mount. Paths spelled through the store are refused all along (#1030).
Homes anywhere other than directly in /home, /Users or
/root (for example /var/lib/jenkins, a nested /home/groups/u,
/srv/users/bob or /export/home/u) are covered only for the server's own
user; other users' homes there are not (#909).
A directory walk also skips a file or directory that is a symlink into any
restricted location, such as a project file x.py that points at
~/.netrc, so a scan never reads one through a link.
A directory merely named like one of these inside another path, such as
~/dev/proj, /srv/etc/lib or a project's own etc/ package, is not
refused: only where the path leads counts (#939).
The patterns are POSIX system paths. On Windows a resolved path starts with a drive letter, so they never match it. This is a sanity check, not a sandbox: - any directory the server's user can read can be analysed if a client asks for it; - the check is the deny-list above, nothing more: any other directory the server's user can read is in reach.
Run the server as a user whose read access you're comfortable exposing to your MCP client. - What it writes. Every place in the server's code that writes a file or creates a directory:
pyeye.config:ProjectConfig.save_config, pyeye.config:create_example_config, pyeye.mcp.__main__:_configure_logging.
Among them, the files the server keeps:
- the project configuration,
<project_path>/.pyeye.json, when
configure_packages adds packages, namespaces or standalone directories.
The parameter and its default:
save: true;
pass save=false to change only the running configuration;
- logs, to the file named by
PYEYE_LOG_FILE, if it's set.
None of these writes the analysed source files.
- No network access is needed for analysis. Imports of a networking module
in the server's code: none.
- A repository's network paths are never looked up (#1048). On Windows,
checking whether \\host\share\x exists connects to that host over SMB, which
can send it your NTLM credentials. So a path that a repository supplies is
refused before anything touches it when it is a network (UNC) or device path,
or relative to a drive's current directory or root. That covers .pth lines
and editable-install finder targets, declared path dependencies,
[tool.pyright] extra paths, the project's own config files, .gitmodules
and .git pointers, and the sys.path changes Jedi reads in the project's
code. A ~ path is checked after expansion too: with a roaming profile on a
share, a repository entry written as ~/x is refused. So are a
repository-supplied \\?\C:\long path and a POSIX-style /opt/libs; a shared
config that needs one should use a relative or drive-qualified path. Paths
you pass to a tool, and your own global config, are your choice and are not
refused. On POSIX nothing is refused. A mapped network drive, or a link
pointing at a share, can't be recognised this way.
Security Checks in Development¶
The pre-commit hooks run detect-secrets
and bandit on every commit, and
pip-audit (against the locked dependency set) whenever pyproject.toml or
uv.lock changes. CI runs all three on every pull request. See
CONTRIBUTING.md.