Skip to content

enable templates for template listing and displaying#6343

Merged
ehsandeep merged 1 commit intodevfrom
6160_enable_all_templates_for_tl_td
Aug 16, 2025
Merged

enable templates for template listing and displaying#6343
ehsandeep merged 1 commit intodevfrom
6160_enable_all_templates_for_tl_td

Conversation

@dogancanbakir
Copy link
Copy Markdown
Member

@dogancanbakir dogancanbakir commented Jul 22, 2025

Proposed changes

closes #6160
tl:

$ go run . -id secret-manager-not-inuse -tl

                     __     _
   ____  __  _______/ /__  (_)
  / __ \/ / / / ___/ / _ \/ /
 / / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   v3.4.4

                projectdiscovery.io


Listing available v10.2.5 nuclei templates for /Users/dogancanbakir/nuclei-templates
cloud/aws/secrets-manager/secret-manager-not-inuse.yaml

td:

$ go run . -id secret-manager-not-inuse -td

                     __     _
   ____  __  _______/ /__  (_)
  / __ \/ / / / ___/ / _ \/ /
 / / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   v3.4.4

                projectdiscovery.io


Listing available v10.2.5 nuclei templates for /Users/dogancanbakir/nuclei-templates
Template: /Users/dogancanbakir/nuclei-templates/cloud/aws/secrets-manager/secret-manager-not-inuse.yaml

id: secret-manager-not-inuse

info:
  name: Secrets Manager Not In Use
  author: DhiyaneshDK
  severity: info
  description: |
        Ensure that Amazon Secrets Manager service is used in your AWS account to manage access credentials (i.e. secrets) such as API keys, OAuth tokens and database credentials.
  impact: |
        AWS Secrets Manager improves security by securely managing and rotating sensitive credentials, reducing the risk of exposure and unauthorized access.
  remediation: |
        Ensure AWS Secrets Manager is used to securely store, manage, and rotate sensitive credentials such as API keys, database passwords, and tokens, and remove hard-coded secrets from applications.
  reference:
    - https://www.trendmicro.com/cloudoneconformity-staging/knowledge-base/aws/SecretsManager/secrets-manager-in-use.html
    - https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html
  tags: cloud,devops,aws,amazon,secret-manager,aws-cloud-config

variables:
  region: "us-west-2"

self-contained: true
code:
  - engine:
      - sh
      - bash
    source: |
            aws secretsmanager list-secrets --region $region --query 'SecretList[*].Name' --output json

    matchers:
      - type: word
        words:
          - '[]'

    extractors:
      - type: dsl
        dsl:
          - '"Secrets Manager Not In Use" + region + " AWS region"'
# digest: 4a0a004730450220417b4366f7c291bf10ae4aa09013d6fa750065e2c8217de9cc58c14d4aad1f8a022100b55bc14bdd0f80bb5a5f0fcf55761e31efc38b6b6a0717354c6dcbe2b435875c:922c64590222798bb761d5b6d8e72950

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Summary by CodeRabbit

  • Bug Fixes
    • Ensured that all template categories are automatically enabled when listing or displaying templates, providing a more consistent user experience.

@dogancanbakir dogancanbakir self-assigned this Jul 22, 2025
@auto-assign auto-assign bot requested a review from dwisiswant0 July 22, 2025 18:59
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jul 22, 2025

Walkthrough

A conditional block was added to the New function of the Runner struct. Now, if either TemplateList or TemplateDisplay is true, all template category enablement flags are set to true, ensuring all template types are enabled when listing or displaying templates.

Changes

File(s) Summary
internal/runner/runner.go Updated New function logic to auto-enable all template categories if listing/displaying templates.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Runner.New
    participant Options

    User->>Runner.New: Call with Options
    alt TemplateList or TemplateDisplay is true
        Runner.New->>Options: Set all template enable flags to true
    else
        Runner.New->>Options: Use provided enable flags
    end
    Runner.New-->>User: Return Runner instance
Loading

Estimated code review effort

1 (~2 minutes)

Poem

A hop, a skip, a template spree,
Now all are enabled, as easy as can be!
Listing or display, no flag left behind,
The Runner now helps you find every kind.
With a twitch of my nose, I give a cheer—
All templates are ready, the path is clear! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5daf84d and 077f58e.

📒 Files selected for processing (1)
  • internal/runner/runner.go (1 hunks)
🧠 Learnings (2)
📓 Common learnings
Learnt from: hdm
PR: projectdiscovery/nuclei#6322
File: pkg/templates/compile.go:79-81
Timestamp: 2025-07-16T21:27:14.937Z
Learning: To make the template caching mechanism in pkg/templates/compile.go production-ready, DSLs need to be updated to use runtime options instead of cached variables, rather than restoring the Compile() calls on each request.
internal/runner/runner.go (1)

Learnt from: hdm
PR: #6322
File: pkg/templates/compile.go:79-81
Timestamp: 2025-07-16T21:27:14.937Z
Learning: To make the template caching mechanism in pkg/templates/compile.go production-ready, DSLs need to be updated to use runtime options instead of cached variables, rather than restoring the Compile() calls on each request.

🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: hdm
PR: projectdiscovery/nuclei#6322
File: pkg/templates/compile.go:79-81
Timestamp: 2025-07-16T21:27:14.937Z
Learning: To make the template caching mechanism in pkg/templates/compile.go production-ready, DSLs need to be updated to use runtime options instead of cached variables, rather than restoring the Compile() calls on each request.
internal/runner/runner.go (1)

Learnt from: hdm
PR: #6322
File: pkg/templates/compile.go:79-81
Timestamp: 2025-07-16T21:27:14.937Z
Learning: To make the template caching mechanism in pkg/templates/compile.go production-ready, DSLs need to be updated to use runtime options instead of cached variables, rather than restoring the Compile() calls on each request.

🔇 Additional comments (1)
internal/runner/runner.go (1)

126-132: LGTM! Clean implementation for comprehensive template visibility.

The conditional logic correctly ensures that when listing or displaying templates, all template categories are enabled regardless of their individual flag settings. This provides users with complete visibility into available templates during listing operations, which aligns perfectly with the expected behavior for the -tl and -td flags.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ehsandeep ehsandeep merged commit 44eeb5a into dev Aug 16, 2025
20 checks passed
@ehsandeep ehsandeep deleted the 6160_enable_all_templates_for_tl_td branch August 16, 2025 20:20
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.

do not validate protocol

2 participants