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 KATalogus client in Rocky #3717

Merged
merged 27 commits into from
Nov 12, 2024
Merged

Conversation

Donnype
Copy link
Contributor

@Donnype Donnype commented Oct 23, 2024

Changes

  • Handles client errors generically in a base client that can be organization-agnostic for some methods.
  • Introduces a new intermediate "adapter" called KATalogus that forces you to set an organization.

Issue link

Closes #3697

Demo

QA notes

Please verify that we can still properly create organizations, add plugins, settings and enable/disable them from Rocky!


Code Checklist

  • All the commits in this PR are properly PGP-signed and verified.

  • This PR only contains functionality relevant to the issue.

  • I have written unit tests for the changes or fixes I made.

  • I have checked the documentation and made changes where necessary.

  • I have performed a self-review of my code and refactored it to the best of my abilities.

  • For any non-trivial functionality, I have added integration and/or end-to-end tests.

  • I have included comments in the code to elaborate on what is not self-evident from the code itself, including references to issues and discussions online, or implicit behavior of an interface.


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.

@Donnype Donnype requested a review from a team as a code owner October 23, 2024 09:35
@Donnype Donnype changed the title Chore/refactor rocky org clients Refactor KATalogus client in Rocky Oct 23, 2024
@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.
  • I checked the logs for errors and/or warnings and made issues where necessary

What works:

Adding multiple organisations, creating a plugin variant works.

What doesn't work:

See below.

Bug or feature?:

Disabling a plugin gives the following error in the logs. The UI says the plugin is disabled.

