Nettacker icon indicating copy to clipboard operation
Nettacker copied to clipboard

Preserve Module-defined Timeout Values (Fixes #1515)

Open Aarush289 opened this issue 7 months ago โ€ข 1 comments

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 :- image

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-commit and confirm it didn't generate any warnings/changes
  • [x] I've run make test and 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

Aarush289 avatar Apr 15 '26 09:04 Aarush289

Review Change Stack

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.

โค๏ธ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot] avatar Apr 15 '26 09:04 coderabbitai[bot]

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.

NSK-394 avatar Aug 07 '26 07:08 NSK-394

@codex review this PR using skill: https://github.com/nettacker-codex-ai/skills/blob/main/pr-review-recommender/SKILL.md

securestep9 avatar Aug 07 '26 08:08 securestep9

Contribution validation failed:

  • issue_assignee: The linked issue must be assigned to the PR author before this PR can be merged.

github-actions[bot] avatar Aug 11 '26 23:08 github-actions[bot]

Thank you for your contribution @Aarush289 ! ๐Ÿš€

securestep9 avatar Aug 18 '26 18:08 securestep9