Skip to content

Commit f6c68e0

Browse files
authored
Merge pull request #437 from kac89/dev
add owasp top 10 mobile 2024
2 parents dccf8ef + bffdf94 commit f6c68e0

8 files changed

+296
-14
lines changed

package-lock.json

+27-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"core-js": "^3.39.0",
2929
"crypto-js": "^4.1.1",
3030
"docx": "^8.5.0",
31-
"dompurify": "^3.1.6",
31+
"dompurify": "^3.2.2",
3232
"events": "^3.2.0",
3333
"gulp-clone": "^2.0.1",
3434
"highlight.js": "^11.10.0",

src/app/dialog-addissue/dialog-addissue.component.html

+33-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<mat-form-field appearance="outline" color="accent" class="example-full-width">
1313
<mat-label>Templates source</mat-label>
1414
<mat-select [(value)]="sourceSelect" (selectionChange)="changeselect()">
15-
<mat-option value="VULNREPO">VULNRΞPO</mat-option>
15+
<mat-option value="VULNREPO"><img with="20" height="20" src="/favicon-32x32.png"> VULNRΞPO</mat-option>
1616
<mat-option value="CVE"><mat-icon color="accent">public</mat-icon> CVE (ONLINE Database)</mat-option>
1717
<mat-option value="CWE">CWE Research Concepts</mat-option>
1818
<mat-option value="MENTERPRISE">MITRE ATT&CK Enterprise</mat-option>
@@ -22,6 +22,7 @@
2222
<mat-option value="OWASPTOP2017">OWASP Top 10 2017 Web Application Security Risks</mat-option>
2323
<mat-option value="OWASPTOP10CICD">OWASP Top 10 CI/CD Security Risks</mat-option>
2424
<mat-option value="OWASPTOP10k8s">OWASP Kubernetes Top 10</mat-option>
25+
<mat-option value="OWASP_mobile">OWASP Mobile Top 10 2024</mat-option>
2526
</mat-select>
2627
</mat-form-field>
2728
</div>
@@ -227,6 +228,36 @@
227228
<span fxLayoutAlign="flex-end"><small><a class="active-link" target="_blank" href="https://owasp.org/www-project-kubernetes-top-ten/">owasp.org</a></small></span>
228229
</div>
229230

231+
<div *ngIf="sourceSelect == 'OWASP_mobile'">
232+
<mat-form-field class="example-full-width" color="accent">
233+
<mat-label>OWASP Mobile Top 10 2024</mat-label>
234+
235+
<mat-chip-grid #mobilechipGrid aria-label="Issue title" [formControl]="mobilegridaction">
236+
<mat-chip-row *ngFor="let isitemw of mobilechipsissue" (removed)="removemobile(isitemw)">
237+
{{isitemw}}
238+
<button matChipRemove [attr.aria-label]="'remove ' + isitemw">
239+
<mat-icon>cancel</mat-icon>
240+
</button>
241+
</mat-chip-row>
242+
</mat-chip-grid>
243+
244+
<input cdkFocusInitial type="text" matInput placeholder="e.g.: insecure validation" [formControl]="mobilecustomissueform" [matAutocomplete]="auto10" [matChipInputFor]="mobilechipGrid" [matChipInputSeparatorKeyCodes]="separatorKeysCodes" (matChipInputTokenEnd)="addmobile($event)">
245+
<mat-autocomplete #auto10="matAutocomplete" (optionSelected)="mobileselected($event)">
246+
<mat-option [title]="option.title" *ngFor="let option of filteredOptionsmobile | async" [value]="option.title">
247+
{{option.title}}
248+
</mat-option>
249+
</mat-autocomplete>
250+
<mat-error *ngIf="mobilecustomissueform.hasError('notempty')">
251+
<strong>Title must not be empty!</strong>
252+
</mat-error>
253+
<mat-error *ngIf="mobilecustomissueform.hasError('cantfind')">
254+
<strong>Can not be found!</strong>
255+
</mat-error>
256+
</mat-form-field>
257+
258+
<span fxLayoutAlign="flex-end"><small><a class="active-link" target="_blank" href="https://owasp.org/www-project-mobile-top-10/">owasp.org</a></small></span>
259+
</div>
260+
230261
<div *ngIf="show">Please wait...<mat-progress-bar color="accent" mode="indeterminate"></mat-progress-bar></div>
231262
<span style="color: red;">{{err_msg}}</span>
232263
</div>
@@ -241,6 +272,7 @@
241272
<button *ngIf="sourceSelect == 'OWASPTOP2021'" mat-raised-button color="accent" (click)="addOWASPtop2021()"><mat-icon class="vertical-align-middle padding-bottom-3">add</mat-icon> Add OWASP Top 10 2021</button>
242273
<button *ngIf="sourceSelect == 'OWASPTOP10CICD'" mat-raised-button color="accent" (click)="addOWASPTOP10CICD()"><mat-icon class="vertical-align-middle padding-bottom-3">add</mat-icon> Add OWASP Top 10 CI/CD Security Risks</button>
243274
<button *ngIf="sourceSelect == 'OWASPTOP10k8s'" mat-raised-button color="accent" (click)="addOWASPTOP10k8s()"><mat-icon class="vertical-align-middle padding-bottom-3">add</mat-icon> Add OWASP Kubernetes Top 10</button>
275+
<button *ngIf="sourceSelect == 'OWASP_mobile'" mat-raised-button color="accent" (click)="addOWASP_mobile()"><mat-icon class="vertical-align-middle padding-bottom-3">add</mat-icon> Add OWASP Mobile Top 10</button>
244276
&nbsp;
245277
<button mat-raised-button color="primary" (click)="cancel()">Cancel</button>
246278
</div>

