8000 fix: validate subcommand name before dynamic import by RinZ27 · Pull Request #4620 · ansible/molecule · GitHub
[go: up one dir, main page]

Skip to content

fix: validate subcommand name before dynamic import - #4620

Merged
ssbarnea merged 1 commit into
ansible:mainfrom
RinZ27:fix-unintended-module-loading
Mar 5, 2026
Merged

ssbarnea merged 1 commit into
ansible:mainfrom
RinZ27:fix-unintended-module-loading

Conversation

@RinZ27
@RinZ27 RinZ27 commented Mar 4, 2026
Copy link
Copy Markdown
Contributor

Validation for subcommand names in execute_subcommand ensures that only alphanumeric characters and underscores are processed. While checking the command execution flow, I noticed that import_module was receiving values directly from the scenario configuration 10000 without sanitization. This change prevents potential unintended module loading attempts through special characters or path traversal sequences in the subcommand string.

Existing tests for command execution remain unchanged, and I added a new test case to verify that invalid subcommand names are correctly rejected with a MoleculeError. Verified the changes locally with ruff to ensure compliance with the project's linting standards.

@RinZ27
RinZ27 force-pushed the fix-unintended-module-loading branch from 77d2b5e to 4e78cd0 Compare March 4, 2026 07:23
@RinZ27 RinZ27 changed the title validate subcommand name before dynamic import fix: validate subcommand name before dynamic import Mar 4, 2026
@ssbarnea ssbarnea added the fix label Mar 5, 2026
@github-actions github-actions Bot added fix and removed fix labels Mar 5, 2026
@ssbarnea
ssbarnea merged commit 1386c70 into ansible:main Mar 5, 2026
20 of 21 checks passed
@RinZ27
RinZ27 deleted the fix-unintended-module-loading branch March 6, 2026 03:28

This branch was previously deployed

1 inactive deployment
ack — 4e78cd09 Deployed Mar 5, 2026 by ssbarnea via ack / ack #3986
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants

0