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

🐛 fix issue #9201 #9202

Merged
merged 2 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions dojo/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import base64

Check warning on line 1 in dojo/models.py

View check run for this annotation

DryRunSecurity / Configured Sensitive Files Check

Sensitive File Edit

This file edit was detected to be sensitive according to the DryRun Security Configuration for this repository. Any edit to this file by an Author not in the allowedAuthors list will be considered sensitive.

Check warning on line 1 in dojo/models.py

View check run for this annotation

DryRunSecurity / Configured Sensitive Files Check

Sensitive File Edit

This file edit was detected to be sensitive according to the DryRun Security Configuration for this repository. Any edit to this file by an Author not in the allowedAuthors list will be considered sensitive.
import hashlib
import logging
import os
Expand Down Expand Up @@ -1815,9 +1815,12 @@
return bc

@staticmethod
def from_uri(uri):
try:
url = hyperlink.parse(url=uri)
except UnicodeDecodeError:
from urllib.parse import urlparse

Check warning on line 1822 in dojo/models.py

View check run for this annotation

DryRunSecurity / AI-powered Sensitive Function Check

Possible Sensitive Function

Our AI-Powered Sensitive Function checker believes it has discovered a sensitive function being modified in this PR. The name of the function is `get_breadcrumbs`. Extra care must be taken when modifying a function that is potentially security-sensitive. The following reason was provided for why this function was flagged as sensitive: Potential authentication function: This function may be used to check if the user is authenticated before retrieving breadcrumbs.
url = hyperlink.parse(url="//" + urlparse(uri).netloc)
except hyperlink.URLParseError as e:
raise ValidationError('Invalid URL format: {}'.format(e))

Expand Down
1 change: 1 addition & 0 deletions unittests/scans/nuclei/issue_9201.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"template":"technologies/favicon-detect.yaml","template-url":"https://github.com/projectdiscovery/nuclei-templates/blob/master/technologies/favicon-detect.yaml","template-id":"favicon-detect","template-path":"nuclei-templates/technologies/favicon-detect.yaml","info":{"name":"favicon-detection","author":["un-fmunozs","dhiyaneshdk"],"tags":["tech","favicon"],"reference":["https://twitter.com/brsn76945860/status/1171233054951501824","https://gist.github.com/yehgdotnet/b9dfc618108d2f05845c4d8e28c5fc6a","https://medium.com/@asm0d3us/weaponizing-favicon-ico-for-bugbounties-osint-and-what-not-ace3c214e139","https://github.com/devanshbatham/favfreak","https://github.com/sansatart/scrapts/blob/master/shodan-favicon-hashes.csv"],"severity":"info"},"matcher-name":"asp.net-favicon","type":"http","host":"https://example.com","matched-at":"https://example.com/favicon.ico%c0","ip":"10.10.10.10.","timestamp":"2023-03-13T11:05:07.373496332+03:00","curl-command":"curl -X 'GET' -d '' -H 'Accept: */*' -H 'Accept-Language: en' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2762.73 Safari/537.36' 'https://example.com/favicon.ico'","matcher-status":true,"matched-line":null}

Check warning on line 1 in unittests/scans/nuclei/issue_9201.json

View check run for this annotation

DryRunSecurity / AI-powered Sensitive Files Check

Possible Sensitive File

Our AI-Powered Sensitive File checker believes it has discovered a sensitive file being modified in this PR. Extra care must be taken when modifying a file that is potentially security-sensitive. The following reason was provided: Contains sensitive scan data
11 changes: 10 additions & 1 deletion unittests/tools/test_nuclei_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,24 @@
findings = parser.get_findings(testfile, Test())
self.assertEqual(0, len(findings))

def test_parse_issue_9201(self):
testfile = open("unittests/scans/nuclei/issue_9201.json")
parser = NucleiParser()
findings = parser.get_findings(testfile, Test())
self.assertEqual(1, len(findings))
for finding in findings:
for endpoint in finding.unsaved_endpoints:
endpoint.clean()
self.assertEqual("example.com", finding.unsaved_endpoints[0].host)

def test_parse_many_findings(self):
testfile = open("unittests/scans/nuclei/many_findings.json")

Check warning on line 33 in unittests/tools/test_nuclei_parser.py

View check run for this annotation

DryRunSecurity / AI-powered Sensitive Function Check

Possible Sensitive Function

Our AI-Powered Sensitive Function checker believes it has discovered a sensitive function being modified in this PR. The name of the function is `test_parse_issue_9201`. Extra care must be taken when modifying a function that is potentially security-sensitive. The following reason was provided for why this function was flagged as sensitive: Potential authentication function: This function may be used to parse and handle authentication-related findings.
parser = NucleiParser()
findings = parser.get_findings(testfile, Test())
testfile.close()
for finding in findings:
for endpoint in finding.unsaved_endpoints:
endpoint.clean()

self.assertEqual(16, len(findings))

with self.subTest(i=0):
Expand Down