Skip to content

Move HF_TOKEN to libgit2 lib - #4530

Open
rasapala wants to merge 2 commits into
mainfrom
move_token_for_pull
Open

Move HF_TOKEN to libgit2 lib#4530
rasapala wants to merge 2 commits into
mainfrom
move_token_for_pull

Conversation

@rasapala

@rasapala rasapala commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

🛠 Summary

JIRA CVS-194439, CVS-194440
Remove debug logs and move token setting to libgit2 library.

🧪 Checklist

  • Unit tests added.
  • The documentation updated.
  • Change follows security best practices.
    ``

@rasapala
rasapala requested review from dtrawins and mzegla and a lite review from Copilot September 9, 2026 13:27
Comment thread src/pull_module/hf_pull_model_module.cpp Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

A new/updated logging path still prints default environment values despite the stated intent to avoid logging env values, which is a security-hardening inconsistency.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR adjusts Hugging Face model pulling to avoid embedding HF_TOKEN in repository URLs, instead relying on libgit2/LFS integration to apply authentication, and removes overly-verbose debug logging of environment variable values.

Changes:

  • Removed hfToken plumbed through HfDownloader and stopped constructing credential-in-URL repo strings.
  • Added HF_TOKEN-based auth configuration in the libgit2 LFS curl path (via the vendored lfs.patch).
  • Reduced debug logging to avoid printing environment variable values.
File summaries
File Description
third_party/libgit2/lfs.patch Adds curl auth configuration for LFS requests based on HF_TOKEN.
src/test/pull_hf_model_test.cpp Updates unit tests to reflect token no longer being embedded in repo URLs.
src/pull_module/libgit2.hpp Updates HfDownloader API by removing the hfToken constructor parameter/member.
src/pull_module/libgit2.cpp Removes URL-embedded-credentials logic and clones using the plain repo URL.
src/pull_module/hf_pull_model_module.cpp Avoids logging environment variable values and updates HfDownloader construction accordingly.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/pull_module/hf_pull_model_module.cpp Outdated
Comment thread third_party/libgit2/lfs.patch
Co-authored-by: Miłosz Żeglarski <milosz.zeglarski@intel.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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.

3 participants