Preserve Module-defined Timeout Values (Fixes #1515)
Proposed change
This PR fixes an issue where the timeout field defined in modules was always being overwritten by the default CLI timeout value (e.g., 3.0), even when the user did not explicitly provide a timeout.
Behavior After Fix
Module-defined timeout is preserved when no CLI timeout is provided.
CLI-provided timeout overrides module value only when explicitly set (i.e., not equal to default 3.0).
Fixes #1515
Tested by changing timeout value of one of the modules :-
Type of change
- [ ] New core framework functionality
- [x] Bugfix (non-breaking change that fixes an issue)
- [ ] Code refactoring without any functionality changes
- [ ] New or existing module/payload change
- [ ] Documentation/localization improvement
- [ ] Test coverage improvement
- [ ] Dependency upgrade
- [ ] Other improvement (best practice, cleanup, optimization, etc)
Checklist
- [x] I've followed the contributing guidelines
- [x] I've digitally signed all my commits in this PR
- [x] I've run
make pre-commitand confirm it didn't generate any warnings/changes - [x] I've run
make testand I confirm all tests passed locally - [ ] I've added/updated any relevant documentation in the
docs/folder - [x] I've linked this PR with an open issue
- [x] I've tested and verified that my code works as intended and resolves the issue as described
- [x] I've attached screenshots demonstrating that my code works as intended (if applicable)
- [x] I've checked all other open PRs to avoid submitting duplicate work
- [x] I confirm that the code and comments in this PR are not direct unreviewed outputs of AI
- [x] I confirm that I am the Sole Responsible Author for every line of code, comment, and design decision
No actionable comments were generated in the recent review. ๐
โน๏ธ Recent review info
โ๏ธ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5b235a85-d2a9-4d60-ba9d-6a969f0fbcf3
๐ฅ Commits
Reviewing files that changed from the base of the PR and between cc1874348f92f05db89bb5620608d47b0004f4a4 and dda126310d5d18ce2810625a267ef77fe4bf5d38.
๐ Files selected for processing (1)
nettacker/core/template.py
๐ง Files skipped from review as they are similar to previous changes (1)
- nettacker/core/template.py
Summary by CodeRabbit
- Bug Fixes
- Improved template input handling so YAML values are preserved when provided inputs are empty or unchanged.
- Refined timeout processing to respect explicitly configured YAML timeout values unless a different timeout is supplied.
Walkthrough
TemplateLoader.parse conditionally applies module_inputs over YAML values, preserving module-defined timeouts when the input matches the configured default.
Changes
Template parsing
| Layer / File(s) | Summary |
|---|---|
Conditional template value overrides nettacker/core/template.py |
Non-timeout values are applied only when truthy; timeout values are overridden only when they differ from Config.settings.timeout by more than 1e-9. |
Estimated code review effort: 2 (Simple) | ~8 minutes
Suggested reviewers: arkid15r, securestep9
๐ฅ Pre-merge checks | โ 4 | โ 1
โ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | โ ๏ธ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
โ Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | โ Passed | The title clearly states the main change: preserving module-defined timeout values. |
| Description check | โ Passed | The description directly explains the timeout overwrite bug and the intended fix. |
| Linked Issues check | โ Passed | The code preserves module timeout values unless an explicit CLI timeout overrides them, matching #1515. |
| Out of Scope Changes check | โ Passed | The change is limited to TemplateLoader.parse logic and stays within the timeout bug fix. |
โจ Finishing Touches
๐งช Generate unit tests (beta)
- [ ] Create PR with unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Hit this exact issue independently while building a new vulnerability module (#1653) that needs a longer per-step timeout for a long-polling endpoint โ had to document a --timeout 30 CLI workaround since this fix hasn't landed yet. Would be great to see this merged; it'd let modules like mine work correctly without requiring users to remember a global flag. Happy to help test if useful.
@codex review this PR using skill: https://github.com/nettacker-codex-ai/skills/blob/main/pr-review-recommender/SKILL.md
Contribution validation failed:
- issue_assignee: The linked issue must be assigned to the PR author before this PR can be merged.
Thank you for your contribution @Aarush289 ! ๐