Skip to content

fix(deps): raise the transformers floor to 5.10.1 and pin it in the nightly floor job - #989

Closed
cemililik wants to merge 2 commits into
developmentfrom
fix/transformers-cve-floor
Closed

cemililik wants to merge 2 commits into
developmentfrom
fix/transformers-cve-floor

Conversation

@cemililik

@cemililik cemililik commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

transformers>=5.3.0 was 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 (and huggingface_hub to >=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_ratio mapping on 5.15+, the string fsdp form 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 affected custom_generate) still needs tracking.

Changes

Advisory What it does to ForgeLM Fixed in
CVE-2026-5241 a LightGlue config.json overrides trust_remote_code: false and runs a Hub repo's module 5.5.0
CVE-2026-9856 a chat_template name in tokenizer_config.json is used as a file name by save_pretrained, so the save in final_model/, GGUF export and merge can write outside the output directory 5.10.0 (yanked on PyPI) → 5.10.1
  • pyproject.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 installs transformers==5.10.1 and huggingface_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.0 is yanked on PyPI; 5.10.1 is not. transformers 5.10.1 requires huggingface-hub>=1.5.0.
  • The traversal reproduction from the issue, offline with a tiny local tokenizer: on 5.3.0 the crafted chat_template name writes outside the save directory; on 5.10.1 and 5.13.0 save_pretrained raises Invalid chat template name.
  • The transformers-facing test modules (model, trainer, export, merge, fit-check, data, model card; 443 tests) pass on a 5.10.1 / huggingface_hub 1.5.0 install overlaid on the project venv (torch 2.12, so this does not exercise torch 2.4).

Type

  • Bug fix (security floor)
  • Dependency

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: every name==X the nightly floor job installs equals the >=X floor in pyproject.toml.
  • tests/test_model.py::TestChatTemplateNameCannotEscapeTheSaveDirectory: loads a crafted tokenizer through forgelm.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.
  • Mutation checks: lowering the floor fails two tests; drifting one nightly pin fails one.
  • The full CLAUDE.md gauntlet 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

  • English and Turkish mirrors updated together
  • CHANGELOG entry under [Unreleased]
  • Tests added

🤖 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:

  • Raise the Transformers dependency floor to 5.10.1 and the Hugging Face Hub floor to 1.5.0 to prevent vulnerable model loading and save-path traversal behavior.

Enhancements:

  • Add regression coverage ensuring crafted chat-template names cannot write outside the model output directory.
  • Keep the nightly minimum-dependency pins synchronized with the runtime dependency floors.

CI:

  • Update the nightly minimum-versions job to test the new security floors.

Documentation:

  • Update changelog, installation guidance, and supply-chain documentation to reflect the new dependency floors and required upgrades.

Tests:

  • Add packaging checks that enforce the security floor and verify nightly pins do not drift.

…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>
@sourcery-ai

sourcery-ai Bot commented Oct 18, 2026

Copy link
Copy Markdown

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 @sourcery-ai review. Upgrade to get a review now.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Next included review available in 50 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 50 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: f5e25226-cac4-4fe1-9967-1dacbd19ca2f
📥 Commits

Reviewing files that changed from the base of the PR and between 56b4f0d and e8d9683.

📒 Files selected for processing: 10
  • .github/workflows/nightly.yml
  • CHANGELOG.md
  • docs/reference/supply_chain_security-tr.md
  • docs/reference/supply_chain_security.md
  • docs/usermanuals/en/getting-started/installation.md
  • docs/usermanuals/tr/getting-started/installation.md
  • pyproject.toml
  • tests/test_model.py
  • tests/test_packaging.py
  • tools/pip_audit_ignores.yaml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai

sourcery-ai Bot commented Oct 18, 2026

Copy link
Copy Markdown

Reviewer's Guide

Raises 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 protection

sequenceDiagram
    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
Loading

File-Level Changes

Change Details Files
Raise the runtime security floor for Transformers and its Hub dependency, while keeping the nightly minimum-version job aligned with the declared constraints.
  • Set transformers to >=5.10.1,<6.0.0 and huggingface_hub to >=1.5.0,<2.0.0, documenting the affected advisories and yanked 5.10.0 release.
  • Pin the nightly floor job to transformers 5.10.1 and huggingface_hub 1.5.0.
  • Update changelog, installation guidance, supply-chain references, and audit-ignore comments to reflect the new floor.
pyproject.toml
.github/workflows/nightly.yml
CHANGELOG.md
docs/reference/supply_chain_security.md
docs/reference/supply_chain_security-tr.md
docs/usermanuals/en/getting-started/installation.md
docs/usermanuals/tr/getting-started/installation.md
tools/pip_audit_ignores.yaml
Add regression coverage preventing the dependency floor or nightly pin from drifting below the security baseline.
  • Parse pyproject.toml to assert the Transformers floor excludes vulnerable releases through 5.10.0.
  • Compare every nightly name==version pin against the corresponding project >= floor and require the two security-critical pins.
  • Use a crafted local tokenizer with a traversal chat-template name to verify save_pretrained refuses the name and writes nothing outside the output directory.
tests/test_packaging.py
tests/test_model.py

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

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>

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery assessment

Approved.

@cemililik

Copy link
Copy Markdown
Collaborator Author

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 CHANGELOG.md merge; the branch stays on the remote.

@cemililik cemililik closed this Oct 18, 2026
cemililik added a commit that referenced this pull request Oct 18, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant