Skip to content
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

tasks from different organization visible in Rocky on task list for boefje #4095

Closed
underdarknl opened this issue Feb 17, 2025 · 4 comments
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@underdarknl
Copy link
Contributor

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  • do scans in first org
  • Create second org
  • Go to boefjes detail page, and notice jobs from first orga listed in second org

Expected behavior
Not seeing jobs from other orga's.

Screenshots

Image

OpenKAT version
Main, after scheduler merge.

Additional context
Add any other context about the problem here.

@underdarknl underdarknl added the bug Something isn't working label Feb 17, 2025
@underdarknl underdarknl added this to the OpenKAT v1.19 milestone Feb 17, 2025
@underdarknl underdarknl added this to KAT Feb 17, 2025
@github-project-automation github-project-automation bot moved this to Incoming features / Need assessment in KAT Feb 17, 2025
@jpbruinsslot
Copy link
Contributor

Seems likely that the following needs to be amended filtering on organisation id:

def get_task_filters(self) -> dict[str, Any]:
return {
"scheduler_id": self.scheduler_id,
"task_type": self.task_type,
"plugin_id": None, # plugin_id present and set at plugin detail
**self.get_task_filter_form_data(),
} | self.get_organization_specific_tasks()

@underdarknl
Copy link
Contributor Author

Checking the request, the organization code is correctly visible in the filer clause send to the scheduler.
I believe the problem lies in

specifically the lines that update the Dict made on line

f_req = filters or storage.filters.FilterRequest(filters={})

Because the Dict with the organisation filter is updated on line

f_req.filters.update(f_plugin) # type: ignore

Only the last applied filter remains. This explains why the general task list works corectly, but the ooi and boefje tasks lists drop the organization filter.

The filters should probable be accumulated in a list instead of a Dict with just two possible keywords (and / or )

@underdarknl underdarknl moved this from Incoming features / Need assessment to Backlog / To do in KAT Feb 18, 2025
@jpbruinsslot
Copy link
Contributor

This will happen when a combination of the (deprecated) queryparams input_ooi and/ plugin_id is used in combination with payload filters. This worked before because the queryparameter scheduler_id was formatted with an organisation id.

I recommend updating the rocky code to move the input_ooi and plugin_id queryparameter filtering into the payload filters and removing the deprecated code in the scheduler.

@underdarknl
Copy link
Contributor Author

We could also just remove the deprecated special casing and upgrade Rocky to not use those two vars anymore.

@underdarknl underdarknl assigned Rieven and unassigned jpbruinsslot Feb 19, 2025
@Rieven Rieven moved this from Backlog / To do to In Progress in KAT Feb 20, 2025
@underdarknl underdarknl moved this from In Progress to Ready for merge in KAT Feb 20, 2025
@github-project-automation github-project-automation bot moved this from Ready for merge to Done in KAT Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

4 participants