@@ -30,7 +30,7 @@ def test_get_sast_source_file_path_with_link_and_source_code_management_uri(self
30
30
finding .test = test
31
31
finding .sast_source_file_path = 'SastSourceFilePath'
32
32
engagement .source_code_management_uri = 'URL'
33
- self .assertEqual ('<a href=\ " URL/SastSourceFilePath\ " target=\ " _blank\ " title=\ " SastSourceFilePath\ " >SastSourceFilePath</a>' , finding .get_sast_source_file_path_with_link ())
33
+ self .assertEqual ('<a href="URL/SastSourceFilePath" target="_blank" title="SastSourceFilePath">SastSourceFilePath</a>' , finding .get_sast_source_file_path_with_link ())
34
34
35
35
def test_get_file_path_with_link_no_file_path (self ):
36
36
finding = Finding ()
@@ -53,7 +53,7 @@ def test_get_file_path_with_link_and_source_code_management_uri(self):
53
53
finding .test = test
54
54
finding .file_path = 'FilePath'
55
55
engagement .source_code_management_uri = 'URL'
56
- self .assertEqual ('<a href=\ " URL/FilePath\ " target=\ " _blank\ " title=\ " FilePath\ " >FilePath</a>' , finding .get_file_path_with_link ())
56
+ self .assertEqual ('<a href="URL/FilePath" target="_blank" title="FilePath">FilePath</a>' , finding .get_file_path_with_link ())
57
57
58
58
def test_get_file_path_with_link_and_source_code_management_uri_github_no_scm_type_with_details_and_line (self ):
59
59
# checks that for github.com in uri dojo makes correct url to browse on github
@@ -68,7 +68,7 @@ def test_get_file_path_with_link_and_source_code_management_uri_github_no_scm_ty
68
68
finding .file_path = 'some-folder/some-file.ext'
69
69
finding .line = 5432
70
70
engagement .source_code_management_uri = 'https://github.com/some-test-account/some-test-repo'
71
- self .assertEqual ('<a href=\ " https://github.com/some-test-account/some-test-repo/blob/some-commit-hash/some-folder/some-file.ext#L5432" target=\ " _blank\ " title=\ " some-folder/some-file.ext\ " >some-folder/some-file.ext</a>' , finding .get_file_path_with_link ())
71
+ self .assertEqual ('<a href="https://github.com/some-test-account/some-test-repo/blob/some-commit-hash/some-folder/some-file.ext#L5432" target="_blank" title="some-folder/some-file.ext">some-folder/some-file.ext</a>' , finding .get_file_path_with_link ())
72
72
73
73
def test_get_file_path_with_link_and_source_code_management_uri_github_with_scm_type_with_details_and_line (self ):
74
74
# checks that for github in custom field dojo makes correct url to browse on github
@@ -92,7 +92,7 @@ def test_get_file_path_with_link_and_source_code_management_uri_github_with_scm_
92
92
finding .line = 5432
93
93
94
94
engagement .source_code_management_uri = 'https://github.com/some-test-account/some-test-repo'
95
- self .assertEqual ('<a href=\ " https://github.com/some-test-account/some-test-repo/blob/some-commit-hash/some-folder/some-file.ext#L5432" target=\ " _blank\ " title=\ " some-folder/some-file.ext\ " >some-folder/some-file.ext</a>' , finding .get_file_path_with_link ())
95
+ self .assertEqual ('<a href="https://github.com/some-test-account/some-test-repo/blob/some-commit-hash/some-folder/some-file.ext#L5432" target="_blank" title="some-folder/some-file.ext">some-folder/some-file.ext</a>' , finding .get_file_path_with_link ())
96
96
97
97
def test_get_file_path_with_link_and_source_code_management_uri_bitbucket_public_project_with_no_details_and_line (self ):
98
98
# checks that for public bitbucket (bitbucket.org) in custom field
@@ -115,7 +115,7 @@ def test_get_file_path_with_link_and_source_code_management_uri_bitbucket_public
115
115
finding .line = 5432
116
116
117
117
engagement .source_code_management_uri = 'https://bb.example.com/some-test-user/some-test-repo.git'
118
- self .assertEqual ('<a href=\ " https://bb.example.com/some-test-user/some-test-repo/src/master/some-folder/some-file.ext#lines-5432" target=\ " _blank\ " title=\ " some-folder/some-file.ext\ " >some-folder/some-file.ext</a>' , finding .get_file_path_with_link ())
118
+ self .assertEqual ('<a href="https://bb.example.com/some-test-user/some-test-repo/src/master/some-folder/some-file.ext#lines-5432" target="_blank" title="some-folder/some-file.ext">some-folder/some-file.ext</a>' , finding .get_file_path_with_link ())
119
119
120
120
def test_get_file_path_with_link_and_source_code_management_uri_bitbucket_public_project_with_commithash_and_line (self ):
121
121
# checks that for public bitbucket (bitbucket.org) in custom field and existing commit hash in finding
@@ -139,7 +139,7 @@ def test_get_file_path_with_link_and_source_code_management_uri_bitbucket_public
139
139
finding .line = 5432
140
140
141
141
engagement .source_code_management_uri = 'https://bb.example.com/some-test-user/some-test-repo.git'
142
- self .assertEqual ('<a href=\ " https://bb.example.com/some-test-user/some-test-repo/src/some-commit-hash/some-folder/some-file.ext#lines-5432" target=\ " _blank\ " title=\ " some-folder/some-file.ext\ " >some-folder/some-file.ext</a>' , finding .get_file_path_with_link ())
142
+ self .assertEqual ('<a href="https://bb.example.com/some-test-user/some-test-repo/src/some-commit-hash/some-folder/some-file.ext#lines-5432" target="_blank" title="some-folder/some-file.ext">some-folder/some-file.ext</a>' , finding .get_file_path_with_link ())
143
143
144
144
def test_get_file_path_with_link_and_source_code_management_uri_bitbucket_standalone_project_with_commithash_and_line (self ):
145
145
# checks that for standalone bitbucket in custom field and existing commit hash in finding
@@ -163,7 +163,7 @@ def test_get_file_path_with_link_and_source_code_management_uri_bitbucket_standa
163
163
finding .line = 5432
164
164
165
165
engagement .source_code_management_uri = 'https://bb.example.com/scm/some-test-project/some-test-repo.git'
166
- self .assertEqual ('<a href=\ " https://bb.example.com/projects/some-test-project/repos/some-test-repo/browse/some-folder/some-file.ext?at=some-commit-hash#5432" target=\ " _blank\ " title=\ " some-folder/some-file.ext\ " >some-folder/some-file.ext</a>' , finding .get_file_path_with_link ())
166
+ self .assertEqual ('<a href="https://bb.example.com/projects/some-test-project/repos/some-test-repo/browse/some-folder/some-file.ext?at=some-commit-hash#5432" target="_blank" title="some-folder/some-file.ext">some-folder/some-file.ext</a>' , finding .get_file_path_with_link ())
167
167
168
168
def test_get_file_path_with_link_and_source_code_management_uri_bitbucket_standalone_project_with_branchtag_and_line (self ):
169
169
# checks that for standalone bitbucket in custom field and existing branch/tag in finding
@@ -187,7 +187,7 @@ def test_get_file_path_with_link_and_source_code_management_uri_bitbucket_standa
187
187
finding .line = 5432
188
188
189
189
engagement .source_code_management_uri = 'https://bb.example.com/scm/some-test-project/some-test-repo.git'
190
- self .assertEqual ('<a href=\ " https://bb.example.com/projects/some-test-project/repos/some-test-repo/browse/some-folder/some-file.ext?at=some-branch#5432" target=\ " _blank\ " title=\ " some-folder/some-file.ext\ " >some-folder/some-file.ext</a>' , finding .get_file_path_with_link ())
190
+ self .assertEqual ('<a href="https://bb.example.com/projects/some-test-project/repos/some-test-repo/browse/some-folder/some-file.ext?at=some-branch#5432" target="_blank" title="some-folder/some-file.ext">some-folder/some-file.ext</a>' , finding .get_file_path_with_link ())
191
191
192
192
def test_get_file_path_with_link_and_source_code_management_uri_bitbucket_standalone_user_with_branchtag_and_line (self ):
193
193
# checks that for standalone bitbucket in custom field and existing branch/tag in finding
@@ -212,7 +212,7 @@ def test_get_file_path_with_link_and_source_code_management_uri_bitbucket_standa
212
212
213
213
engagement .source_code_management_uri = 'https://bb.example.com/scm/~some-user/some-test-repo.git'
214
214
215
- self .assertEqual ('<a href=\ " https://bb.example.com/users/some-user/repos/some-test-repo/browse/some-folder/some-file.ext?at=some-branch#5432" target=\ " _blank\ " title=\ " some-folder/some-file.ext\ " >some-folder/some-file.ext</a>' , finding .get_file_path_with_link ())
215
+ self .assertEqual ('<a href="https://bb.example.com/users/some-user/repos/some-test-repo/browse/some-folder/some-file.ext?at=some-branch#5432" target="_blank" title="some-folder/some-file.ext">some-folder/some-file.ext</a>' , finding .get_file_path_with_link ())
216
216
217
217
def test_get_file_path_with_link_and_source_code_management_uri_gitea_or_codeberg_project_with_no_details_and_line (self ):
218
218
# checks that for gitea and codeberg in custom field
@@ -235,7 +235,7 @@ def test_get_file_path_with_link_and_source_code_management_uri_gitea_or_codeber
235
235
finding .line = 5432
236
236
237
237
engagement .source_code_management_uri = 'https://bb.example.com/some-test-user/some-test-repo.git'
238
- self .assertEqual ('<a href=\ " https://bb.example.com/some-test-user/some-test-repo/src/master/some-folder/some-file.ext#L5432" target=\ " _blank\ " title=\ " some-folder/some-file.ext\ " >some-folder/some-file.ext</a>' , finding .get_file_path_with_link ())
238
+ self .assertEqual ('<a href="https://bb.example.com/some-test-user/some-test-repo/src/master/some-folder/some-file.ext#L5432" target="_blank" title="some-folder/some-file.ext">some-folder/some-file.ext</a>' , finding .get_file_path_with_link ())
239
239
240
240
def test_get_file_path_with_link_and_source_code_management_uri_gitea_or_codeberg_project_with_commithash_and_line (self ):
241
241
# checks that for gitea and codeberg in custom field and existing commit hash in finding
@@ -259,7 +259,7 @@ def test_get_file_path_with_link_and_source_code_management_uri_gitea_or_codeber
259
259
finding .line = 5432
260
260
261
261
engagement .source_code_management_uri = 'https://bb.example.com/some-test-user/some-test-repo.git'
262
- self .assertEqual ('<a href=\ " https://bb.example.com/some-test-user/some-test-repo/src/some-commit-hash/some-folder/some-file.ext#L5432" target=\ " _blank\ " title=\ " some-folder/some-file.ext\ " >some-folder/some-file.ext</a>' , finding .get_file_path_with_link ())
262
+ self .assertEqual ('<a href="https://bb.example.com/some-test-user/some-test-repo/src/some-commit-hash/some-folder/some-file.ext#L5432" target="_blank" title="some-folder/some-file.ext">some-folder/some-file.ext</a>' , finding .get_file_path_with_link ())
263
263
264
264
def test_get_file_path_with_xss_attack (self ):
265
265
test = Test ()
@@ -283,32 +283,32 @@ def test_get_references_with_links_no_links(self):
283
283
def test_get_references_with_links_simple_url (self ):
284
284
finding = Finding ()
285
285
finding .references = 'URL: https://www.example.com'
286
- self .assertEqual ('URL: <a href=\ " https://www.example.com\ " target=\ " _blank\ " title=\ " https://www.example.com\ " >https://www.example.com</a>' , finding .get_references_with_links ())
286
+ self .assertEqual ('URL: <a href="https://www.example.com" target="_blank" title="https://www.example.com">https://www.example.com</a>' , finding .get_references_with_links ())
287
287
288
288
def test_get_references_with_links_url_with_port (self ):
289
289
finding = Finding ()
290
290
finding .references = 'http://www.example.com:8080'
291
- self .assertEqual ('<a href=\ " http://www.example.com:8080\ " target=\ " _blank\ " title=\ " http://www.example.com:8080\ " >http://www.example.com:8080</a>' , finding .get_references_with_links ())
291
+ self .assertEqual ('<a href="http://www.example.com:8080" target="_blank" title="http://www.example.com:8080">http://www.example.com:8080</a>' , finding .get_references_with_links ())
292
292
293
293
def test_get_references_with_links_url_with_path (self ):
294
294
finding = Finding ()
295
295
finding .references = 'URL https://www.example.com/path/part2 behind URL'
296
- self .assertEqual ('URL <a href=\ " https://www.example.com/path/part2\ " target=\ " _blank\ " title=\ " https://www.example.com/path/part2\ " >https://www.example.com/path/part2</a> behind URL' , finding .get_references_with_links ())
296
+ self .assertEqual ('URL <a href="https://www.example.com/path/part2" target="_blank" title="https://www.example.com/path/part2">https://www.example.com/path/part2</a> behind URL' , finding .get_references_with_links ())
297
297
298
298
def test_get_references_with_links_complicated_url_with_parameter (self ):
299
299
finding = Finding ()
300
300
finding .references = 'URL:https://www.example.com/path?param1=abc&_param2=xyz'
301
- self .assertEqual ('URL:<a href=\ " https://www.example.com/path?param1=abc&_param2=xyz\ " target=\ " _blank\ " title=\ " https://www.example.com/path?param1=abc&_param2=xyz\ " >https://www.example.com/path?param1=abc&_param2=xyz</a>' , finding .get_references_with_links ())
301
+ self .assertEqual ('URL:<a href="https://www.example.com/path?param1=abc&_param2=xyz" target="_blank" title="https://www.example.com/path?param1=abc&_param2=xyz">https://www.example.com/path?param1=abc&_param2=xyz</a>' , finding .get_references_with_links ())
302
302
303
303
def test_get_references_with_links_two_urls (self ):
304
304
finding = Finding ()
305
305
finding .references = 'URL1: https://www.example.com URL2: https://info.example.com'
306
- self .assertEqual ('URL1: <a href=\ " https://www.example.com\ " target=\ " _blank\ " title=\ " https://www.example.com\ " >https://www.example.com</a> URL2: <a href=\ " https://info.example.com\ " target=\ " _blank\ " title=\ " https://info.example.com\ " >https://info.example.com</a>' , finding .get_references_with_links ())
306
+ self .assertEqual ('URL1: <a href="https://www.example.com" target="_blank" title="https://www.example.com">https://www.example.com</a> URL2: <a href="https://info.example.com" target="_blank" title="https://info.example.com">https://info.example.com</a>' , finding .get_references_with_links ())
307
307
308
308
def test_get_references_with_links_linebreak (self ):
309
309
finding = Finding ()
310
310
finding .references = 'https://www.example.com\n https://info.example.com'
311
- self .assertEqual ('<a href=\ " https://www.example.com\ " target=\ " _blank\ " title=\ " https://www.example.com\ " >https://www.example.com</a>\n <a href=\ " https://info.example.com\ " target=\ " _blank\ " title=\ " https://info.example.com\ " >https://info.example.com</a>' , finding .get_references_with_links ())
311
+ self .assertEqual ('<a href="https://www.example.com" target="_blank" title="https://www.example.com">https://www.example.com</a>\n <a href="https://info.example.com" target="_blank" title="https://info.example.com">https://info.example.com</a>' , finding .get_references_with_links ())
312
312
313
313
def test_get_references_with_links_markdown (self ):
314
314
finding = Finding ()
0 commit comments