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

Refactor Task List and filters with error handlers for Scheduler #1957

Merged
merged 105 commits into from
Jul 11, 2024

Conversation

Rieven
Copy link
Contributor

@Rieven Rieven commented Oct 23, 2023

Changes

Task list can be found at:

  • "Tasks" in main menu

  • OOI detail page

  • Boefje Detail page

  • When scheduler client is offline, throw a ConnectionError and catch it to show message in rocky.

  • Add more task details for when task fetching fails/success, or (re)scheduling task fails, or get task failures. (plugin + OOI)

Issue link

#1955

Closes #1955

How's everything related?

sequenceDiagram
    SchedulerView->>+SchedulerClient: Get task list
    SchedulerClient->>+Scheduler: Get task list
    Scheduler->>+SchedulerClient: throws: ConnectError, HTTPError, etc..
    SchedulerClient->>+SchedulerView: Django message
    SchedulerView->>+SchedulerClient: Schedule task
    SchedulerClient->>+Scheduler: Schedule task
    Scheduler->>+SchedulerClient: throws: ConnectError, HTTPError, etc..
    SchedulerClient->>+SchedulerView: Django message
    SchedulerView->>+SchedulerClient: Re-schedule task
    SchedulerClient->>+Scheduler: Re-schedule task
    Scheduler->>+SchedulerClient: throws: ConnectError, HTTPError, etc..
    SchedulerClient->>+SchedulerView: Django message
    SchedulerView->>+SchedulerClient: Run Boefje
    SchedulerClient->>+Scheduler: Run Boefje
    Scheduler->>+SchedulerClient: throws: ConnectError, HTTPError, etc..
    SchedulerClient->>+SchedulerView: Django message
    SchedulerView->>+SchedulerClient: Run Normalizer
    SchedulerClient->>+Scheduler: Run Normalizer
    Scheduler->>+SchedulerClient: throws: ConnectError, HTTPError, etc..
    SchedulerClient->>+SchedulerView: Django message
    
Loading

Proof

Errors will be redirected to the health page:
image

Code Checklist

  • All the commits in this PR are properly PGP-signed and verified;
  • This PR only contains functionality relevant to the issue; tickets have been created for newly discovered issues.
  • I have written unit tests for the changes or fixes I made.
  • For any non-trivial functionality, I have added integration and/or end-to-end tests.
  • I have performed a self-review of my code and refactored it to the best of my abilities.

Communication

  • I have informed others of any required .env changes files if required and changed the .env-dist accordingly.
  • I have made corresponding changes to the documentation, if necessary.

Checklist for code reviewers:

Copy-paste the checklist from the docs/source/templates folder into your comment.


Checklist for QA:

Copy-paste the checklist from the docs/source/templates folder into your comment.

@Rieven Rieven requested a review from a team as a code owner October 23, 2023 15:12
Copy link
Contributor

@ammar92 ammar92 left a comment

Choose a reason for hiding this comment

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

Can be improved. Tests are failing, and there are errors in return types. Moreover, there is a mix of type annotation styles (e.g. Optional[None] vs ... | None), so these should be rewritten to keep consistency.

rocky/rocky/scheduler.py Outdated Show resolved Hide resolved
rocky/rocky/scheduler.py Outdated Show resolved Hide resolved
rocky/rocky/scheduler.py Outdated Show resolved Hide resolved
rocky/rocky/scheduler.py Outdated Show resolved Hide resolved
rocky/rocky/scheduler.py Outdated Show resolved Hide resolved
rocky/rocky/scheduler.py Outdated Show resolved Hide resolved
rocky/rocky/scheduler.py Outdated Show resolved Hide resolved
rocky/rocky/scheduler.py Outdated Show resolved Hide resolved
rocky/rocky/scheduler.py Outdated Show resolved Hide resolved
rocky/rocky/scheduler.py Outdated Show resolved Hide resolved
@stephanie0x00
Copy link
Contributor

Checklist for QA:

  • I have checked out this branch, and successfully ran a fresh make reset.
  • I confirmed that there are no unintended functional regressions in this branch:
    • I have managed to pass the onboarding flow
    • Objects and Findings are created properly
    • Tasks are created and completed properly
  • I confirmed that the PR's advertised feature or hotfix works as intended.

What works:

Error message is shown on the Tasks, Health checks, when opening a finding object, and on the 'See Details' page in the Katalogus. When enabling the scheduler again the error message disappears again.

What doesn't work:

n/a

Bug or feature?:

n/a

@stephanie0x00
Copy link
Contributor

During QA the following issues were identified:

  • DnsRecords boefje details page in Katalogus misses some data. A similar thing is happening for Dnssec and nmap TCP boefjes.
  • Normalizer template file removed from PR, which prevents various detail pages from loading.

DnsRecords boefje details page in this branch:

image

On main:
image

Template file removed from PR

image

@stephanie0x00
Copy link
Contributor

stephanie0x00 commented Jul 10, 2024

From QA perspective it looks good now. The pages that were not properly loading in the katalogus now work again. Can be merged after Review has approved the changes.

@Rieven
Copy link
Contributor Author

Rieven commented Jul 10, 2024

From QA perspective it looks good now. The pages that were not properly loading in the katalogus now work again. Can be merged after Review has approved the changes.

One little thing I am fixing now is that the normalizer detail page is not showing the task list, but this I am fixing now, thanks!

@underdarknl underdarknl dismissed ammar92’s stale review July 11, 2024 14:00

hanging change request

@underdarknl underdarknl merged commit 0d6389a into main Jul 11, 2024
11 checks passed
@underdarknl underdarknl deleted the fix-more-scheduler-error-handling branch July 11, 2024 14:00
jpbruinsslot added a commit that referenced this pull request Jul 16, 2024
* main: (31 commits)
  Refactor Task List and filters with error handlers for Scheduler  (#1957)
  Fix filtering on plugin_id for normalizers (#3226)
  Implement `structlog` (#3175)
  Gather BIT metrics [implementation] (#3122)
  Add observation data to observation table in OOI detail page (#3186)
  cve-2024-6387 from RickGeex (#3194)
  Recalculate bit when a config object changes (#3206)
  Use more concise regexes (#3181)
  Updated Django (#3217)
  Updated `zipp` (#3215)
  Feature/boefje normalizer config models (#3118)
  Updated `certifi` (#3209)
  Add pluginToggler.js to Aggregate Report (#3202)
  Update to Django 5.0 (#2939)
  Update Dockerfile, fix Sonarcloud issue (#3180)
  Better default list of world writable domains in CSP checker (#3165)
  Update 1.16 release notes (#3195)
  Remove non standard header findings and add deprecated headers findings (#3127)
  Fix/sonarcloud https redirect dockerfiles (#3185)
  Bump docker/build-push-action from 5 to 6 (#3164)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

More Scheduler Error handling from Rocky with more task details
7 participants