Skip to content

Refactor: Enforce explicit problem type validation in config loader#973

Open
RinZ27 wants to merge 1 commit intoh2oai:mainfrom
RinZ27:fix-config-loading-vulnerability
Open

Refactor: Enforce explicit problem type validation in config loader#973
RinZ27 wants to merge 1 commit intoh2oai:mainfrom
RinZ27:fix-config-loading-vulnerability

Conversation

@RinZ27
Copy link
Copy Markdown

@RinZ27 RinZ27 commented Mar 1, 2026

This Pull Request addresses the issue of unvalidated dynamic module imports in the configuration loader, as discussed in #972.

The implementation in llm_studio/src/utils/config_utils.py currently utilizes the problem_type field to dynamically construct module paths for importlib.import_module. While the risk of arbitrary code execution is minimal, this pattern can lead to unintended module loading or unexpected runtime behavior.

Validation against the predefined GENERATION_PROBLEM_TYPES and NON_GENERATION_PROBLEM_TYPES allowlists has been introduced before any module load occurs. This refactor ensures only validated configuration modules are imported, improving the stability of the loader.

Summary of Changes:

  • Introduced validation logic in convert_nested_dictionary_to_cfg_base to check problem_type against an allowlist.
  • Added text_sequence_to_sequence_modeling to the allowlist.
  • Raises NotImplementedError for unsupported or unvalidated problem types.

Verified the fix with local testing and confirmed make format passes.

Closes #972

…ig_utils

Prevent arbitrary module loading by whitelisting allowed problem types. This change ensures that only known and safe configuration modules can be loaded via convert_nested_dictionary_to_cfg_base.
@RinZ27 RinZ27 requested a review from pascal-pfeiffer as a code owner March 1, 2026 15:09
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.

Refactor: Explicit validation of problem_type in configuration loader

1 participant