Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / module
git_source
codeintel.git_source
PINNED SOURCE Source and edges from the index at this commit. An execution appears only where one was recorded.
PHAROS at 975a38dMIT license
Around this symbol
Search all symbolsLoading
| Symbol | File | Resolved by |
|---|---|---|
| _auth_config | git_source.py | same file |
| _classify | git_source.py | same file |
| _git_env | git_source.py | same file |
| _is_ip_literal | git_source.py | same file |
| _local_ref | git_source.py | same file |
| _run | git_source.py | same file |
| _sanitize | git_source.py | same file |
| Checkout | git_source.py | same file |
| GitError | git_source.py | same file |
| local_git_dir | git_source.py | same file |
| open_checkout | git_source.py | same file |
| parse_repo_spec | git_source.py | same file |
| raw_file_url | git_source.py | same file |
| read_file_at_commit | git_source.py | same file |
| RepoRef | git_source.py | same file |
| RepoSpecError | git_source.py | same file |
| TreeEntry | git_source.py | same file |
| validate_ref | git_source.py | same file |
| web_file_url | git_source.py | same file |
codeintel.git_sourcebackend/app/codeintel/git_source.py, lines 1–40Open source
"""Safe access to repository content via the ``git`` CLI.Design points (each closes a concrete hole in the previous pipeline):* **Content comes from git objects, never the working tree.** Remote repositories are cloned ``--bare``, and files are read with ``git cat-file`` at a pinned commit. A malicious repository therefore cannot use symlinks to make the indexer read files outside the clone (symlinks have mode 120000 and are skipped; submodules, 160000, too).* **Only tracked files at one commit are indexed**, which gives ``.gitignore`` semantics for free and makes indexing reproducible.* **Remote URLs are validated**: https only, an allowlist of hosts, no credentials / ports / IP literals in the URL, and HTTP redirects are not followed, so the API cannot be turned into an SSRF probe of internal hosts.* **Private-repo tokens never appear in argv, URLs or logs**: they are passed as a host-scoped ``http.extraHeader`` through ``GIT_CONFIG_*`` environment variables.* Every git invocation has a timeout and never prompts for credentials."""from __future__ import annotationsimport base64import ipaddressimport loggingimport osimport reimport shutilimport subprocessimport tempfilefrom collections.abc import Iteratorfrom dataclasses import dataclassfrom pathlib import Pathfrom urllib.parse import urlsplitlogger = logging.getLogger(__name__)_SEGMENT_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$")_SHA_RE = re.compile(r"^[0-9a-f]{40}([0-9a-f]{24})?$")Shows the first 40 of 465 lines. The rest is on GitHub at this commit.
What the index recorded
- Signature
module backend.app.codeintel.git_source- File
backend/app/codeintel/git_source.py- Lines
- 1–465
- Parser
- python-ast
- Git blob
6f88470169e4935929c5f865a974bd86da564c1a- Call sites
- 3 named, 0 resolved, 3 left unlinked
- Outside this subset
- 12 more edges reach code outside the graph shown here
