8000 fix: prod optimizations (GCS ValueError, dynamic profile for fuzzers with big wordlists) by ocervell · Pull Request #707 · freelabz/secator · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: prod optimizations (GCS ValueError, dynamic profile for fuzzers with big wordlists) #707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 25, 2025

Conversation

ocervell
Copy link
Contributor
@ocervell ocervell commented Jun 25, 2025

Summary by CodeRabbit

  • New Features
    • Added a dynamic profiling feature to the HTTP Fuzzer tool, which automatically selects a profile type based on the wordlist size.
  • Improvements
    • Enhanced duplicate tagging in MongoDB with an option to perform a full scan or only scan untagged findings.
    • Improved Google Cloud Storage uploads for better reliability and updated status messages.
  • Bug Fixes
    • Adjusted MongoDB-related operations to only run within Celery worker processes, preventing unintended behavior in other contexts.
  • Chores
    • Updated build configuration to use new versioning and flavor settings for Docker images.

Copy link
Contributor
coderabbitai bot commented Jun 25, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update modifies the Cloud Build configuration to use different substitution values, tightens MongoDB-related logic in Celery tasks to execute only within worker processes, changes the GCS upload method to use file objects, adds a full_scan parameter to MongoDB duplicate tagging, and introduces a dynamic profiling method in the HTTP fuzzer category.

Changes

File(s) Change Summary
cloudbuild.yaml Changed _VERSION from latest to dev, _FLAVOR from lite to full, updated image tag, minor formatting.
secator/celery.py MongoDB logic now gated by IN_CELERY_WORKER_PROCESS in relevant functions.
secator/hooks/gcs.py Changed GCS upload to use file object with upload_from_file; updated log message.
secator/hooks/mongodb.py Added full_scan parameter to tag_duplicates for conditional querying of findings.
secator/tasks/_categories.py Added static method dynamic_profile and profile attribute to HttpFuzzer class.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant HttpFuzzer

    User->>HttpFuzzer: Call profile(opts)
    HttpFuzzer->>HttpFuzzer: dynamic_profile(opts)
    HttpFuzzer->>HttpFuzzer: Determine wordlist size
    alt size > 5 MB
        HttpFuzzer-->>User: Return "cpu"
    else size <= 5 MB
        HttpFuzzer-->>User: Return "io"
    end
Loading

Possibly related PRs

Poem

A bunny with code on its mind,
Tweaked builds and checks, all aligned.
Mongo only hops in the right Celery den,
GCS blobs upload with a pen.
Fuzzers now pick their clever style—
With every commit, we hop in style!
🐇✨


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
🪧 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.

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.

Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
secator/tasks/_categories.py (1)

99-99: Consider using a static method call instead of lambda.

While the lambda function works, a direct static method call would be more readable and avoid the lambda anti-pattern.

-	profile = lambda opts: HttpFuzzer.dynamic_profile(opts)  # noqa: E731
+	profile = staticmethod(lambda opts: HttpFuzzer.dynamic_profile(opts))

Or better yet, use a property-like approach if the framework supports it.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f7c1e7c and 5451b48.

📒 Files selected for processing (5)
  • cloudbuild.yaml (1 hunks)
  • secator/celery.py (3 hunks)
  • secator/hooks/gcs.py (1 hunks)
  • secator/hooks/mongodb.py (1 hunks)
  • secator/tasks/_categories.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: integration (3.11, ubuntu-latest)
🔇 Additional comments (6)
cloudbuild.yaml (1)

11-12: Verify the intended deployment target.

The substitution values have been changed from production-ready (latest/lite) to development-oriented (dev/full). Ensure this aligns with the intended deployment target and that production builds continue to use appropriate values.

secator/hooks/gcs.py (1)

45-50: LGTM! Good fix for potential GCS upload issues.

The changes from upload_from_filename() to upload_from_file() with explicit file handling address potential ValueError issues with GCS uploads. The explicit seek(0) ensures the file pointer is at the beginning, and using binary mode ('rb') is appropriate for file uploads. The updated log message is also more accurate.

secator/hooks/mongodb.py (1)

161-177: LGTM! Good enhancement to duplicate tagging flexibility.

The addition of the full_scan parameter provides useful flexibility for duplicate tagging operations. The implementation correctly applies the _tagged filter only when full_scan is False, allowing for both incremental (default) and comprehensive duplicate checking. The parameter documentation is clear and the default value is appropriate.

secator/celery.py (3)

243-243: LGTM! Proper gating of MongoDB operations to worker processes.

The addition of IN_CELERY_WORKER_PROCESS checks ensures MongoDB operations only execute within appropriate Celery worker contexts. This prevents potential issues with MongoDB hooks running in non-worker environments and maintains consistency with the distributed processing model.


275-275: LGTM! Consistent worker process gating.

The MongoDB result retrieval and UUID extraction logic is correctly gated to only run within Celery worker processes, maintaining consistency with the other MongoDB operations in this file.

Also applies to: 281-281


303-303: LGTM! Consistent MongoDB operation gating.

The MongoDB operations in the completion handler are properly gated to worker processes, completing the consistent pattern established throughout the file.

Also applies to: 309-309

@ocervell ocervell merged commit bcd6024 into main Jun 25, 2025
12 checks passed
@ocervell ocervell deleted the dalfox-main-check branch June 25, 2025 14:38
ocervell added a commit that referenced this pull request Jun 25, 2025
🤖 I have created a release *beep* *boop*
---


##
[0.16.5](v0.16.4...v0.16.5)
(2025-06-25)


### Bug Fixes

* **celery:** pass mongodb uuids when enabled
([#701](#701))
([64b43e8](64b43e8))
* **ci:** add apt update in ci
([261d1e8](261d1e8))
* prod optimizations (GCS ValueError, dynamic profile for fuzzers with
big wordlists) ([#707](#707))
([bcd6024](bcd6024))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

1 participant
0