rocky-1  | [28/Oct/2024 12:04:52] "GET /static/dist/tabler-icons.c16e726d.woff2 HTTP/1.1" 304 0
rocky-1  | [28/Oct/2024 12:04:52] "GET /static/img/favicon.svg HTTP/1.1" 200 819
rocky-1  | Traceback (most recent call last):
rocky-1  |   File "/app/rocky/katalogus/client.py", line 152, in verify_response
rocky-1  |     response.raise_for_status()
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/httpx/_models.py", line 763, in raise_for_status
rocky-1  |     raise HTTPStatusError(message, request=request, response=self)
rocky-1  | httpx.HTTPStatusError: Client error '404 Not Found' for url 'http://katalogus:8000/v1/organisations/aa/plugins?ids=%7B%27dns-records%27%2C%20%27dns-sec%27%7D'
rocky-1  | For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
rocky-1  | 
rocky-1  | During handling of the above exception, another exception occurred:
rocky-1  | 
rocky-1  | Traceback (most recent call last):
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
rocky-1  |     response = get_response(request)
rocky-1  |                ^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
rocky-1  |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
rocky-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
rocky-1  |     return self.dispatch(request, *args, **kwargs)
rocky-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/mixins.py", line 109, in dispatch
rocky-1  |     return super().dispatch(request, *args, **kwargs)
rocky-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/views/generic/base.py", line 143, in dispatch
rocky-1  |     return handler(request, *args, **kwargs)
rocky-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/views/generic/base.py", line 226, in get
rocky-1  |     context = self.get_context_data(**kwargs)
rocky-1  |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/app/rocky/onboarding/views.py", line 307, in get_context_data
rocky-1  |     context["plugins"] = self.get_plugins()
rocky-1  |                          ^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/app/rocky/onboarding/views.py", line 273, in get_plugins
rocky-1  |     plugins = katalogus.get_plugins(ids=plugin_ids)  # type: ignore
rocky-1  |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/app/rocky/katalogus/client.py", line 300, in get_plugins
rocky-1  |     return self._katalogus_client.get_plugins(self._member.organization.code, **params)
rocky-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/app/rocky/katalogus/client.py", line 197, in get_plugins
rocky-1  |     response = self.session.get(f"/v1/organisations/{organization_code}/plugins", params=params)
rocky-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1066, in get
rocky-1  |     return self.request(
rocky-1  |            ^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 837, in request
rocky-1  |     return self.send(request, auth=auth, follow_redirects=follow_redirects)
rocky-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 926, in send
rocky-1  |     response = self._send_handling_auth(
rocky-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 954, in _send_handling_auth
rocky-1  |     response = self._send_handling_redirects(
rocky-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1011, in _send_handling_redirects
rocky-1  |     raise exc
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 994, in _send_handling_redirects
rocky-1  |     hook(response)
rocky-1  |   File "/app/rocky/katalogus/client.py", line 164, in verify_response
rocky-1  |     raise KATalogusNotAllowedError("Access to resource not allowed")
rocky-1  | katalogus.client.KATalogusNotAllowedError: <exception str() failed>
rocky-1  | 
rocky-1  | During handling of the above exception, another exception occurred:
rocky-1  | 
rocky-1  | Traceback (most recent call last):
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
rocky-1  |     response = get_response(request)
rocky-1  |                ^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/utils/deprecation.py", line 134, in __call__
rocky-1  |     response = response or self.get_response(request)
rocky-1  |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 57, in inner
rocky-1  |     response = response_for_exception(request, exc)
rocky-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 140, in response_for_exception
rocky-1  |     response = handle_uncaught_exception(
rocky-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 181, in handle_uncaught_exception
rocky-1  |     return debug.technical_500_response(request, *exc_info)
rocky-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/views/debug.py", line 69, in technical_500_response
rocky-1  |     html = reporter.get_traceback_html()
rocky-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/views/debug.py", line 428, in get_traceback_html
rocky-1  |     c = Context(self.get_traceback_data(), use_l10n=False)
rocky-1  |                 ^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/views/debug.py", line 417, in get_traceback_data
rocky-1  |     c["exception_value"] = str(self.exc_value)
rocky-1  |                            ^^^^^^^^^^^^^^^^^^^
rocky-1  | TypeError: __str__ returned non-string (type __proxy__)
rocky-1  | 
rocky-1  | During handling of the above exception, another exception occurred:
......
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 961, in render_annotated
rocky-1  |     return self.render(context)
rocky-1  |            ^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/template/defaulttags.py", line 326, in render
rocky-1  |     return nodelist.render(context)
rocky-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 1000, in render
rocky-1  |     return SafeString("".join([node.render_annotated(context) for node in self]))
rocky-1  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 1000, in <listcomp>
rocky-1  |     return SafeString("".join([node.render_annotated(context) for node in self]))
rocky-1  |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 961, in render_annotated
rocky-1  |     return self.render(context)
rocky-1  |            ^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/template/defaulttags.py", line 326, in render
rocky-1  |     return nodelist.render(context)
rocky-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 1000, in render
rocky-1  |     return SafeString("".join([node.render_annotated(context) for node in self]))
rocky-1  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 1000, in <listcomp>
rocky-1  |     return SafeString("".join([node.render_annotated(context) for node in self]))
rocky-1  |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 961, in render_annotated
rocky-1  |     return self.render(context)
rocky-1  |            ^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 1059, in render
rocky-1  |     output = self.filter_expression.resolve(context)
rocky-1  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/template/base.py", line 737, in resolve
rocky-1  |     new_obj = func(obj, *arg_vals)
rocky-1  |               ^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/template/defaultfilters.py", line 48, in _dec
rocky-1  |     first = str(first)
rocky-1  |             ^^^^^^^^^^
rocky-1  | TypeError: __str__ returned non-string (type __proxy__)
rocky-1  | [28/Oct/2024 12:05:09] "GET /en/onboarding/aa/step/setup-scan/select-plugins/?ooi=URL%7Cinternet%7Chttps%3A%2F%2Fmispo.es%
2F&report_type=dns-report HTTP/1.1" 500 59
rocky-1  | {"request": "GET /en/aa/", "user_agent": "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0", "event"
: "request_started", "user_id": 1, "ip": "172.30.0.1", "request_id": "38ea8f69-e524-42b1-8222-1f026fc22dca", "level": "info", "timest
amp": "2024-10-28T12:05:09.616660"}

@underdarknl underdarknl added the 😸 Review/QA feedback Review/QA feedback provided label Oct 30, 2024
…as this is the only place we can now delete organizations and the pre_delete signal should not be used for this.
# Conflicts:
#	rocky/account/mixins.py
#	rocky/katalogus/client.py
#	rocky/tools/models.py
return [parse_plugin(plugin) for plugin in response.json()]

def get_plugin(self, organization_code: str, plugin_id: str) -> Plugin:
response = self.session.get(f"/v1/organisations/{organization_code}/plugins/{quote(plugin_id)}")

Check notice

Code scanning / SonarCloud

Server-side requests should not be vulnerable to traversing attacks Low

Change this code to not construct the URL's path from user-controlled data. See more on SonarQube Cloud
Copy link
Contributor

Choose a reason for hiding this comment

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

We should quote or sanitize the organization_code in this url.
Better yet, we should provide this function only for an instance of the client bound to a user (and as such can check for the user's permissions for the requested orga), or do we also need this functionality at locations where we dont have a user?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the KATalogus wrapper serves this purpose, and I (currently) like this service-based design better than forcing backend-choosing-logic behind model specific methods. It would require us to either mock or juggle some global state in testing context (that Django gets away with because they put the necessary effort into managing it). Also: there is nothing preventing me from importing an Organization class, instantiate it with an arbitrary id string, and then access forbidden data through this object, just like there is nothing preventing you from using the "wrong" client and access the wrong data. In essence it's hence a design (pattern) choice, and I think the service-based approach has some advantages of which consistency with other services (e.g. Octopoes repositories, the Bytes implementation, the KATalogus) is not the least.

Perhaps a subsequent issue and discussion topic would be a good idea?

@Donnype
Copy link
Contributor Author

Donnype commented Nov 7, 2024

@stephanie0x00 I've made several changes at this point and cannot reproduce this. Perhaps you could retry this? I did notice the error refers to an onboarding endpoint?

@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.
  • I checked the logs for errors and/or warnings and made issues where necessary

What works:

Scanning seems to work, enabling/disabling plugins works too. Normalizers run.

What doesn't work:

  • Onboarding, see error below that is thrown when I want to save the clearance levels.

Bug or feature?:

n/a

cky-1  | [11/Nov/2024 07:53:03] "GET /static/img/kat_logo.png HTTP/1.1" 304 0
rocky-1  | [11/Nov/2024 07:53:03] "GET /static/dist/tabler-icons.c16e726d.woff2 HTTP/1.1" 304 0
rocky-1  | {"request": "POST /en/onboarding/aa/step/set-clearance-level/?ooi=URL%7Cinternet%7Chttps%3A%2F%2Fmispo.es%2F&report_type=dns-report", "user_agent": "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0", "event": "request_started", "request_id": "9e0ab706-a0f1-4471-aee8-ec955a810368", "ip": "172.30.0.1", "user_id": 1, "level": "info", "timestamp": "2024-11-11T07:53:04.850164"}
rocky-1  | {"event": "HTTP Request: GET http://octopoes_api/aa/tree?reference=URL%7Cinternet%7Chttps%3A%2F%2Fmispo.es%2F&depth=9&valid_time=2024-11-11%2007%3A53%3A04.887695%2B00%3A00 \"HTTP/1.1 200 OK\""}
rocky-1  | {"event": "HTTP Request: PUT http://octopoes_api/aa/scan_profiles?valid_time=2024-11-11%2007%3A53%3A04.938651%2B00%3A00 \"HTTP/1.1 200 OK\""}
rocky-1  | {"code": 302, "request": "POST /en/onboarding/aa/step/set-clearance-level/?ooi=URL%7Cinternet%7Chttps%3A%2F%2Fmispo.es%2F&report_type=dns-report", "event": "request_finished", "request_id": "9e0ab706-a0f1-4471-aee8-ec955a810368", "ip": "172.30.0.1", "user_id": 1, "organization_code": "aa", "level": "info", "timestamp": "2024-11-11T07:53:05.000488"}
rocky-1  | [11/Nov/2024 07:53:05] "POST /en/onboarding/aa/step/set-clearance-level/?ooi=URL%7Cinternet%7Chttps%3A%2F%2Fmispo.es%2F&report_type=dns-report HTTP/1.1" 302 0
rocky-1  | {"request": "GET /en/onboarding/aa/step/setup-scan/select-plugins/?ooi=URL%7Cinternet%7Chttps%3A%2F%2Fmispo.es%2F&report_type=dns-report", "user_agent": "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0", "event": "request_started", "request_id": "80a2efb1-a99e-498d-b1bc-1c60cc2af36e", "ip": "172.30.0.1", "user_id": 1, "level": "info", "timestamp": "2024-11-11T07:53:05.019389"}
rocky-1  | {"event": "HTTP Request: GET http://katalogus:8000/v1/organisations/aa/plugins?ids=%7B%27dns-records%27%2C%20%27dns-sec%27%7D \"HTTP/1.1 404 Not Found\""}
rocky-1  | {"code": 500, "request": "GET /en/onboarding/aa/step/setup-scan/select-plugins/?ooi=URL%7Cinternet%7Chttps%3A%2F%2Fmispo.es%2F&report_type=dns-report", "exc_info": true, "event": "request_failed", "request_id": "80a2efb1-a99e-498d-b1bc-1c60cc2af36e", "ip": "172.30.0.1", "user_id": 1, "organization_code": "aa", "level": "error", "timestamp": "2024-11-11T07:53:05.339516"}
rocky-1  | Traceback (most recent call last):
rocky-1  |   File "/app/rocky/katalogus/client.py", line 152, in verify_response
rocky-1  |     response.raise_for_status()
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/httpx/_models.py", line 763, in raise_for_status
rocky-1  |     raise HTTPStatusError(message, request=request, response=self)
rocky-1  | httpx.HTTPStatusError: Client error '404 Not Found' for url 'http://katalogus:8000/v1/organisations/aa/plugins?ids=%7B%27dns-records%27%2C%20%27dns-sec%27%7D'
rocky-1  | For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
rocky-1  | 
rocky-1  | During handling of the above exception, another exception occurred:
rocky-1  | 
rocky-1  | Traceback (most recent call last):
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
rocky-1  |     response = get_response(request)
rocky-1  |                ^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
rocky-1  |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
rocky-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
rocky-1  |     return self.dispatch(request, *args, **kwargs)
rocky-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/mixins.py", line 109, in dispatch
rocky-1  |     return super().dispatch(request, *args, **kwargs)
rocky-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/views/generic/base.py", line 143, in dispatch
rocky-1  |     return handler(request, *args, **kwargs)
rocky-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/django/views/generic/base.py", line 226, in get
rocky-1  |     context = self.get_context_data(**kwargs)
rocky-1  |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/app/rocky/onboarding/views.py", line 307, in get_context_data
rocky-1  |     context["plugins"] = self.get_plugins()
rocky-1  |                          ^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/app/rocky/onboarding/views.py", line 273, in get_plugins
rocky-1  |     plugins = katalogus.get_plugins(ids=plugin_ids)  # type: ignore
rocky-1  |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/app/rocky/katalogus/client.py", line 304, in get_plugins
rocky-1  |     return self._katalogus_client.get_plugins(self._member.organization.code, **params)
rocky-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/app/rocky/katalogus/client.py", line 201, in get_plugins
rocky-1  |     response = self.session.get(f"/v1/organisations/{organization_code}/plugins", params=params)
rocky-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1066, in get
rocky-1  |     return self.request(
rocky-1  |            ^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 837, in request
rocky-1  |     return self.send(request, auth=auth, follow_redirects=follow_redirects)
rocky-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 926, in send
rocky-1  |     response = self._send_handling_auth(
rocky-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 954, in _send_handling_auth
rocky-1  |     response = self._send_handling_redirects(
rocky-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1011, in _send_handling_redirects
rocky-1  |     raise exc
rocky-1  |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 994, in _send_handling_redirects
rocky-1  |     hook(response)
rocky-1  |   File "/app/rocky/katalogus/client.py", line 164, in verify_response
rocky-1  |     raise KATalogusNotAllowedError("Access to resource not allowed")
rocky-1  | katalogus.client.KATalogusNotAllowedError: <exception str() failed>

@Donnype
Copy link
Contributor Author

Donnype commented Nov 12, 2024

@stephanie0x00 (hopefully) fixed!

@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.
  • I checked the logs for errors and/or warnings and made issues where necessary

What works:

Looks good now. Onboarding works, can enable and disable boefjes and normalizers. Tasks are scheduled and complete. Findings are created. Generated a normal report and that works too.

What doesn't work:

n/a

Bug or feature?:

n/a

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
75.1% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@underdarknl underdarknl merged commit 01c5088 into main Nov 12, 2024
33 of 35 checks passed
@underdarknl underdarknl deleted the chore/refactor-rocky-org-clients branch November 12, 2024 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
😸 Review/QA feedback Review/QA feedback provided
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Refactor: Rocky KATalogus clients
4 participants