Skip to content

Commit

Permalink
Composer Vulnerability Mirroring initial
Browse files Browse the repository at this point in the history
Signed-off-by: Valentijn Scholten <valentijnscholten@gmail.com>
  • Loading branch information
valentijnscholten committed Jan 4, 2025
1 parent 399947a commit 6e4512b
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 10 deletions.
4 changes: 4 additions & 0 deletions src/assets/scss/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ html {
background-color: #EBE5A8;
border: 1px solid #DCD167;
}
.label-source-drupal {
background-color: hsl(120, 75%, 39%);
border: 1px solid #06785a;
}
.label-source-composer {
background-color: hsl(305, 43%, 51%);
border: 1px solid #7b3566;
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@
"repository_created": "Repository created",
"repository_deleted": "Repository deleted",
"repository_type": "Repository Type",
"repository_mirror_vulnerabilities": "Enable mirroring of Security Advisories",
"repository_mirror_vulnerability_aliases": "Enable Vulnerability alias synchronization",
"required_confirmPassword": "Password confirmation is required and passwords must match",
"required_email": "Email address is required",
"required_fullname": "Fullname is required",
Expand Down
4 changes: 0 additions & 4 deletions src/views/administration/notifications/Alerts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,6 @@ export default {
},
created() {
this.initializeTags();
this.parseDestination(this.alert);
this.parseToken(this.alert);
this.parseTokenHeader(this.alert);
this.parseJiraTicketType(this.alert);
},
watch: {
alert() {
Expand Down
48 changes: 42 additions & 6 deletions src/views/administration/repositories/Repositories.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,21 @@ export default {
<b-col sm="6">
<div>
<c-switch color="primary" v-model="internal" label v-bind="labelIcon" />{{$t('admin.internal')}}
<c-switch color="primary" v-model="enabled" label v-bind="labelIcon" />{{$t('admin.enabled')}}
</div>
<div>
<c-switch color="primary" v-model="authenticationRequired" label v-bind="labelIcon" />{{$t('admin.repository_authentication')}}
<c-switch color="primary" v-model="internal" label v-bind="labelIcon" />{{$t('admin.internal')}}
</div>
<div v-if="this.type === 'COMPOSER'">
<c-switch color="primary" v-model="vulnerabilitiyMirroringEnabled" label v-bind="labelIcon" />{{$t('admin.repository_mirror_vulnerabilities')}}
</div>
<div v-show="vulnerabilitiyMirroringEnabled" v-if="this.type === 'COMPOSER'">
<c-switch color="primary" v-model="vulnerabilityMirroringAliasSyncEnabled" label v-bind="labelIcon" />{{$t('admin.repository_mirror_vulnerability_aliases')}}
</div>
<div>
<c-switch color="primary" v-model="authenticationRequired" label v-bind="labelIcon" />{{$t('admin.repository_authentication')}}
</div>
<div>
<b-validated-input-group-form-input
id="username" :label="$t('admin.username')"
Expand All @@ -176,10 +185,6 @@ export default {
v-debounce:750ms="updateRepository" :debounce-events="'keyup'"/>
</div>
<div>
<c-switch color="primary" v-model="enabled" label v-bind="labelIcon" />{{$t('admin.enabled')}}
</div>
<div style="text-align:right">
<b-button variant="outline-danger" @click="deleteRepository">{{ $t('admin.delete_repository') }}</b-button>
</div>
Expand All @@ -193,13 +198,16 @@ export default {
data() {
return {
repository: row,
type: row.type,
identifier: row.identifier,
url: row.url,
internal: row.internal,
authenticationRequired: row.authenticationRequired,
username: row.username,
password: row.password || 'HiddenDecryptedPropertyPlaceholder',
enabled: row.enabled,
vulnerabilitiyMirroringEnabled: this.parseVulnerabilitiyMirroringEnabled(row),
vulnerabilityMirroringAliasSyncEnabled: this.parseVulnerabilityMirroringAliasSyncEnabled(row),
uuid: row.uuid,
labelIcon: {
dataOn: '\u2713',
Expand All @@ -217,8 +225,32 @@ export default {
authenticationRequired() {
this.updateRepository();
},
vulnerabilitiyMirroringEnabled() {
this.updateRepository();
},
vulnerabilityMirroringAliasSyncEnabled() {
this.updateRepository();
},
},
methods: {
parseVulnerabilitiyMirroringEnabled: function (repo) {
if (repo.config) {
let value = JSON.parse(repo.config);
if (value) {
return value.vulnerabilitiyMirroringEnabled;
}
return null;
}
},
parseVulnerabilityMirroringAliasSyncEnabled: function (repo) {
if (repo.config) {
let value = JSON.parse(repo.config);
if (value) {
return value.vulnerabilityMirroringAliasSyncEnabled;
}
return null;
}
},
deleteRepository: function () {
let url = `${this.$api.BASE_URL}/${this.$api.URL_REPOSITORY}/${this.uuid}`;
this.axios
Expand All @@ -239,6 +271,10 @@ export default {
url: this.url,
internal: this.internal,
authenticationRequired: this.authenticationRequired,
config: JSON.stringify({
vulnerabilitiyMirroringEnabled: this.vulnerabilitiyMirroringEnabled,
vulnerabilityMirroringAliasSyncEnabled: this.vulnerabilityMirroringAliasSyncEnabled,
}),
username: this.username,
password:
this.password || 'HiddenDecryptedPropertyPlaceholder',
Expand Down
2 changes: 2 additions & 0 deletions src/views/portfolio/vulnerabilities/Vulnerability.vue
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ export default {
return 'Snyk';
case 'TRIVY':
return 'Trivy';
case 'DRUPAL':
return 'Drupal';
case 'COMPOSER':
return 'Composer';
default:
Expand Down

0 comments on commit 6e4512b

Please sign in to comment.