Repository navigation
Conversation
…ightly floor job transformers>=5.3.0 was described as the CVE fix floor but still admitted CVE-2026-5241 (a LightGlue config.json overrides trust_remote_code, fixed 5.5.0) and CVE-2026-9856 (a chat_template name from tokenizer_config.json is used unsanitised as a file name by save_pretrained, fixed 5.10.0). Both reach ForgeLM from a Hub repo: it loads a tokenizer and saves it again to final_model/, on export and on merge. Reproduced on 5.3.0: a traversal name wrote a file outside the output directory; on 5.10.1 the save raises. 5.10.0 was yanked, so the floor is 5.10.1. transformers 5.10 requires huggingface_hub>=1.5.0, so that floor moves too. The nightly minimum-versions job pins both, and a test now compares every nightly pin with pyproject, checks the transformers floor against the advisories, and saves a crafted tokenizer (fails on 5.3.0, passes on 5.10.1). The transformers-facing test modules pass on a 5.10.1 / huggingface_hub 1.5.0 install. The top of the range (5.15+ warmup_ratio, the string fsdp form removed in 5.20) is not touched here. Refs #109 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Sorry @cemililik, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 13 hours and 10 minutes by commenting |
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Next included review available in 50 minutes. View limit details
Comment |
Reviewer's GuideRaises ForgeLM’s Transformers security floor to the first installable release past the identified load/save-path advisories, updates the dependent Hub floor and nightly minimum-version pins, synchronizes documentation, and adds tests covering both dependency alignment and the chat-template path-traversal regression. Sequence diagram for chat-template save-path protectionsequenceDiagram
participant HubRepo as Hub repo
participant Loader as forgelm.model._load_tokenizer
participant Tokenizer as tokenizer
participant Save as save_pretrained
participant Output as Save directory
HubRepo->>Loader: Load crafted tokenizer
Loader->>Tokenizer: Read tokenizer_config.json
Tokenizer->>Save: Save tokenizer with chat_template name
alt transformers 5.10.1+
Save-->>Tokenizer: Raise Invalid chat template name
Save-->>Output: Do not write outside directory
else transformers 5.3.0
Save->>Output: Write using unsanitized file name
Save-->>Output: Path can escape save directory
end
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
The changelog entry and the nightly comment pointed at tests/test_dependency_floor.py, which does not exist; the comparison lives in tests/test_packaging.py. Refs #109 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Superseded by #999: the wave-0 fixes are combined by theme into five pull requests to cut the review load. This branch's commits are included there unchanged apart from the |
…n.enforce, transformers CVE floor, FSDP strategies, purge output dir (#999) ## Summary Six code fixes combined into one pull request, replacing #984, #985, #987, #989, #990 and #992 (to be closed as superseded). Each fixes a case where the code failed, or a documented option did nothing, without saying so. Each was mutation-checked on its own; together they pass the full gauntlet. ## Related issues Refs #103, #95, #92, #98, #109, #104, #102. Not closed by this change: the top-of-range problems named in #109 (`warmup_ratio` on transformers 5.15+, the string `fsdp` form removed in 5.20), the FSDP2 migration (#104), and reading `training.output_dir` for the purge memorisation check (#102). ## Changes | # | Fix | Where | |---|---|---| | #984 | `training.rope_scaling` crashed every model load on transformers 5 (`KeyError: 'rope_type'`, or `rope_theta` lost). The requested keys are merged **over** the model's `rope_parameters` and the finished config is loaded; `sliding_window_attention` travels in the same config object. | `forgelm/model.py` | | #985 | The CLI sets `HF_HUB_DISABLE_TELEMETRY=1` (via `setdefault`) before `huggingface_hub` is imported, so TRL's trainer no longer sends Hugging Face's anonymous usage ping the privacy page says does not exist. Library use is not covered; the air-gap page says so. | `cli/_config_load.py`, `cli/_dispatch.py` | | #987 | `retention.enforce` was documented as a gate (`warn_on_excess`, `block_on_excess` → `EXIT_EVAL_FAILURE`) but no command reads it. Docs, field description, both wizards say it is reserved; the CLI warns when a config sets either of the last two. | `config.py` (in place), `cli/_config_load.py`, `wizard/_collectors.py` | | #989 | `transformers>=5.3.0` was called the CVE floor but admitted CVE-2026-5241 and CVE-2026-9856 (a crafted `chat_template` name writes outside the save directory). Floor is now `>=5.10.1` (5.10.0 is yanked), `huggingface_hub>=1.5.0`, the nightly floor job pins both, and tests keep it from drifting. | `pyproject.toml`, `nightly.yml`, `tests/` | | #990 | `fsdp_strategy: no_shard` / `hybrid_shard` passed `--dry-run` and exited 2 after the model loaded (FSDP2 rejects them). They are now rejected when the config loads (exit 1), and two knobs FSDP2 ignores (`fsdp_auto_wrap: false`, `backward_post`) log a warning. | `config.py` (in place), `cli/_config_load.py` | | #992 | `forgelm purge --row-id` without `--output-dir` silently pointed the memorisation check at the corpus directory. It now warns and names the path. The purge module's line budget is raised by 8 with a `budget_history` note (the project's documented option). | `cli/subcommands/_purge.py`, `tools/check_module_size.py` | `config.py` (0 lines of headroom on the module-size ratchet) and `trainer.py` change only by in-place string edits; new warnings live in `cli/_config_load.py`. ### Merge-conflict handling The six branches touched `CHANGELOG.md`, `tests/test_cli.py` (two appended test classes) and the import line in `cli/_dispatch.py`; all three were resolved by keeping both sides (the import line now imports `_disable_hub_telemetry` and `_warn_inert_fsdp_options`). The affected test modules pass together (621 tests). ## Type - [x] Bug fix - [x] Dependency ## Testing - The full `CLAUDE.md` gauntlet from a clean worktree of this branch: exit 0. - Per-fix tests as in the original pull requests, including: a real tiny Llama on CPU for `rope_scaling` (linear, dynamic, yarn); the traversal reproduction (**fails on transformers 5.3.0**, passes on 5.10.1); all 32 accepted FSDP variants building real `TrainingArguments`. - transformers-facing test modules pass on a 5.10.1 / `huggingface_hub` 1.5.0 overlay (443 tests). The nightly minimum-versions job runs on its schedule after merge; I did not dispatch it. ## Checklist - [x] English and Turkish mirrors updated together - [x] CHANGELOG entries under `[Unreleased]` - [x] Tests added 🤖 Generated with [Claude Code](https://claude.com/claude-code) ## Summary by Sourcery Harden CLI behavior and dependency compatibility across model loading, privacy, retention, distributed training, and purge workflows. Bug Fixes: - Restore Transformers 5 compatibility for RoPE scaling and sliding-window model configuration. - Disable Hugging Face Hub telemetry by default for CLI runs while preserving explicit operator opt-in. - Warn when reserved retention enforcement modes are configured instead of implying unsupported enforcement behavior. - Reject unsupported FSDP1-only strategies during configuration and warn about FSDP2 options that have no effect. - Warn when purge uses the corpus directory as its implicit output directory and clarify the memorisation-check scope. Enhancements: - Document the actual retention, FSDP, telemetry, and purge behavior in English and Turkish user-facing documentation. Build: - Raise the minimum runtime dependencies to transformers>=5.10.1 and huggingface_hub>=1.5.0 to address relevant security advisories. - Update the nightly minimum-version job and packaging checks to enforce the new dependency floors. Tests: - Add coverage for telemetry initialization, reserved retention warnings, FSDP validation, purge output-directory warnings, Transformers 5 RoPE handling, and chat-template path traversal protection. Chores: - Increase the purge module size budget for the new output-directory warning. --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Summary
transformers>=5.3.0was described as "the CVE fix floor" but still admitted two advisories that reach ForgeLM's own load-and-save path from a Hub repo. This raises the floor to>=5.10.1(andhuggingface_hubto>=1.5.0, which transformers 5.10 requires), pins both in the nightly minimum-versions job, and adds tests that keep the floor from drifting back.Related issues
Refs #109 — the floor, the nightly pin, the drift test and the traversal regression test. The top-of-range problems the issue also names (the
warmup_ratiomapping on 5.15+, the stringfsdpform removed in 5.20) are not part of this change, and CVE-2026-80047 (no patched version is listed upstream; ForgeLM does not call the affectedcustom_generate) still needs tracking.Changes
config.jsonoverridestrust_remote_code: falseand runs a Hub repo's modulechat_templatename intokenizer_config.jsonis used as a file name bysave_pretrained, so the save infinal_model/, GGUF export and merge can write outside the output directorypyproject.toml:transformers>=5.10.1,<6.0.0,huggingface_hub>=1.5.0,<2.0.0, with a comment naming the advisories..github/workflows/nightly.yml: the minimum-versions job installstransformers==5.10.1andhuggingface_hub==1.5.0; the "CVE fix floor" comment is accurate again.tools/pip_audit_ignores.yaml, the installation page and the supply-chain reference (English and Turkish) no longer imply the 5.3 floor cleared the later advisories.CHANGELOG.md, under Changed: environments pinned to transformers 5.3–5.9 must upgrade.Checked
5.10.0is yanked on PyPI;5.10.1is not. transformers 5.10.1 requireshuggingface-hub>=1.5.0.chat_templatename writes outside the save directory; on 5.10.1 and 5.13.0save_pretrainedraisesInvalid chat template name.huggingface_hub1.5.0 install overlaid on the project venv (torch 2.12, so this does not exercise torch 2.4).Type
Testing
tests/test_packaging.py::test_transformers_floor_is_past_cve_2026_5241_and_cve_2026_9856: the declared floor is at least 5.10.1 and does not admit 5.3.0, 5.4.0, 5.9.0 or 5.10.0.tests/test_packaging.py::test_nightly_floor_job_pins_the_runtime_dependency_minimums: everyname==Xthe nightly floor job installs equals the>=Xfloor inpyproject.toml.tests/test_model.py::TestChatTemplateNameCannotEscapeTheSaveDirectory: loads a crafted tokenizer throughforgelm.model._load_tokenizer, saves it, expects a refusal and no file outside the directory. Fails on transformers 5.3.0, passes on 5.10.1.CLAUDE.mdgauntlet from a clean worktree of this branch: exit 0.Not run
The nightly minimum-versions job itself (torch 2.4.0 + the new pins) runs on its schedule after merge; I did not dispatch it.
Checklist
[Unreleased]🤖 Generated with Claude Code
Summary by Sourcery
Raise the Transformers and Hugging Face Hub dependency floors to secure ForgeLM's model loading and saving paths.
Bug Fixes:
Enhancements:
CI:
Documentation:
Tests: