Add public_red option and enforce TLP search rules#2927
Add public_red option and enforce TLP search rules#2927doomedraven wants to merge 3 commits intomasterfrom
Conversation
Add a new public_red option to default web config and update perform_search to respect TLP/public_searches settings for non-privileged users. Construct user-specific filters for Elasticsearch and MongoDB searches so RED TLP tasks are hidden from other users unless public_red allows them (or the task belongs to the requesting user). Also adjust source field selection to respect an explicit projection and ensure the Mongo aggregation pipeline includes the same TLP/user_id filtering logic.
Summary of ChangesHello @doomedraven, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Cuckoo Sandbox web interface by adding a configuration option to manage the visibility of TLP:RED tasks in search results. It also enforces TLP search rules for non-privileged users, ensuring that sensitive tasks are only accessible to authorized personnel. The changes include modifications to both Elasticsearch and MongoDB search queries to incorporate user-specific filters. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request aims to control the visibility of TLP:RED tasks for non-privileged users by introducing a public_red configuration and updating Elasticsearch and MongoDB search queries. However, the implementation introduces several security vulnerabilities, including a potential Server-Side Request Forgery (SSRF), a race condition from global state mutation, broken access control in the MongoDB aggregation pipeline, a potential Denial of Service (DoS) in Elasticsearch search, and insecure SSL certificate verification. Furthermore, there is significant code duplication in user-based filter construction for Elasticsearch, and a bug in the MongoDB query logic for anonymous users that could lead to incorrect task visibility.
Add a new public_red option to default web config and update perform_search to respect TLP/public_searches settings for non-privileged users. Construct user-specific filters for Elasticsearch and MongoDB searches so RED TLP tasks are hidden from other users unless public_red allows them (or the task belongs to the requesting user). Also adjust source field selection to respect an explicit projection and ensure the Mongo aggregation pipeline includes the same TLP/user_id filtering logic.