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

Boefje variant json schema contains lot of null values #3569

Closed
stephanie0x00 opened this issue Sep 23, 2024 · 1 comment · Fixed by #3574
Closed

Boefje variant json schema contains lot of null values #3569

stephanie0x00 opened this issue Sep 23, 2024 · 1 comment · Fixed by #3574
Assignees
Labels
backend bug Something isn't working

Comments

@stephanie0x00
Copy link
Contributor

stephanie0x00 commented Sep 23, 2024

Describe the bug
During the QA of #3557 it appeared that the API used by the boefje variants does something silly with/near the JSON schema.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Nmap TCP boefje and create a variant.
  2. Observe that the JSON schema contains a lot of 'null' values.
  3. Open the newly created boefje variant in the Katalogus.
  4. Observe that the settings page 'exploded' with variables.
  5. Running the boefje variant results in an error. The output from raw is posted below.

Expected behavior
The JSON schema for the nmap options should be displayed on the katalogus page.

Screenshots
JSON schema when creating a new boefje variant:
image

Viewing this new boefje variant in the katalogus:
image

OpenKAT version
main

Contents RAW file

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/app/oci_adapter.py", line 46, in <module>
    main()
  File "/app/oci_adapter.py", line 13, in main
    boefje_input = httpx.get(input_url).json()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_models.py", line 766, in json
    return jsonlib.loads(self.content, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
@stephanie0x00 stephanie0x00 added bug Something isn't working backend labels Sep 23, 2024
@underdarknl
Copy link
Contributor

It looks like this is a regression due to @ammar92 's migration of some fieldnames / or should be fixed by the migration.
What you are seeing here is the Internal Pydantic Schema of the Boefje, not the boefjes JsonSchema as defined in our plugin itself.
I think we made an error in merging #3557

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants