Add dynamic random string generator for modules - #1287
Conversation
create pr
Document all modules ( fix OWASP#1269 ) (OWASP#1270)
Signed-off-by: Aarush <cs24b064@smail.iitm.ac.in>
Removed entry for FortiWeb authentication bypass vulnerability. Signed-off-by: Aarush <cs24b064@smail.iitm.ac.in>
Signed-off-by: Aarush <cs24b064@smail.iitm.ac.in>
Signed-off-by: Aarush <cs24b064@smail.iitm.ac.in>
Summary by CodeRabbit
WalkthroughAdds runtime placeholder processing to TemplateLoader: a private Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@nettacker/core/template.py`:
- Around line 32-42: Clamp and validate the captured length in
_apply_dynamic_placeholders before passing it to
common_utils.generate_random_token: parse int(m.group(1)), enforce a reasonable
max (e.g. MAX_RAND_STR_LEN = 256) and either cap the requested length or raise a
clear ValueError when it exceeds the cap; update the lambda so it performs this
check and returns a safe-length random token (using
common_utils.generate_random_token) to avoid accidental large allocations from
templates like {rand_str(999999)}.
|
@securestep9 Can you please review the PR |
|
@codex review this PR using skill: https://github.com/nettacker-codex-ai/skills/blob/main/pr-review-recommender/SKILL.md |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09788d5569
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| def format(self): | ||
| return self.open().format(**self.inputs) | ||
| content = self.open() | ||
| content = self._apply_dynamic_placeholders(content) |
There was a problem hiding this comment.
Add tests for dynamic placeholder expansion
This introduces a new template-preprocessing path without any test coverage, so regressions involving replacement, the 256-character cap, multiple placeholders, or coexistence with ordinary placeholders such as {target} can pass unnoticed. Add focused tests under tests/core/ for the new formatting behavior.
AGENTS.md reference: AGENTS.md:L27-L30
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
I will add tests once this is merged
Proposed change
This PR introduces support for dynamic placeholders {rand_str(n)} in module templates, allowing random strings of configurable length to be generated at runtime.
This is useful for implementing modules that require unpredictable parameters or tokens, such as cve_2025_64446, where static values may be filtered or cached by the target.
Type of change
Checklist
make pre-commit, it didn't generate any changesmake test, all tests passed locally