Skip to content

Commit e39cd9e

Browse files
committed
Use official OWASP cheat sheet URLs in importer branches
1 parent a05310f commit e39cd9e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

application/utils/external_project_parsers/parsers/cheatsheets_parser.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
class Cheatsheets(ParserInterface):
1717
name = "OWASP Cheat Sheets"
18+
cheatsheetseries_base_url = "https://cheatsheetseries.owasp.org/cheatsheets"
1819

1920
def cheatsheet(
2021
self, section: str, hyperlink: str, tags: List[str]
@@ -33,6 +34,10 @@ def cheatsheet(
3334
hyperlink=hyperlink,
3435
)
3536

37+
def official_cheatsheet_url(self, markdown_filename: str) -> str:
38+
html_name = os.path.splitext(markdown_filename)[0] + ".html"
39+
return f"{self.cheatsheetseries_base_url}/{html_name}"
40+
3641
def parse(self, cache: db.Node_collection, ph: prompt_client.PromptHandler):
3742
c_repo = "https://github.com/OWASP/CheatSheetSeries.git"
3843
cheatsheets_path = "cheatsheets/"
@@ -65,7 +70,7 @@ def register_cheatsheets(
6570
name = title.group("title")
6671
cre_id = cre.group("cre")
6772
cres = cache.get_CREs(external_id=cre_id)
68-
hyperlink = f"{repo_path.replace('.git','')}/tree/master/{cheatsheets_path}{mdfile}"
73+
hyperlink = self.official_cheatsheet_url(mdfile)
6974
cs = self.cheatsheet(section=name, hyperlink=hyperlink, tags=[])
7075
for cre in cres:
7176
cs.add_link(

0 commit comments

Comments
 (0)