Skip to content

Commit 135514c

Browse files
authored
Merge pull request #12 from DavidCruciani/gharchive-inclusion
chg: [Readme] add some example for gharchive option
2 parents e5a3026 + 7ff9788 commit 135514c

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

README.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,109 @@ ploit|malicious|directory traversal |\bRCE\b|\bdos\b|\bXSRF \b|\bXSS\b|clickjack
228228
~~~
229229

230230

231+
232+
## Usage for the special gharchive option
233+
234+
~~~bash
235+
$ git-vuln-finder -gh ../tests/gharchive_test.json
236+
~~~
237+
238+
239+
240+
the value for the `gh` parameters need to be a json file, containing an array of each PushEvent you want to test.
241+
242+
~~~json
243+
[
244+
{
245+
"id": "19351512310",
246+
"type": "PushEvent",
247+
"actor": {
248+
"id": 32466128,
249+
"login": "DavidCruciani",
250+
"display_login": "DavidCruciani",
251+
"gravatar_id": "",
252+
"url": "https://api.github.com/users/DavidCruciani",
253+
"avatar_url": "https://avatars.githubusercontent.com/u/32466128?"
254+
},
255+
"repo": {
256+
"id": 424660123,
257+
"name": "ail-project/ail-feeder-gharchive",
258+
"url": "https://api.github.com/repos/ail-project/ail-feeder-gharchive"
259+
},
260+
"payload": {
261+
"push_id": 8628652926,
262+
"size": 1,
263+
"distinct_size": 1,
264+
"ref": "refs/heads/main",
265+
"head": "910ed71a2819546a3f3bcce1ebb9e3984a8c8d86",
266+
"before": "40a9ef5dc6b2add5184a0a58401bfe9058faa8df",
267+
"commits": [
268+
{
269+
"sha": "910ed71a2819546a3f3bcce1ebb9e3984a8c8d86",
270+
"author": {
271+
"email": "[email protected]",
272+
"name": "David Cruciani"
273+
},
274+
"message": "chg: [feeder] case sensitive",
275+
"distinct": true,
276+
"url": "https://api.github.com/repos/ail-project/ail-feeder-gharchive/commits/910ed71a2819546a3f3bcce1ebb9e3984a8c8d86"
277+
}
278+
]
279+
},
280+
"public": true,
281+
"created_at": "2021-12-15T16:06:43Z",
282+
"org": {
283+
"id": 62389074,
284+
"login": "ail-project",
285+
"gravatar_id": "",
286+
"url": "https://api.github.com/orgs/ail-project",
287+
"avatar_url": "https://avatars.githubusercontent.com/u/62389074?"
288+
}
289+
}
290+
]
291+
~~~
292+
293+
294+
295+
## Usage for import
296+
297+
If the goal is to import the module to use it, the method to call is `find_event`
298+
299+
~~~python
300+
from git_vuln_finder import find_event
301+
302+
for element in event:
303+
for i in range(0,len(element["payload"]["commits"])):
304+
all_potential_vulnerabilities, all_cve_found, found = find_event(element["payload"]["commits"][i], element)
305+
~~~
306+
307+
308+
309+
## Output with gharchive option
310+
311+
~~~json
312+
{
313+
"repo_name": "LeandroFChaves/gerenciador-alunos",
314+
"message": "[UI] - Ajustes no css da aplica\u00e7\u00e3o\n\n- Adicionado padding para a exibi\u00e7\u00e3o do conte\u00fado das p\u00e1ginas;\n- Alinhado os bot\u00f5es de a\u00e7\u00f5es dos forms a direita da table",
315+
"language": "pt",
316+
"commit-id": "73a1c68b520853198eaac199a41d141ee96dc64d",
317+
"author": "LeandroFChaves",
318+
"author-email": "[email protected]",
319+
"authored_date": "2021-10-01T03:00:07Z",
320+
"branches": "refs/heads/master",
321+
"pattern-selected": "(?i)(denial of service|\\bXXE\\b|remote code execution|\\bopen redirect|OSVDB|\\bvuln|\\bCVE\\b|\\bXSS\\b|\\bReDoS\\b|\\bNVD\\b|malicious|x\u2212frame\u2212options|attack|cross site|exploit|malicious|directory traversal|\\bRCE\\b|\\bdos\\b|\\bXSRF \\b|\\bXSS\\b|clickjack|session.fixation|hijack|\\badvisory|\\binsecure|security|\\bcross\u2212origin\\b|unauthori[z|s]ed|infinite loop)",
322+
"pattern-matches": [
323+
"dos"
324+
],
325+
"origin-github-api": "https://api.github.com/repos/LeandroFChaves/gerenciador-alunos/commits/73a1c68b520853198eaac199a41d141ee96dc64d",
326+
"state": "under-review"
327+
}
328+
~~~
329+
330+
331+
332+
333+
231334
# Running the tests
232335

233336
~~~bash

0 commit comments

Comments
 (0)