Skip to content

Fix CWE-561 Dead Code Vulnerability related to use_new_cache = False#2254

Merged
regisss merged 2 commits into
huggingface:mainfrom
karol-brejna-i:dev/kbrejna/use_new_cache-fix
Sep 11, 2025
Merged

Fix CWE-561 Dead Code Vulnerability related to use_new_cache = False#2254
regisss merged 2 commits into
huggingface:mainfrom
karol-brejna-i:dev/kbrejna/use_new_cache-fix

Conversation

@karol-brejna-i
Copy link
Copy Markdown
Collaborator

Fix CWE-561 Dead Code Vulnerability related to use_new_cache = False

Multiple model implementations in the optimum-habana codebase contained dead code that violated CWE-561 (Dead Code)** security standards.

  1. use_new_cache was explicitly hardcoded to False for HPU optimization
  2. Conditional checks if use_new_cache: were still present but never executed
  3. Dead code blocks contained unreachable cache conversion logic

This PR removes the dead code and allows us to pass security scans.

@github-actions
Copy link
Copy Markdown

The code quality check failed, please run make style.

@karol-brejna-i karol-brejna-i marked this pull request as draft September 11, 2025 13:51
@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@karol-brejna-i karol-brejna-i marked this pull request as ready for review September 11, 2025 13:55
@karol-brejna-i karol-brejna-i self-assigned this Sep 11, 2025
Copy link
Copy Markdown
Collaborator

@regisss regisss left a comment

Choose a reason for hiding this comment

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

LGTM

@regisss regisss merged commit b3d46da into huggingface:main Sep 11, 2025
2 of 5 checks passed
gplutop7 pushed a commit to HabanaAI/optimum-habana-fork that referenced this pull request Oct 15, 2025
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.

4 participants