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

Scope table not listing items #121

Closed
burtonc opened this issue Mar 26, 2023 · 10 comments
Closed

Scope table not listing items #121

burtonc opened this issue Mar 26, 2023 · 10 comments
Assignees
Labels
Bug Something isn't working

Comments

@burtonc
Copy link

burtonc commented Mar 26, 2023

Describe the bug
When reloading audit, scope items shows as [Object object].

To Reproduce
Steps to reproduce the behavior:

  1. Create an audit
  2. Add data in "scope" field
  3. Reload page
  4. See error

Expected behavior
Items filled in "scope" field should display their name instead of [Object object].

Screenshots
image

Environment (please complete the following information):

  • Tested on Firefox / Chrome

Additional context
Scope name display well in network view. It use to work well in previous version of pwndoc-ng.

@Zeecka Zeecka added the Bug Something isn't working label Mar 27, 2023
@Zeecka
Copy link
Member

Zeecka commented Mar 27, 2023

I can reproduce, I've got the same issue with original pwndoc too (I don't know if you can confirm).
This is a front-end issue only (it should display correctly in the repport). I'm looking for a fix but I'm not a Vue.js expert :') !

@burtonc
Copy link
Author

burtonc commented Mar 27, 2023

This issues has only recently appeared in my install, now running pwndoc-ng, original pwndoc install about 6 to 8 weeks old is not impacted

upon investigation the export to word shows the scope despite there UI not displaying it.

I’ve proxied the calls, there are 2 API responses returned on the page, first one responds wil scope correctly, second responds empty for scope hosts (I’ll update with my requests later as not in front of that machine)

@Zeecka
Copy link
Member

Zeecka commented Mar 27, 2023

It looks like we have a regression on the API side (I think it's due to a version bump). I'm currently checking if data is altered before insert or on query.

Test on API route

api/audits/<id>/general

Working version

{
    "status": "success",
    "datas": {
        "collaborators": [],
        "reviewers": [],
        "_id": "6421fdbfc56624001175598f",
        "name": "Test",
        "language": "fr",
        "auditType": "Web",
        "creator": {
            "_id": "6421fd80c56624001175598a",
            "username": "admin",
            "firstname": "admin",
            "lastname": "admin"
        },
        "customFields": [],
        "template": "6421fd8cc56624001175598c",
        "scope": [
            "aa",
            "bbb"
        ]
    }
}

Last version

{
    "status": "success",
    "datas": {
        "_id": "6421ff769522ee7a0971f8ae",
        "name": "fr",
        "auditType": "fr",
        "collaborators": [],
        "reviewers": [],
        "language": "fr",
        "template": "6421ff519522ee7a0971f877",
        "creator": {
            "_id": "6421ff379522ee7a0971f861",
            "username": "admin",
            "firstname": "admin",
            "lastname": "admin"
        },
        "customFields": [],
        "scope": [
            {
                "hosts": []
            },
            {
                "hosts": []
            }
        ]
    }
}

@Zeecka
Copy link
Member

Zeecka commented Mar 27, 2023

DB entry is the same on both version (which is coherent with the fact report generation and network section are working).

{
    "_id": ObjectId("64220c47778ed0b87cb5f705"),
    "name": "a",
    "auditType": "fr",
    "collaborators": [],
    "reviewers": [],
    "language": "fr",
    "template": ObjectId("64220c37778ed0b87cb5f6ed"),
    "creator": ObjectId("64220c2d778ed0b87cb5f6d7"),
    "sections": [],
    "customFields": [],
    "sortFindings": [],
    "state": "EDIT",
    "approvals": [],
    "scope": [
        {
            "name": "aa",
            "hosts": []
        },
        {
            "name": "bbb",
            "hosts": []
        }
    ],
    "findings": [],
    "createdAt": ISODate("2023-03-27T21:36:07.524Z"),
    "updatedAt": ISODate("2023-03-27T21:36:11.768Z"),
    "__v": 0
}

@Zeecka
Copy link
Member

Zeecka commented Mar 27, 2023

@burtonc
Copy link
Author

burtonc commented Mar 28, 2023

Confirmed the recent commit on pwndoc fixes the scope table issues

pwndoc/pwndoc@ed86a7f

@burtonc burtonc closed this as completed Mar 28, 2023
@diggidong
Copy link

Unfortunately this does not fix it on my side.
I am on the latest pwndoc-ng master branch.
It renders right when exporting,
but the web app still does have issues with it.
If I reopen a report and it shows [object Object], I am also not able to save it, because of the error:
Cast to embedded failed for value "{ name: { hosts: [] } }" (type Object) at path "scope" because of "CastError"

image

@burtonc
Copy link
Author

burtonc commented Mar 29, 2023

i'm using the latest pwndoc-ng and replaced the files updated in the pwndoc commit to evidence that this seems to be working. I'm sure one the commit is pulled into pwndoc-ng things will be sorted.

image

@diggidong
Copy link

yeah, but if that hasn't been fixed yet in the main branch intself, then pls don't close that bug issue.

@Zeecka Zeecka reopened this Mar 29, 2023
@Zeecka
Copy link
Member

Zeecka commented Mar 30, 2023

Fixed with #135

@Zeecka Zeecka closed this as completed Mar 30, 2023
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
None yet
Development

No branches or pull requests

4 participants