src/app/dialog-addissue/dialog-addissue.component.ts

+119-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ export interface PCITesting {
5555
})
5656
export class DialogAddissueComponent implements OnInit {
5757
customissueform = new UntypedFormControl();
58+
mobilecustomissueform = new UntypedFormControl();
5859
gridaction = new UntypedFormControl();
60+
mobilegridaction = new UntypedFormControl();
5961
cwecontrol = new UntypedFormControl();
6062
mycve = new UntypedFormControl();
6163
mymobilemitre = new UntypedFormControl();
@@ -66,6 +68,7 @@ export class DialogAddissueComponent implements OnInit {
6668
myOWASPTOP10CICD = new UntypedFormControl();
6769
myOWASPTOP10k8s = new UntypedFormControl();
6870
options: Vulns[] = [];
71+
mobileoptions: Vulns[] = [];
6972
optionsv = [];
7073
cwe: Vulns[] = [];
7174
mitremobile: Vulns[] = [];
@@ -76,6 +79,7 @@ export class DialogAddissueComponent implements OnInit {
7679
OWASPTOP10CICD: Vulns[] = [];
7780
OWASPTOP10k8s: Vulns[] = [];
7881
filteredOptions: Observable<Vulns[]>;
82+
filteredOptionsmobile: Observable<Vulns[]>;
7983
filteredOptionsCWE: Observable<Vulns[]>;
8084
filteredOptionsmitremobile: Observable<Vulns[]>;
8185
filteredOptionsmitreenterprise: Observable<Vulns[]>;
@@ -90,6 +94,7 @@ export class DialogAddissueComponent implements OnInit {
9094
separatorKeysCodes: number[] = [ENTER, COMMA];
9195
announcer = inject(LiveAnnouncer);
9296
chipsissue: string[] = [];
97+
mobilechipsissue: string[] = [];
9398
reportTemplateList_int = [];
9499

95100
constructor(public router: Router,
@@ -104,7 +109,12 @@ export class DialogAddissueComponent implements OnInit {
104109
map(value => typeof value === 'string' ? value : value.title),
105110
map(title => title ? this._filter(title) : this.options.slice())
106111
);
107-
112+
this.filteredOptionsmobile = this.mobilecustomissueform.valueChanges
113+
.pipe(
114+
startWith<string | Vulns>(''),
115+
map(value => typeof value === 'string' ? value : value.title),
116+
map(title => title ? this._filtermobile(title) : this.mobileoptions.slice())
117+
);
108118
this.filteredOptionsCWE = this.cwecontrol.valueChanges
109119
.pipe(
110120
startWith<string | Vulns>(''),
@@ -165,6 +175,10 @@ export class DialogAddissueComponent implements OnInit {
165175
const filterValue = name.toLowerCase();
166176
return this.options.filter(option => option.title.toLowerCase().indexOf(filterValue) >= 0);
167177
}
178+
private _filtermobile(name: string): Vulns[] {
179+
const filterValue = name.toLowerCase();
180+
return this.mobileoptions.filter(option => option.title.toLowerCase().indexOf(filterValue) >= 0);
181+
}
168182
private _filterCWE(name: string): Vulns[] {
169183
const filterValue = name.toLowerCase();
170184
return this.cwe.filter(option => option.title.toLowerCase().indexOf(filterValue) >= 0);
@@ -228,6 +242,10 @@ export class DialogAddissueComponent implements OnInit {
228242
}
229243
});
230244

245+
this.http.get<any>('/assets/owasp_mobile_2024.json?v=' + + new Date()).subscribe(res => {
246+
this.mobileoptions = res;
247+
});
248+
231249
this.http.get<any>('/assets/CWE_V.4.3.json?v=' + + new Date()).subscribe(res => {
232250
this.cwe = res;
233251
});
@@ -852,6 +870,104 @@ export class DialogAddissueComponent implements OnInit {
852870
}
853871

854872

873+
addOWASP_mobile() {
874+
875+
if (this.mobilecustomissueform.value !== "" && this.mobilecustomissueform.value !== null) {
876+
this.mobilechipsissue.push(this.mobilecustomissueform.value);
877+
}
878+
879+
let exitel = [];
880+
if (this.mobilechipsissue.length > 0) {
881+
for (var datael of this.mobilechipsissue) {
882+
883+
const found = this.mobileoptions.find((obj) => {
884+
return obj.title === datael;
885+
});
886+
887+
if (found !== undefined) {
888+
889+
if (found.title === datael) {
890+
const def = {
891+
title: found.title,
892+
poc: found.poc,
893+
files: [],
894+
desc: found.desc,
895+
severity: found.severity,
896+
status: 1,
897+
ref: found.ref,
898+
cvss: found.cvss,
899+
cvss_vector: found.cvss_vector,
900+
cve: found.cve,
901+
tags: found.tags,
902+
bounty: [],
903+
date: this.getcurrentDate()
904+
};
905+
exitel.push(def);
906+
907+
}
908+
909+
910+
} else {
911+
912+
const def = {
913+
title: datael,
914+
poc: '',
915+
files: [],
916+
desc: '',
917+
severity: 'High',
918+
status: 1,
919+
ref: '',
920+
cvss: 7,
921+
cvss_vector: '',
922+
cve: '',
923+
tags: [],
924+
bounty: [],
925+
date: this.getcurrentDate()
926+
};
927+
exitel.push(def);
928+
}
929+
}
930+
931+
this.dialogRef.close(exitel);
932+
933+
934+
} else {
935+
this.customissueform.setErrors({ 'notempty': true });
936+
this.gridaction.setErrors({ 'notempty': true });
937+
}
938+
939+
}
940+
941+
addmobile(event: MatChipInputEvent): void {
942+
const value = (event.value || '').trim();
943+
944+
// Add our fruit
945+
if (value) {
946+
this.mobilechipsissue.push(value);
947+
}
948+
949+
// Clear the input value
950+
event.chipInput!.clear();
951+
952+
this.mobilecustomissueform.setValue('');
953+
}
954+
955+
removemobile(item: string): void {
956+
const index = this.mobilechipsissue.indexOf(item);
957+
958+
if (index >= 0) {
959+
this.mobilechipsissue.splice(index, 1);
960+
961+
this.announcer.announce(`Removed ${item}`);
962+
}
963+
}
964+
965+
mobileselected(event: MatAutocompleteSelectedEvent): void {
966+
this.mobilechipsissue.push(event.option.viewValue);
967+
//this.fruitInput.nativeElement.value = '';
968+
this.mobilecustomissueform.setValue('');
969+
}
970+
855971
add(event: MatChipInputEvent): void {
856972
const value = (event.value || '').trim();
857973

@@ -876,6 +992,8 @@ export class DialogAddissueComponent implements OnInit {
876992
}
877993
}
878994

995+
996+
879997
selected(event: MatAutocompleteSelectedEvent): void {
880998
this.chipsissue.push(event.option.viewValue);
881999
//this.fruitInput.nativeElement.value = '';

src/app/dialog-editor-fullscreen/dialog-editor-fullscreen.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Component, Inject, OnInit, ElementRef, ViewChild } from '@angular/core';
22
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
33
import { UntypedFormControl } from '@angular/forms';
4-
import { marked } from 'marked'
5-
import * as DOMPurify from 'dompurify';
4+
5+
import DOMPurify from 'dompurify';
66
import { markedHighlight } from "marked-highlight";
77
import hljs from 'highlight.js';
88
import { Marked } from "marked";

src/app/report/report.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { COMMA, ENTER } from '@angular/cdk/keycodes';
3030
import { HttpClient } from '@angular/common/http';
3131
import * as Crypto from 'crypto-js';
3232
import { v4 as uuid } from 'uuid';
33-
import * as DOMPurify from 'dompurify';
33+
import DOMPurify from 'dompurify';
3434
import { ApiService } from '../api.service';
3535
import { MatCalendar, MatCalendarCellCssClasses, DateRange } from '@angular/material/datepicker';
3636
import { SessionstorageserviceService } from "../sessionstorageservice.service"

0 commit comments

Comments
 (0)