Skip to content

Commit

Permalink
Fix funding policy compliance check false positive
Browse files Browse the repository at this point in the history
  • Loading branch information
arkid15r committed Sep 5, 2024
1 parent 509a033 commit 92057bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion backend/apps/github/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ def check_funding_policy_compliance(platform, target):
if platform == "github":
return target.lower() == "owasp"
if platform == "custom":
return urlparse(target).netloc.lower() == "owasp.org"
location = urlparse(target).netloc.lower()
owasp_org = "owasp.org"
return location == owasp_org or location.endswith(f".{owasp_org}")

return False

Expand Down
3 changes: 2 additions & 1 deletion backend/tests/github/utils_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
("platform", "target", "as_expected"),
[
# Compliant
("custom", "https://domain.owasp.org/sponsorship/", True),
("custom", "https://owasp.org/donate", True),
("github", "owasp", True),
("github", "OWASP", True),
("custom", "https://owasp.org/donate", True),
# Non-compliant
("custom", "https://my-site.com/donate", False),
("custom", "https://my-site.com/owasp/donate", False),
Expand Down

0 comments on commit 92057bc

Please sign in to comment.