From 299c061f261cecedeb6227a1f87d9562fc261e45 Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Tue, 11 Aug 2026 11:48:32 +0200 Subject: [PATCH] fix(security): mask forge tokens in logs and disk Close two token-leak paths in the git mirror and harden the supply chain per the OWASP audit (audit/2026-08-11/security-report.md). Runtime fixes: - mirror GitError masks the embedded oauth2: in both the failing command line and git's stderr before raising; cli now catches GitError with a clean message instead of an uncaught traceback that printed the live token. - Scrub token-bearing remote URLs from the bare config at the end of each run so tokens aren't persisted in .git/config. - Default mirror workdir is per-user 0700 (/tmp/cb2gitea-), not a world-readable /tmp/cb2gitea. Supply chain: - Commit uv.lock; CI installs via uv sync --frozen (hash-verified). - Pin Gitea Actions to commit SHAs, not mutable @vN tags. - Pin the ruff rule set and exclude audit/ for reproducible linting. Adds tests/test_mirror.py for the redaction helpers. --- .gitea/workflows/ci.yml | 15 +- CHANGELOG.md | 5 + audit/2026-08-11/security-report.md | 262 ++++++++++++++++++++++ pyproject.toml | 6 + src/codeberg_to_gitea_migrator/AGENTS.md | 4 +- src/codeberg_to_gitea_migrator/cli.py | 4 + src/codeberg_to_gitea_migrator/migrate.py | 3 +- src/codeberg_to_gitea_migrator/mirror.py | 56 ++++- tests/test_mirror.py | 32 +++ uv.lock | 257 +++++++++++++++++++++ 10 files changed, 633 insertions(+), 11 deletions(-) create mode 100644 audit/2026-08-11/security-report.md create mode 100644 tests/test_mirror.py create mode 100644 uv.lock diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 4b403d1..90d03f6 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -9,11 +9,14 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + # Pinned to commit SHAs (not mutable tags) to guard against tag-swap supply-chain attacks. + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 with: python-version: "3.11" - - run: python -m pip install -e ".[dev]" - - run: ruff check . - - run: ruff format --check . - - run: pytest + # Install deps from the committed, hash-verified uv.lock (reproducible builds). + - run: python -m pip install uv + - run: uv sync --frozen --extra dev + - run: uv run ruff check . + - run: uv run ruff format --check . + - run: uv run pytest diff --git a/CHANGELOG.md b/CHANGELOG.md index 67ac7fa..ef0f96d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format ## [Unreleased] +### security + +- **migrator:** keep forge API tokens out of error text and on-disk git config. Git failures now surface a redacted `oauth2:***@` URL instead of the live token, and the CLI catches `GitError` with a clean message instead of dumping a traceback. The mirror's remote URLs are scrubbed to bare form after each run (no token persisted in `.git/config`), and the default workdir is per-user `0700` (`/tmp/cb2gitea-`) so it isn't world-readable on shared hosts. +- **deps:** reproducible, hash-verified installs — commit `uv.lock` and install from it in CI (`uv sync --frozen`); pin Gitea Actions to commit SHAs instead of mutable `@vN` tags; pin the ruff rule set explicitly (`select = ["E4","E7","E9","F"]`) and exclude `audit/`. + ### feat - **migrator:** working Codeberg → Gitea migration via `codeberg-to-gitea migrate`. Mirrors git (code, history, tags, LFS) and replays labels, milestones, issues & PRs (with comments), and releases (with assets) entity-by-entity over the shared Forgejo/Gitea REST API. Two-pass issue/PR creation with `#NNN`/URL cross-reference rewriting to the target's number space; deleted-branch PR heads recreated as `refs/heads/_pr/`. Tokens via `CODEBERG_TOKEN`/`GITEA_TOKEN`; `--repo owner/name` (or bare name). `--delete-existing` for clean re-runs. diff --git a/audit/2026-08-11/security-report.md b/audit/2026-08-11/security-report.md new file mode 100644 index 0000000..3ffd758 --- /dev/null +++ b/audit/2026-08-11/security-report.md @@ -0,0 +1,262 @@ +# Security Audit Report + +**Project:** codeberg-to-gitea-migrator +**Date:** 2026-08-11 +**Auditor:** Claude — security-scanner skill +**Framework:** OWASP Top 10:2025 +**Scope:** `src/codeberg_to_gitea_migrator/` (all 7 modules), `tests/`, `pyproject.toml`, `.gitea/workflows/ci.yml` +**Technology Stack:** Python 3.11 CLI tool — `httpx>=0.27` (REST client), `typer>=0.12` (CLI), `subprocess` git calls (mirror/LFS). Bearer-token API auth. No DB, no web framework, no network listener. + +--- + +## Executive Summary + +This is a **local one-shot CLI** run by a trusted operator to migrate one repo from Codeberg to a self-hosted Gitea. That shapes the whole posture: there is **no unauthenticated remote attack surface** — no HTTP listener, no multi-tenant input, no database. The classic OWASP web categories (SQLi, XSS, CSRF, IDOR, broken session auth) mostly **do not apply**, and the code is clean where they could (subprocess uses argv lists with no shell; no `eval`/`exec`/`pickle`/`yaml.load`; API calls use header auth, not URL auth). + +Where this codebase does carry real risk is **credential hygiene for the two forge API tokens** (Codeberg + Gitea). The git-mirror path injects the raw token into HTTPS git URLs (`oauth2:@host`), and three things follow from that: + +1. On any git failure the token lands in the raised `GitError` message, which is **never caught** → an uncaught traceback prints the live token to stderr/CI logs/wherever the operator pastes the error. This is the single most important fix. +2. The authed URL is written into the bare mirror clone's `.git/config` on disk (in a tempdir that is shared/world-readable on Linux), persisting both tokens in plaintext after the run. +3. Tokens are also accepted as plain CLI flags, exposing them in the process list and shell history (the env-var path is already the documented default, so this is defense-in-depth). + +Supply-chain posture is typical for a small Python CLI: version ranges instead of a lock file, no hash pinning, and CI actions pinned to mutable `@vN` tags rather than commit SHAs. + +No actively-exploitable remote vulnerability was found. The findings are credential-leak and supply-chain-integrity hardening. + +**Overall Risk Score:** 17 (**Moderate** Risk) + +| Severity | Count | +|----------|-------| +| Critical | 0 | +| High | 1 | +| Medium | 1 | +| Low | 3 | +| Info | 1 | +| **Total**| **6** | + +--- + +## Findings + +### A01:2025 — Broken Access Control + +No issues identified. Checked: there is no HTTP listener, no route/handler authorization surface, no session management, and no database. `owner`/`name` from the CLI flow only into authenticated API path segments (`/repos/{owner}/{name}`) and git HTTPS URLs — never into a shell or a query — and the caller is the trusted operator. No IDOR/CSRF/force-browsing patterns apply to a local CLI. (See A06 for a minor input-validation observation on `owner`/`name`.) + +--- + +### A02:2025 — Security Misconfiguration + +#### MEDIUM — Forge tokens persisted in plaintext in the mirror clone's git config + +- **File:** `src/codeberg_to_gitea_migrator/mirror.py` +- **Line(s):** 104–112 (`_ensure_remote`), 130–131, 135, 138, 149, 172 +- **CWE:** CWE-312: Cleartext Storage of Sensitive Information; CWE-522: Insufficiently Protected Credentials +- **Reachability:** Local-only +- **Description:** The git-mirror path authenticates by embedding the raw token in the remote URL (`oauth2:@host`). Every git subcommand that registers a remote persists that URL verbatim into the bare clone's `.git/config`: `clone --mirror`, `remote set-url origin`, and `remote add target`. The mirror is left on disk by design ("useful for inspection / re-push"). The default workdir is `tempfile.gettempdir() / "cb2gitea"` (`migrate.py:148`) — on Linux that is `/tmp`, world-readable, so any local user can `cat .../cb2gitea/.git/config` and read both forge tokens after a run. +- **Evidence:** + ```python + # mirror.py + def _authed(url, token): + ... + userinfo = f"oauth2:{quote(token, safe='')}" + return urlunsplit(parts._replace(netloc=f"{userinfo}@{parts.netloc}")) + ... + src = _authed(source_url, source_token) # token embedded in URL + tgt = _authed(target_url, target_token) + ... + _run(["git", "--git-dir", str(bare), "remote", "set-url", "origin", src]) # → .git/config + _run(["git", "clone", "--mirror", src, str(bare)]) # → .git/config + _ensure_remote(bare, "target", tgt) # → .git/config + ``` +- **Recommendation:** Keep tokens out of stored URLs. Use git's credential helper / `-c` config that is not persisted, scrub the config after the run, or at minimum write the workdir to a per-user 0700 directory. Minimal fix — redact on cleanup and lock the workdir: + ```python + # migrate.py — private workdir + workdir = workdir or Path(tempfile.gettempdir()) / f"cb2gitea-{os.getuid()}" + workdir.mkdir(parents=True, exist_ok=True) + workdir.chmod(0o700) + + # mirror.py — don't persist token-bearing URLs: pass creds via -c http.https..extraHeader + # and rewrite config remote URLs to their bare (unauthed) form before leaving them on disk. + ``` + +--- + +### A03:2025 — Software Supply Chain Failures + +#### LOW — Dependencies are not lock-filed or hash-pinned + +- **File:** `pyproject.toml` +- **Line(s):** 15 (`dependencies = ["httpx>=0.27", "typer>=0.12"]`); `.gitea/workflows/ci.yml:16` (`python -m pip install -e ".[dev]"`) +- **CWE:** CWE-494: Download of Code Without Integrity Check +- **Reachability:** Local-only / build-time +- **Description:** Versions are lower-bound ranges (`>=`), there is no lock file (`uv.lock` / `poetry.lock` / pinned `requirements.txt` — none present), and CI installs without `--require-hashes`. Builds are non-reproducible and a compromised PyPI mirror or dependency could slip a malicious artifact into an install. Low impact for a local CLI, but it is the project's only integrity gap on the install side. +- **Evidence:** + ```toml + # pyproject.toml + dependencies = ["httpx>=0.27", "typer>=0.12"] + ``` +- **Recommendation:** Generate and commit a lock file (`uv lock` or `pip freeze > requirements.txt` with hashes) and install from it in CI with `--require-hashes`. Pin to exact versions for reproducibility. + +--- + +### A04:2025 — Cryptographic Failures + +No issues identified. Checked: the app performs no cryptography itself. TLS is delegated to `httpx`, which defaults to certificate verification on (`clients.py:45` constructs `httpx.Client(...)` with no `verify=False`). No hardcoded keys, no password hashing (N/A — bearer tokens only), no weak RNG used for security purposes, no MD5/SHA1, no base64-as-encryption. (The token-in-URL pattern noted under A02 is a *storage/logging* problem, not a crypto-strength problem — the URL still travels over TLS.) + +--- + +### A05:2025 — Injection + +No issues identified. Checked: **command injection is correctly avoided** — all git calls use argv lists with `shell` unset, explicitly annotated `# noqa: S603 - argv list, no shell` (`mirror.py:34, 43, 98, 106`). No SQL (no DB). No `eval`/`exec`/`compile`, no `os.system`/`os.popen`, no `pickle`/`yaml.load`, no template rendering, no HTML output (no XSS surface). Issue/PR bodies are rewritten with bounded regex (`refs.py`) and POSTed as JSON values to the Gitea API — any rendering is the server's responsibility. (`follow_redirects=True` on the `ApiClient` and operator-supplied forge URLs were reviewed; no exploitable SSRF under this tool's local-operator trust model — the operator points the tool only at forges they themselves chose.) + +--- + +### A06:2025 — Insecure Design + +#### INFO — No validation of `owner` / `name` path segments + +- **File:** `src/codeberg_to_gitea_migrator/cli.py` +- **Line(s):** 94–104 (`_parse_repo`); consumed by `migrate.py` and `mirror.py:_git_url` +- **CWE:** CWE-20: Improper Input Validation (observation, not exploitable here) +- **Reachability:** Local-only (operator-supplied) +- **Description:** `_parse_repo` splits on the first `/` with no charset validation; `owner`/`name` then interpolate into API paths and a git URL. Because they are never passed to a shell and the target is the operator's own authenticated forge, this is **not exploitable** — an odd value just yields a 404. Noting it only as defense-in-depth: a future change that reused these values in a shell or filesystem path would inherit no validation. +- **Evidence:** + ```python + # cli.py + def _parse_repo(repo, source_url, source_token): + if "/" in repo: + owner, name = repo.split("/", 1) # no charset / length / shape check + return owner, name + ``` +- **Recommendation:** Optional — validate `owner`/`name` against `^[A-Za-z0-9._-]+$` before use, so the invariant is enforced at the boundary rather than relied upon by every downstream caller. + +--- + +### A07:2025 — Authentication Failures + +#### LOW — API tokens accepted as plaintext CLI flags + +- **File:** `src/codeberg_to_gitea_migrator/cli.py` +- **Line(s):** 37–42 +- **CWE:** CWE-214: Invocation of Process Using Visible Sensitive Data from Command Line; CWE-522: Insufficiently Protected Credentials +- **Reachability:** Local-only +- **Description:** `--source-token` / `--target-token` expose the forge tokens in the process list (`ps`/Activity Monitor), shell history, and any wrapper script args. The safer env-var path (`CODEBERG_TOKEN` / `GITEA_TOKEN`) is already supported and is the documented default, so this is defense-in-depth — but the flag remains the easy footgun. +- **Evidence:** + ```python + source_token: str = typer.Option("", "--source-token", envvar="CODEBERG_TOKEN", ...) + target_token: str = typer.Option("", "--target-token", envvar="GITEA_TOKEN", ...) + ``` +- **Recommendation:** Prefer the env vars. If the flags must stay, document the exposure prominently and consider hiding the value (`typer.Option(..., show_default=False)`) — though Typer/Click still receive it in argv. Simplest durable fix: keep env-var-only and drop the flags. + +--- + +### A08:2025 — Software or Data Integrity Failures + +#### LOW — CI workflow actions pinned to mutable version tags + +- **File:** `.gitea/workflows/ci.yml` +- **Line(s):** 12–13 +- **CWE:** CWE-345: Insufficient Verification of Data Authenticity; CWE-494: Download of Code Without Integrity Check +- **Reachability:** Build-time (CI) +- **Description:** `actions/checkout@v4` and `actions/setup-python@v5` pin to moving major-version tags, not immutable commit SHAs. If either tag were ever moved to a malicious commit (the classic actions supply-chain attack), this CI would run it. Low likelihood, standard hardening gap. +- **Evidence:** + ```yaml + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + ``` +- **Recommendation:** Pin to full commit SHAs, e.g. `actions/checkout@`. Automate with Dependabot/Renovate so updates are deliberate PRs. + +No deserialization integrity issues: the app only `json()`-parses responses from authenticated forge APIs (no `pickle`/`marshal`/`yaml.load`/`readObject`). + +--- + +### A09:2025 — Security Logging and Alerting Failures + +#### HIGH — Live forge token leaked in uncaught `GitError` traceback + +- **File:** `src/codeberg_to_gitea_migrator/mirror.py` +- **Line(s):** 33–48 (`_run`/`_run_capture` raise at 38 and 47); unhandled in `cli.py:66–84` +- **CWE:** CWE-532: Insertion of Sensitive Information into Log File; CWE-209: Generation of Error Message Containing Sensitive Information +- **Reachability:** Local-only to trigger, but the leak propagates wherever the operator sends the error (bug reports, chat, CI logs) +- **Description:** The git-mirror path authenticates via an `oauth2:@host` URL (`mirror.py:29`). On **any** non-zero git exit, `_run`/`_run_capture` build the exception as `f"git failed (...): {' '.join(cmd)}\n{stderr}"` — and `cmd` contains the authed URL, so the **live source and/or target token is embedded in the exception text**. `GitError` is a `RuntimeError` that is **never caught** (`cli.migrate` handles only `MigrationError` and `ApiError`), so a failed clone/fetch/push surfaces as a raw Python traceback on stderr with the token in cleartext. Realistic outcome: the operator pastes the traceback into a Gitea/Codeberg issue or a chat, or it lands in a CI log visible to collaborators — and a forge token (broad repo read/write/delete scope) is disclosed. By the pure OWASP rubric "exposed credentials" trends Critical; rated High here because exploitation is gated on the operator propagating the message, not on a remote attacker. Either way it is the #1 fix. +- **Evidence:** + ```python + # mirror.py — token is in `cmd` + def _run(cmd, cwd=None): + proc = subprocess.run(cmd, cwd=cwd, capture_output=True, text=True) + if proc.returncode != 0: + raise GitError(f"git failed ({proc.returncode}): {' '.join(cmd)}\n{proc.stderr.strip()}") + # ^^^ cmd includes "https://oauth2:@host/..." + + # cli.py — GitError is not in the caught types, so it escapes as a traceback + try: + report = migrate_repo(...) + except MigrationError as exc: ... + except ApiError as exc: ... # GitError falls through → uncaught traceback on stderr + ``` + Compounding factor: git itself echoes the failing remote URL in `stderr` on clone/push failure, so `proc.stderr.strip()` is a second copy of the token in the same message. +- **Recommendation:** (a) never put the secret in `cmd` text — pass credentials via a non-persisted `-c http..extraHeader="Authorization: token "` or an env-passed credential helper, so the URL and the command line stay clean; (b) redact known-secret URLs from any error surfaced to the user; (c) catch `GitError` in `cli.migrate` and emit a clean message. Minimal patch for the exception text: + ```python + # mirror.py + import re + _SECRET = re.compile(r"(oauth2:)[^@]+(@)") + + def _redact(s: str) -> str: + return _SECRET.sub(r"\1***\2", s) + + def _run(cmd, cwd=None): + proc = subprocess.run(cmd, cwd=cwd, capture_output=True, text=True) + if proc.returncode != 0: + shown = [_redarg(a) for a in cmd] # _redarg applies _redact to URL-shaped args + raise GitError(f"git failed ({proc.returncode}): {' '.join(shown)}\n{_redact(proc.stderr.strip())}") + ``` + And in `cli.py` add `except GitError as exc: typer.echo(f"git error: {exc}", err=True); raise typer.Exit(1)`. + +--- + +### A10:2025 — Mishandling of Exceptional Conditions + +Cross-reference — the same `GitError`-escapes-uncaught defect described under **A09** is also an A10 instance of CWE-209 (sensitive info in an error message) and CWE-755 (improper handling of an exceptional condition: a known, expected failure mode — git failing — has no handler and surfaces internals). Scored once under A09; listed here so the A10 category reflects it. No other A10 issues: there are no empty/swallowing `except` blocks (the one broad-ish catch in `issues.py:_merge_pr:135` is intentional best-effort with a debug log), error paths fail **closed** (an invalid token → 401 → `ApiError` → exit 1), and `ApiClient` resources are released via context managers. + +--- + +## Risk Score Breakdown + +Scoring: Critical = 10, High = 7, Medium = 4, Low = 2, Info = 0. + +| Category | Critical | High | Medium | Low | Info | Points | +|----------|----------|------|--------|-----|------|--------| +| A01 — Broken Access Control | 0 | 0 | 0 | 0 | 0 | 0 | +| A02 — Security Misconfiguration | 0 | 0 | 1 | 0 | 0 | 4 | +| A03 — Supply Chain Failures | 0 | 0 | 0 | 1 | 0 | 2 | +| A04 — Cryptographic Failures | 0 | 0 | 0 | 0 | 0 | 0 | +| A05 — Injection | 0 | 0 | 0 | 0 | 0 | 0 | +| A06 — Insecure Design | 0 | 0 | 0 | 0 | 1 | 0 | +| A07 — Authentication Failures | 0 | 0 | 0 | 1 | 0 | 2 | +| A08 — Data Integrity Failures | 0 | 0 | 0 | 1 | 0 | 2 | +| A09 — Logging & Alerting Failures | 0 | 1 | 0 | 0 | 0 | 7 | +| A10 — Exceptional Conditions | 0 | 0 | 0 | 0 | 0 | 0 | +| **Total** | **0** | **1** | **1** | **3** | **1** | **17** | + +**Risk Rating:** 17 → **Moderate** (0–10 Low | 11–30 Moderate | 31–60 High | 61+ Critical) + +--- + +## Remediation Priority + +Ordered by exploitability × impact, not by severity label. + +1. **(A09, High) Stop putting forge tokens in git command lines / error text.** Highest impact: a leaked token grants full repo read/write/delete on the forge account. Move auth to a non-persisted `git -c http..extraHeader=...` (or a credential helper), redact `oauth2:` URLs from any surfaced error, and add an explicit `except GitError` in `cli.migrate`. One defect, three lines of root cause. +2. **(A02, Medium) Stop persisting tokens in the mirror clone's `.git/config`.** Same root cause as #1 (token in URL). Either rewrite stored remote URLs to their bare form after the run, or write the workdir to a `0700` per-user directory so the plaintext config isn't world-readable on `/tmp`. +3. **(A08/A03, Low) Pin CI actions to commit SHAs and add a locked, hash-pinned dependency file.** Standard supply-chain hardening; closes the only integrity gaps on the build/install side. +4. **(A07, Low) Deprecate the `--source-token` / `--target-token` CLI flags** in favor of the already-supported env vars, to remove process-list/history exposure. + +--- + +## Methodology + +Static analysis against OWASP Top 10:2025. Each category was evaluated using the security-scanner reference patterns (pattern detection via grep/AST, localized 5–10 line reads for confirmation), dependency-manifest and CI inspection, and configuration review. The intended specialist-agent-per-category fan-out was unavailable in this environment (`runs.all` not supported), so a single auditor with full read of the codebase (all 7 source modules, ~700 LOC) applied each category's reference directly; findings were then confirmed with targeted greps (`GitError`/catch sites, secret handling, dangerous-call scan, lock-file presence). Analysis covered `src/codeberg_to_gitea_migrator/`, `tests/`, `pyproject.toml`, and `.gitea/workflows/ci.yml`. + +**Trust model note:** the project is a local CLI run by a trusted operator with no network listener. Severity was calibrated to reachability throughout — there is no remote-unauthenticated attack surface, so most findings are credential-hygiene and supply-chain-integrity rather than remotely exploitable vulns. + +**Limitations:** Static analysis only — no dynamic/runtime testing, no dependency CVE database scan (run `pip-audit` / `osv-scanner` against a resolved lock file for live CVE coverage), no network-level analysis. Dependency versions were assessed for pinning posture, not for current known CVEs. diff --git a/pyproject.toml b/pyproject.toml index 381484a..09d77d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,12 @@ packages = ["src/codeberg_to_gitea_migrator"] [tool.ruff] line-length = 100 target-version = "py311" +extend-exclude = ["audit"] # generated reports, not source + +[tool.ruff.lint] +# Explicit rule set so locked-deps CI lints reproducibly (ruff's defaults drift +# across versions). Stable core: subset of pycodestyle + pyflakes. +select = ["E4", "E7", "E9", "F"] [tool.pytest.ini_options] testpaths = ["tests"] diff --git a/src/codeberg_to_gitea_migrator/AGENTS.md b/src/codeberg_to_gitea_migrator/AGENTS.md index 3b7682f..24ea745 100644 --- a/src/codeberg_to_gitea_migrator/AGENTS.md +++ b/src/codeberg_to_gitea_migrator/AGENTS.md @@ -24,7 +24,7 @@ Console script: `codeberg-to-gitea`. ## Module map - `clients.py` — `ApiClient`: bearer auth, transparent pagination (`page`/`limit`), retry on 429/5xx, `get/post/patch/delete`, `raw_get` (binary), `post_multipart` (asset upload). -- `mirror.py` — `git clone --mirror` + `push --mirror`; captures `refs/pull//head` SHAs and recreates them as target branches `refs/heads/_pr/` (so deleted-branch PRs survive), prunes Forgejo-internal `refs/pull/*` before push, mirrors LFS objects. +- `mirror.py` — `git clone --mirror` + `push --mirror`; captures `refs/pull//head` SHAs and recreates them as target branches `refs/heads/_pr/` (so deleted-branch PRs survive), prunes Forgejo-internal `refs/pull/*` before push, mirrors LFS objects. Tokens are masked in any `GitError` and scrubbed from the on-disk remote config after each run; the mirror workdir is per-user `0700`. - `refs.py` — `NumberMap` + `rewrite`: rewrites `#NNN` refs and source issue/PR URLs to the target's fresh number space (source numbers are sparse after deletions). - `issues.py` — labels, milestones, issues + PRs + comments. Two-pass: create in source-number order (build number map), then rewrite title/body refs + stream comments. PR head falls back to `_pr/` when the source branch is gone. - `releases.py` — non-draft releases + asset re-upload. Treats a 404 releases endpoint (feature disabled) as "none". @@ -39,12 +39,14 @@ Console script: `codeberg-to-gitea`. - Fidelity is intentionally bounded: the public Gitea API stamps issue/PR/comment author (→ migration token user) and timestamps server-side; assignees and reactions are not migrated. Cross-references ARE rewritten to stay correct. - Repo creation needs the target token to have `write:user` scope; otherwise create the empty repo by hand first (the migrator then populates a fresh target). - Migration is intentionally one-shot per repo (cutover model): populate a fresh target once, then freeze the source. There is no incremental/delta sync; re-running on a populated target refuses unless `--delete-existing`, which wipes and redoes everything with fresh numbers. Incremental `--update` was considered and deliberately not built. +- Forge API tokens are secrets: the mirror path never lets them reach logs, exceptions, or the persisted `/tmp/cb2gitea-/.git/config`. Don't reintroduce bare tokens into error messages or stored URLs. ## Verification - `pytest` (testpaths = `tests`) — refs rewriting, number map, client pagination (mock transport, no network). - `ruff check .` and `ruff format --check .`. - End-to-end: `CODEBERG_TOKEN=… GITEA_TOKEN=… codeberg-to-gitea migrate owner/name`. +- CI installs from the committed, hash-verified `uv.lock` (`uv sync --frozen --extra dev`) with Gitea Actions pinned to commit SHAs; run `uv lock` then `uv lock --check` when changing dependencies. ## Child DOX Index diff --git a/src/codeberg_to_gitea_migrator/cli.py b/src/codeberg_to_gitea_migrator/cli.py index 466dca8..619b0e2 100644 --- a/src/codeberg_to_gitea_migrator/cli.py +++ b/src/codeberg_to_gitea_migrator/cli.py @@ -18,6 +18,7 @@ import typer from . import __version__ from .clients import ApiClient, ApiError from .migrate import DEFAULT_SOURCE, DEFAULT_TARGET, MigrationError, migrate_repo +from .mirror import GitError app = typer.Typer( name="codeberg-to-gitea", @@ -81,6 +82,9 @@ def migrate( except ApiError as exc: typer.echo(f"API error: {exc}", err=True) raise typer.Exit(1) from exc + except GitError as exc: + typer.echo(f"git error: {exc}", err=True) + raise typer.Exit(1) from exc typer.echo(f"✓ migrated {owner}/{name}: {report}") diff --git a/src/codeberg_to_gitea_migrator/migrate.py b/src/codeberg_to_gitea_migrator/migrate.py index 08ad367..01a6552 100644 --- a/src/codeberg_to_gitea_migrator/migrate.py +++ b/src/codeberg_to_gitea_migrator/migrate.py @@ -9,6 +9,7 @@ to the target's fresh number space. from __future__ import annotations import logging +import os import tempfile from pathlib import Path @@ -145,7 +146,7 @@ def migrate_repo( ) if not skip_git: - workdir = workdir or Path(tempfile.gettempdir()) / "cb2gitea" + workdir = workdir or Path(tempfile.gettempdir()) / f"cb2gitea-{os.getuid()}" git_report = mirror_repo( source_url=_git_url(src.web_root, owner, name), target_url=_git_url(tgt.web_root, owner, name), diff --git a/src/codeberg_to_gitea_migrator/mirror.py b/src/codeberg_to_gitea_migrator/mirror.py index 7ad7b7c..3728694 100644 --- a/src/codeberg_to_gitea_migrator/mirror.py +++ b/src/codeberg_to_gitea_migrator/mirror.py @@ -9,6 +9,7 @@ repo. from __future__ import annotations +import re import shutil import subprocess from pathlib import Path @@ -30,12 +31,51 @@ def _authed(url: str, token: str) -> str: return urlunsplit(parts._replace(netloc=f"{userinfo}@{parts.netloc}")) +_TOKEN_RE = re.compile(r"(oauth2:)[^@]+(@)") + + +def _redact(text: str) -> str: + """Mask any embedded ``oauth2:`` so secrets never reach logs/exceptions.""" + return _TOKEN_RE.sub(r"\1***\2", text) + + +def _bare(url: str) -> str: + """Strip an ``oauth2:@`` userinfo, returning the bare URL.""" + return _TOKEN_RE.sub("", url) + + +def _scrub_remote_tokens(bare: Path) -> None: + """Rewrite token-bearing remote URLs in the bare config to bare form. + + The mirror is left on disk for inspection / re-push; strip the embedded + ``oauth2:`` so it isn't persisted in plaintext in ``.git/config``. + A re-run re-injects auth via :func:`_authed`, so scrubbing is safe. Best-effort. + """ + listing = subprocess.run( # noqa: S603 - argv list, no shell + ["git", "--git-dir", str(bare), "remote", "-v"], capture_output=True, text=True + ) + for line in listing.stdout.splitlines(): + parts = line.split("\t") + if len(parts) < 2: + continue + name = parts[0] + url = parts[1].split(" ")[0] + if "oauth2:" in url: + subprocess.run( # noqa: S603 - argv list, no shell + ["git", "--git-dir", str(bare), "remote", "set-url", name, _bare(url)], + capture_output=True, + ) + + def _run(cmd: list[str], cwd: Path | None = None) -> None: proc = subprocess.run( # noqa: S603 - argv list, no shell cmd, cwd=cwd, capture_output=True, text=True ) if proc.returncode != 0: - raise GitError(f"git failed ({proc.returncode}): {' '.join(cmd)}\n{proc.stderr.strip()}") + raise GitError( + f"git failed ({proc.returncode}): {' '.join(_redact(a) for a in cmd)}" + f"\n{_redact(proc.stderr.strip())}" + ) def _run_capture(cmd: list[str], cwd: Path | None = None) -> str: @@ -44,7 +84,10 @@ def _run_capture(cmd: list[str], cwd: Path | None = None) -> str: cmd, cwd=cwd, capture_output=True, text=True ) if proc.returncode != 0: - raise GitError(f"git failed ({proc.returncode}): {' '.join(cmd)}\n{proc.stderr.strip()}") + raise GitError( + f"git failed ({proc.returncode}): {' '.join(_redact(a) for a in cmd)}" + f"\n{_redact(proc.stderr.strip())}" + ) return proc.stdout @@ -125,6 +168,10 @@ def mirror_repo( clone is left there (useful for inspection / re-push). """ workdir.mkdir(parents=True, exist_ok=True) + try: + workdir.chmod(0o700) # private even on a shared /tmp + except OSError: + pass bare = workdir / (Path(source_url).name.removesuffix(".git") + ".git") src = _authed(source_url, source_token) @@ -173,11 +220,14 @@ def mirror_repo( _run(["git", "--git-dir", str(bare), "lfs", "push", "--all", "target"]) lfs_pushed = True + _scrub_remote_tokens(bare) return {"bare": str(bare), "lfs_pushed": lfs_pushed, "pr_head_branches": len(pull_heads)} -if __name__ == "__main__": # self-check — URL auth only, no network +if __name__ == "__main__": # self-check — URL auth + redaction, no network url = _authed("https://codeberg.org/AlexKucera/helm.git", "t ok@en") assert url == "https://oauth2:t%20ok%40en@codeberg.org/AlexKucera/helm.git", url assert _authed("https://x/o.git", "") == "https://x/o.git" + assert _redact(url) == "https://oauth2:***@codeberg.org/AlexKucera/helm.git", _redact(url) + assert _bare(url) == "https://codeberg.org/AlexKucera/helm.git", _bare(url) print("mirror self-check ok:", url) diff --git a/tests/test_mirror.py b/tests/test_mirror.py new file mode 100644 index 0000000..49b2e5b --- /dev/null +++ b/tests/test_mirror.py @@ -0,0 +1,32 @@ +"""Redaction helpers keep forge tokens out of error text and stored git config. + +Pure-function checks (no network): ``_authed`` embeds the token in the URL, +``_redact`` masks it for logs/exceptions, and ``_bare`` strips it for the +on-disk remote config scrub. +""" + +from codeberg_to_gitea_migrator.mirror import _authed, _bare, _redact + + +def test_redact_masks_token_keeps_url_shape(): + url = _authed("https://codeberg.org/o/r.git", "s3cr3t") + assert "s3cr3t" not in _redact(url) + assert _redact(url) == "https://oauth2:***@codeberg.org/o/r.git" + + +def test_bare_strips_userinfo_entirely(): + url = _authed("https://codeberg.org/o/r.git", "s3cr3t") + assert _bare(url) == "https://codeberg.org/o/r.git" + + +def test_handles_percent_encoded_token_chars(): + # A token with a space and '@' is percent-encoded by _authed; both helpers + # must still match the encoded form up to the literal '@' delimiter. + url = _authed("https://codeberg.org/o/r.git", "a b@c") + assert "a%20b%40c" not in _redact(url) + assert _bare(url) == "https://codeberg.org/o/r.git" + + +def test_no_token_untouched(): + assert _redact("https://codeberg.org/o/r.git") == "https://codeberg.org/o/r.git" + assert _bare("https://codeberg.org/o/r.git") == "https://codeberg.org/o/r.git" diff --git a/uv.lock b/uv.lock new file mode 100644 index 0000000..4f3e25b --- /dev/null +++ b/uv.lock @@ -0,0 +1,257 @@ +version = 1 +revision = 1 +requires-python = ">=3.11" + +[[package]] +name = "annotated-doc" +version = "0.0.5" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/5a/8e/38aa427ed5402449e226975b649c5dc73ccadfefeb95e6aecb8f8ea4b6b6/annotated_doc-0.0.5.tar.gz", hash = "sha256:c7e58ce09192557605d8bbd92836d7e1d520ac9580096042c0bfd197efacf1bb", size = 10758 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/3e/30/e900b21425a860e195f32e37657aa1f7c7f2b1bfb26f03ca209b90933c06/annotated_doc-0.0.5-py3-none-any.whl", hash = "sha256:117bac03a25ede5df5440e855b32d556049ca169ead221505badf432fed4b101", size = 5302 }, +] + +[[package]] +name = "anyio" +version = "4.14.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "idna" }, + { name = "typing-extensions", marker = "python_full_version < '3.13'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/61/cc/a381afa6efea9f496eff839d4a6a1aed3bfafc7b3ab4b0d1b243a12573dd/anyio-4.14.2.tar.gz", hash = "sha256:cfa139f3ed1a23ee8f88a145ddb5ac7605b8bbfd8592baacd7ce3d8bb4313c7f", size = 260176 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/da/35/f2287558c17e29fafc8ef3daf819bb9834061cfa43bff8014f7df7f63bdc/anyio-4.14.2-py3-none-any.whl", hash = "sha256:9f505dda5ac9f0c8309b5e8bd445a8c2bf7246f3ce950121e45ea15bc41d1494", size = 125813 }, +] + +[[package]] +name = "certifi" +version = "2026.7.22" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/a3/c2/24167ea9858356b47a87a50d39908bfdb72ceeefe0041586e704e5376b3a/certifi-2026.7.22.tar.gz", hash = "sha256:741e2c3b351ddf169a738da9f2c048608ff7f2c5cc02f1ebc6b118bb090d5d55", size = 138112 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0b/a7/71ac2cff56fec219ed242bb11b8efb69fcc4bec75db06fb7bfe35de520e6/certifi-2026.7.22-py3-none-any.whl", hash = "sha256:62f22742b58a1a33014a2b6b706588a8d7e2a88ae7bd1a6ebe8c992928483775", size = 136983 }, +] + +[[package]] +name = "codeberg-to-gitea-migrator" +version = "0.1.0" +source = { editable = "." } +dependencies = [ + { name = "httpx" }, + { name = "typer" }, +] + +[package.optional-dependencies] +dev = [ + { name = "pytest" }, + { name = "ruff" }, +] + +[package.metadata] +requires-dist = [ + { name = "httpx", specifier = ">=0.27" }, + { name = "pytest", marker = "extra == 'dev'" }, + { name = "ruff", marker = "extra == 'dev'" }, + { name = "typer", specifier = ">=0.12" }, +] +provides-extras = ["dev"] + +[[package]] +name = "colorama" +version = "0.4.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335 }, +] + +[[package]] +name = "h11" +version = "0.16.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/01/ee/02a2c011bdab74c6fb3c75474d40b3052059d95df7e73351460c8588d963/h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1", size = 101250 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515 }, +] + +[[package]] +name = "httpcore" +version = "1.0.9" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "certifi" }, + { name = "h11" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/06/94/82699a10bca87a5556c9c59b5963f2d039dbd239f25bc2a63907a05a14cb/httpcore-1.0.9.tar.gz", hash = "sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8", size = 85484 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/7e/f5/f66802a942d491edb555dd61e3a9961140fd64c90bce1eafd741609d334d/httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55", size = 78784 }, +] + +[[package]] +name = "httpx" +version = "0.28.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "anyio" }, + { name = "certifi" }, + { name = "httpcore" }, + { name = "idna" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b1/df/48c586a5fe32a0f01324ee087459e112ebb7224f646c0b5023f5e79e9956/httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc", size = 141406 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", size = 73517 }, +] + +[[package]] +name = "idna" +version = "3.18" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/cd/63/9496c57188a2ee585e0f1db071d75089a11e98aa86eb99d9d7618fc1edce/idna-3.18.tar.gz", hash = "sha256:ffb385a7e039654cef1ab9ef32c6fafe283c0c0467bba1d9029738ce4a14a848", size = 196711 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/1e/5e/d4e9f1a599fb8e573b7b87160658329fbf28d19eac2718f51fc3def3aa5a/idna-3.18-py3-none-any.whl", hash = "sha256:7f952cbe720b688055e3f87de14f5c3e5fdaa8bc3928985c4077ca689de849a2", size = 65455 }, +] + +[[package]] +name = "iniconfig" +version = "2.3.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/72/34/14ca021ce8e5dfedc35312d08ba8bf51fdd999c576889fc2c24cb97f4f10/iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730", size = 20503 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/cb/b1/3846dd7f199d53cb17f49cba7e651e9ce294d8497c8c150530ed11865bb8/iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12", size = 7484 }, +] + +[[package]] +name = "markdown-it-py" +version = "4.2.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "mdurl" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/06/ff/7841249c247aa650a76b9ee4bbaeae59370dc8bfd2f6c01f3630c35eb134/markdown_it_py-4.2.0.tar.gz", hash = "sha256:04a21681d6fbb623de53f6f364d352309d4094dd4194040a10fd51833e418d49", size = 82454 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b3/81/4da04ced5a082363ecfa159c010d200ecbd959ae410c10c0264a38cac0f5/markdown_it_py-4.2.0-py3-none-any.whl", hash = "sha256:9f7ebbcd14fe59494226453aed97c1070d83f8d24b6fc3a3bcf9a38092641c4a", size = 91687 }, +] + +[[package]] +name = "mdurl" +version = "0.1.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d6/54/cfe61301667036ec958cb99bd3efefba235e65cdeb9c84d24a8293ba1d90/mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba", size = 8729 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", size = 9979 }, +] + +[[package]] +name = "packaging" +version = "26.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/7d/fa/3944b40b07da9ce895c0e6303a5ab7d53da063554f534556b134a54d6093/packaging-26.3.tar.gz", hash = "sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79", size = 313412 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/63/34/ba1c580383c9eada3711951fef0795c80b829a078d72188184bcab9dd527/packaging-26.3-py3-none-any.whl", hash = "sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c", size = 129956 }, +] + +[[package]] +name = "pluggy" +version = "1.6.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f9/e2/3e91f31a7d2b083fe6ef3fa267035b518369d9511ffab804f839851d2779/pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3", size = 69412 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538 }, +] + +[[package]] +name = "pygments" +version = "2.20.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/c3/b2/bc9c9196916376152d655522fdcebac55e66de6603a76a02bca1b6414f6c/pygments-2.20.0.tar.gz", hash = "sha256:6757cd03768053ff99f3039c1a36d6c0aa0b263438fcab17520b30a303a82b5f", size = 4955991 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/f4/7e/a72dd26f3b0f4f2bf1dd8923c85f7ceb43172af56d63c7383eb62b332364/pygments-2.20.0-py3-none-any.whl", hash = "sha256:81a9e26dd42fd28a23a2d169d86d7ac03b46e2f8b59ed4698fb4785f946d0176", size = 1231151 }, +] + +[[package]] +name = "pytest" +version = "9.1.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "iniconfig" }, + { name = "packaging" }, + { name = "pluggy" }, + { name = "pygments" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/e4/47/b9efed96c114afcfa3c9d3fe98a76a1d14c74a9e266d397cf6eb64be5e01/pytest-9.1.1.tar.gz", hash = "sha256:1088fbde8f2b49d95a549a195707afa7a76a3ce9bcadc26b6d71f0ffda5fe313", size = 1636369 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/24/25/1de2678b631f5a49215c6c96fff41ba892b0a34df68d6d80292b1b48aa7f/pytest-9.1.1-py3-none-any.whl", hash = "sha256:37a86b45efb9a47a61a36449063e8e18d0cab3161329fc099eb21783169c4f0c", size = 386536 }, +] + +[[package]] +name = "rich" +version = "15.0.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "markdown-it-py" }, + { name = "pygments" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c0/8f/0722ca900cc807c13a6a0c696dacf35430f72e0ec571c4275d2371fca3e9/rich-15.0.0.tar.gz", hash = "sha256:edd07a4824c6b40189fb7ac9bc4c52536e9780fbbfbddf6f1e2502c31b068c36", size = 230680 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/82/3b/64d4899d73f91ba49a8c18a8ff3f0ea8f1c1d75481760df8c68ef5235bf5/rich-15.0.0-py3-none-any.whl", hash = "sha256:33bd4ef74232fb73fe9279a257718407f169c09b78a87ad3d296f548e27de0bb", size = 310654 }, +] + +[[package]] +name = "ruff" +version = "0.16.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/73/e1/4508a569211b35599016e84ba65c1a992b7a4004b4b6c4bea02a851cba1b/ruff-0.16.2.tar.gz", hash = "sha256:c3d7828d12e8927a6fc65fe38e2c2541b9e762d360a1786d752cb1b8883b3c9c", size = 4885811 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/14/57/db19951540f98859c956b50bdb4d31089b4d91e9f15e2968e7d5193806d5/ruff-0.16.2-py3-none-linux_armv6l.whl", hash = "sha256:3c8de4cf2181f01d57946d87d777aa52916976fc09942aed89938fab5e013318", size = 10847925 }, + { url = "https://files.pythonhosted.org/packages/13/5a/995fe85a8470d3e391ac0f7fa8054bb454eaf33ee138196d6172ed1079c0/ruff-0.16.2-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:9a48cc05c6fbc811ca81b5d7ba95375affea6582d1b8024e455e41afbbf55344", size = 11072662 }, + { url = "https://files.pythonhosted.org/packages/32/53/370d767c61c71a971a4ace36703a7ecd8c393956349a7325d7fab2b56827/ruff-0.16.2-py3-none-macosx_11_0_arm64.whl", hash = "sha256:a2c0d14fcbb26c91f0f867a6dc9bd71bbc30b1b6151829c884f23faeab2e5700", size = 10566771 }, + { url = "https://files.pythonhosted.org/packages/85/d6/9d96948caf5a632be62d62202d5ec914d6856f204fd79eb036e5915e79ea/ruff-0.16.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:335c621622c4650330be50842561c6586ac6971bb8ab5407fe34dcc9efb16bbe", size = 10975825 }, + { url = "https://files.pythonhosted.org/packages/3b/92/ea87129b3414acb0b5770563779c51804d37ac67675c7ba35447ddb14773/ruff-0.16.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:20e66910f2c37cc753f9ef6580c914a621b80c4fa3549d3e3521e29d0f5bfc3f", size = 10649437 }, + { url = "https://files.pythonhosted.org/packages/ac/43/f8f291dcd4af5bb7872b74fdfa41a7cd7c856ca1d4069670971cf1b9f5cb/ruff-0.16.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c7e36fbfba65510548156902bcf1350a979a958ce0347ce0f90d73894036b39f", size = 11446761 }, + { url = "https://files.pythonhosted.org/packages/71/4a/ef991fb2fcf516ab71f0808adcdd8da5e18c8cde447f4ceaf5f47a5132a5/ruff-0.16.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f0eab35f80df8f134aae5d1630e751901321d317cc8e50dc39e36fa3ed34cd12", size = 12336364 }, + { url = "https://files.pythonhosted.org/packages/f3/24/f615e74f307e6ca0e56a482872477b856c70d530aa356abfb6dfe5ca8a80/ruff-0.16.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:40ea8c0594feb894e89c8c61ab9c103d38b0ea72dfde6c594107147ca31b1140", size = 11630720 }, + { url = "https://files.pythonhosted.org/packages/c5/d3/8ef50149e8412a77f7ab409efdef0e2b23803707a3863da4fc64cb23d459/ruff-0.16.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ab3d62dde0b19facdd632008cc4827fc28ada7736c6bd35ab6f1050f0bfed53f", size = 11466130 }, + { url = "https://files.pythonhosted.org/packages/dd/a7/a19334985c4dea8c381981fa252cd854c7ee52dc4b1686dc16f4a911c702/ruff-0.16.2-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:e43e1f5b8388da9eca1b9e88328d47a5cec794633ccf6f7484ac2dd15eee92c0", size = 11523634 }, + { url = "https://files.pythonhosted.org/packages/6e/6c/96d192b0e742412ceda08c0a50f9669b253dde9fd6a60ea1a10c9fa79a63/ruff-0.16.2-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:c24788a980581e1d7ea3a0cbe4344c4fbeb0a6a9b1f4713aa46bb104f8294690", size = 10949807 }, + { url = "https://files.pythonhosted.org/packages/fa/51/e26599ceca11e79ee255c7df515995561edf87e9ca1893284e44d98f5a86/ruff-0.16.2-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:81806b08329130005dd4a8a8394a0c9da8c6f4cafb16ba438d2a2ee6a18bedf1", size = 10646891 }, + { url = "https://files.pythonhosted.org/packages/68/01/800c4b1f97bc8d7c6029e06b1f20473a3cf1e13c4933d8f3342add83fc55/ruff-0.16.2-py3-none-musllinux_1_2_i686.whl", hash = "sha256:4ce4e02bad779bef557f541a1b31f20d6abeae1cc05ed1b1ac019d4ffd1044c8", size = 11162063 }, + { url = "https://files.pythonhosted.org/packages/e4/d0/1477ea50fc5a0d4b0b71d1d63d50770bdd794d90b43e37a7618e63ec9894/ruff-0.16.2-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:e0422abdf70070255fc4073ce9dfc814cc03db577013761ddd09bc1e4a9a4fbd", size = 11556038 }, + { url = "https://files.pythonhosted.org/packages/b8/76/a7776f32048d991e16d4fa8ff91790b877342d3596cc3ed04acdbf1aaedc/ruff-0.16.2-py3-none-win32.whl", hash = "sha256:bf3a63d78fb39f4bf5ac8ae52051c5520505301abe19ba4e204c453b3f09bb0b", size = 10872850 }, + { url = "https://files.pythonhosted.org/packages/00/0d/929c800d920e61397d82a01b60bffc68da3052c17d31de59efaad2e4ed75/ruff-0.16.2-py3-none-win_amd64.whl", hash = "sha256:bcabe2f6d0fc7819f1431793005af4e4de7371927d037345bf941252b195b9fa", size = 12023338 }, + { url = "https://files.pythonhosted.org/packages/5b/6c/93e26c22c5f78ff87363e07da49c84955affbeb1098bd1936bf3b3f293bf/ruff-0.16.2-py3-none-win_arm64.whl", hash = "sha256:d614e95cedf38a2053fd351c55b103ba30d017d61688fdbfd40ee0412852a99f", size = 11374065 }, +] + +[[package]] +name = "shellingham" +version = "1.5.4" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/58/15/8b3609fd3830ef7b27b655beb4b4e9c62313a4e8da8c676e142cc210d58e/shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de", size = 10310 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e0/f9/0595336914c5619e5f28a1fb793285925a8cd4b432c9da0a987836c7f822/shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686", size = 9755 }, +] + +[[package]] +name = "typer" +version = "0.27.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "annotated-doc" }, + { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "rich" }, + { name = "shellingham" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/ae/40/4a3db7990d1f62a53182aa96eaef57aeb2886a27f90a195bc66713565d31/typer-0.27.1.tar.gz", hash = "sha256:a79bef8469a79c45498e7b814ecf8d603cc7644e9acbd9e19cac0334240b18df", size = 203994 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/43/89/9518bc0c3929bee36b3a4a8e3daddd6e03f92f9961c66d4983b837160543/typer-0.27.1-py3-none-any.whl", hash = "sha256:53150287edd11baeb4e4722c8e394fcdf8181c0ae89485cba8d25c778d5edd56", size = 122874 }, +] + +[[package]] +name = "typing-extensions" +version = "4.16.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f6/cc/6253133b5bb138fc3306cebfbda2c520f545d36b5be2c7255cc528bb45d6/typing_extensions-4.16.0.tar.gz", hash = "sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5", size = 113555 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/49/d3/b8441a820a491ddfc024b0b0cf0393375b75ea13866d9c66727e54c2fc80/typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8", size = 45571 }, +]