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

ZAP parser: do not resolve hostname to IP address during endpoint creation (#2284) #2286

Merged
merged 1 commit into from
Oct 10, 2020

Conversation

AlexanderTyutin
Copy link
Contributor

#2284

ZAP Parser:

  • disabled fqdn to ip resolving;
  • changed main endpoint visualization from IPport to scheme://fqdn:port

@valentijnscholten
Copy link
Member

I think it's a good improvement, but I am wondering if we should make it optional to use the old behaviour? Someone has experience with ZAP scans/imports? Changing endpoint value may also impact dedupe.

@AlexanderTyutin
Copy link
Contributor Author

AlexanderTyutin commented Apr 29, 2020

@valentijnscholten Any way except creating new scanner entry like "ZAP Scan with Hostnames"?
We can think about adding a parameter "use_hostnames" with default value "false" if not set, for example. But it will take more efforts I think.
Also really this PR doesn't change the behavior if there was an IP address used as host address.

So, it your target was https://10.0.0.1:8443 you will have exactly the same endpoint. I just removed enforcing of converting from hostname to ip address. I.e. the endpoint is just a real from the report (now endpoint is changing from original by importing tool).

I think this option (to resolve hostname) was useful for the company who wrote this import in 2013 (see the copyright note). But it is obsoleted now.

@AlexanderTyutin
Copy link
Contributor Author

AlexanderTyutin commented Apr 29, 2020

Just look: with this fix we have clear value of the endpoint while without it we have something like XX.XXX.XXX.XXXYYYY (X - IP address, Y - port number)

image

And today having XX.XXX.XXX.XXXXYYYY is not so useful as 7 years ago because one ip is used for many sites (thanks virtual hosts parameter :) )

@valentijnscholten
Copy link
Member

I think it would have to be a setting in settings.py. But you may be right that it is not needed. I have no experience with endpoints at all, so I'll have to leave it to others to decide.

@AlexanderTyutin
Copy link
Contributor Author

AlexanderTyutin commented Apr 29, 2020

A new challenge to learn DefectDojo closer :-D 👍 Really I forgot about settings.py

@mtesauro
Copy link
Contributor

I've only used endpoints a bit - typically they're not as important as the product name + test environment especially for AppSec work.

That said, I think it's a good idea to default to this behaviour (not resolving hostnames to IPs) and to put an boolean in settings.py for those that really want the previous style of behaviour. Heck, you can control how this works by using the IP or hostname in Zap so it's upstream of DD's import.

TBH, when I've needed/wanted to change the behaviour of a scanner's import, I've just written either a pre or post importing tools that either changes the file before importing or updated findings using the API - so those options will still exist after this PR is merged for those that have special reasons to save scanner data stored in a certain way.

Copy link
Collaborator

@madchap madchap left a comment

Choose a reason for hiding this comment

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

Based on @mtesauro's feedback, a small flag in settings.dist.py to dictate the behavior as well as the needed logic in code would probably be best and suit everyone.

@AlexanderTyutin
Copy link
Contributor Author

AlexanderTyutin commented May 6, 2020

Thanks, @mtesauro @madchap. Will try :)

@valentijnscholten
Copy link
Member

@mtesauro @devGregA I suggest we go with this PR and remove the DNS resolution stuff as it seems out of place anyway. No other scanner importer does this. So no settings flag for the old behaviour, just remove it. WDYT?

Copy link
Contributor

@Maffooch Maffooch left a comment

Choose a reason for hiding this comment

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

Agreed that removing this the host resolving is a good move. Since the user can choose either the host or IP at the ZAP level then there is no need to force it here.

@valentijnscholten valentijnscholten merged commit 035a380 into DefectDojo:dev Oct 10, 2020
@valentijnscholten
Copy link
Member

2 approvals

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants