From cba52c9e6c67ae2ee723c76f0c9ed165b657df63 Mon Sep 17 00:00:00 2001 From: aribeiro Date: Mon, 12 Jul 2021 15:10:19 +0100 Subject: Fix security vulnerabilities Issue-ID: SDC-3634 Signed-off-by: aribeiro Change-Id: I2ad864179cea8021773a9ea80953d995d75d36d0 --- .../onboarding/licenseModel/LicenseModelReducer.js | 3 ++- .../creation/LicenseModelCreationReducer.js | 3 ++- .../entitlementPools/EntitlementPoolsEditorReducer.js | 16 ++++++++++++---- .../entitlementPools/components/FormContent.jsx | 1 + .../featureGroups/FeatureGroupsEditorReducer.js | 13 ++++++++++--- .../licenseAgreement/LicenseAgreementEditorReducer.js | 8 ++++++-- .../licenseKeyGroups/LicenseKeyGroupsEditorReducer.js | 18 ++++++++++++++---- .../licenseKeyGroups/components/FormContent.jsx | 4 ++++ .../details/SoftwareProductDetailsReducer.js | 5 ++++- .../test/softwareProduct/details/detailsView.test.js | 4 ++-- openecomp-ui/test/softwareProduct/details/test.js | 6 +++--- 11 files changed, 60 insertions(+), 21 deletions(-) (limited to 'openecomp-ui') diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelReducer.js index f102d286f0..05c6654531 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelReducer.js @@ -90,7 +90,8 @@ export default combineReducers({ errorText: '', validations: [ { type: 'required', data: true }, - { type: 'maxLength', data: 1000 } + { type: 'maxLength', data: 1000 }, + { type: 'validateName', data: true } ] } } diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationReducer.js index 5922a47822..cbd192d58e 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationReducer.js @@ -32,7 +32,8 @@ export default (state = {}, action) => { errorText: '', validations: [ { type: 'required', data: true }, - { type: 'maxLength', data: 1000 } + { type: 'maxLength', data: 1000 }, + { type: 'validateName', data: true } ] }, vendorName: { diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorReducer.js index 674a8eba51..c66cbbc25b 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorReducer.js @@ -48,13 +48,17 @@ export default (state = {}, action) => { errorText: '', validations: [ { type: 'required', data: true }, - { type: 'maxLength', data: 120 } + { type: 'maxLength', data: 120 }, + { type: 'validateName', data: true } ] }, description: { isValid: true, errorText: '', - validations: [{ type: 'maxLength', data: 1000 }] + validations: [ + { type: 'maxLength', data: 1000 }, + { type: 'validateName', data: true } + ] }, type: { isValid: true, @@ -64,7 +68,10 @@ export default (state = {}, action) => { increments: { isValid: true, errorText: '', - validations: [{ type: 'maxLength', data: 120 }] + validations: [ + { type: 'maxLength', data: 120 }, + { type: 'validateName', data: true } + ] }, thresholdUnits: { isValid: true, @@ -91,7 +98,8 @@ export default (state = {}, action) => { errorText: '', validations: [ { type: 'required', data: true }, - { type: 'maxLength', data: 100 } + { type: 'maxLength', data: 100 }, + { type: 'validateName', data: true } ] } }, diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/components/FormContent.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/components/FormContent.jsx index 9eb38dec64..cc8a6e844c 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/components/FormContent.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/components/FormContent.jsx @@ -232,6 +232,7 @@ export const EntitlementPoolsFormContent = ({ onChange={increments => onDataChanged({ increments }, SP_ENTITLEMENT_POOL_FORM) } + errorText={genericFieldInfo.increments.errorText} label={i18n('Increments')} value={increments} data-test-id="create-ep-increments" diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsEditorReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsEditorReducer.js index f6b9a86f7a..c2135ec988 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsEditorReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsEditorReducer.js @@ -32,7 +32,10 @@ export default (state = {}, action) => { description: { isValid: true, errorText: '', - validations: [{ type: 'maxLength', data: 1000 }], + validations: [ + { type: 'maxLength', data: 1000 }, + { type: 'validateName', data: true } + ], tabId: FeatureGroupStateConstants .SELECTED_FEATURE_GROUP_TAB.GENERAL @@ -40,7 +43,10 @@ export default (state = {}, action) => { partNumber: { isValid: true, errorText: '', - validations: [{ type: 'required', data: true }], + validations: [ + { type: 'required', data: true }, + { type: 'validateName', data: true } + ], tabId: FeatureGroupStateConstants .SELECTED_FEATURE_GROUP_TAB.GENERAL @@ -50,7 +56,8 @@ export default (state = {}, action) => { errorText: '', validations: [ { type: 'required', data: true }, - { type: 'maxLength', data: 120 } + { type: 'maxLength', data: 120 }, + { type: 'validateName', data: true } ], tabId: FeatureGroupStateConstants diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorReducer.js index 03157cb108..bca06a8ccd 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorReducer.js @@ -32,7 +32,10 @@ export default (state = {}, action) => { description: { isValid: true, errorText: '', - validations: [{ type: 'maxLength', data: 1000 }], + validations: [ + { type: 'maxLength', data: 1000 }, + { type: 'validateName', data: true } + ], tabId: LicenseAgreementEnums.SELECTED_LICENSE_AGREEMENT_TAB .GENERAL @@ -56,7 +59,8 @@ export default (state = {}, action) => { errorText: '', validations: [ { type: 'required', data: true }, - { type: 'maxLength', data: 25 } + { type: 'maxLength', data: 25 }, + { type: 'validateName', data: true } ], tabId: LicenseAgreementEnums.SELECTED_LICENSE_AGREEMENT_TAB diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorReducer.js index 68953169c1..d3af8bea5c 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorReducer.js @@ -49,14 +49,18 @@ export default (state = {}, action) => { description: { isValid: true, errorText: '', - validations: [{ type: 'maxLength', data: 1000 }] + validations: [ + { type: 'maxLength', data: 1000 }, + { type: 'validateName', data: true } + ] }, name: { isValid: true, errorText: '', validations: [ { type: 'required', data: true }, - { type: 'maxLength', data: 120 } + { type: 'maxLength', data: 120 }, + { type: 'validateName', data: true } ] }, type: { @@ -77,7 +81,10 @@ export default (state = {}, action) => { increments: { isValid: true, errorText: '', - validations: [{ type: 'maxLength', data: 120 }] + validations: [ + { type: 'maxLength', data: 120 }, + { type: 'validateName', data: true } + ] }, startDate: { isValid: true, @@ -92,7 +99,10 @@ export default (state = {}, action) => { manufacturerReferenceNumber: { isValid: true, errorText: '', - validations: [{ type: 'maxLength', data: 100 }] + validations: [ + { type: 'maxLength', data: 100 }, + { type: 'validateName', data: true } + ] } } }; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/components/FormContent.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/components/FormContent.jsx index 24864289e1..fe7873ff2e 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/components/FormContent.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/components/FormContent.jsx @@ -207,6 +207,9 @@ const LicenseKeyGroupFormContent = ({ LKG_FORM_NAME ) } + errorText={ + genericFieldInfo.manufacturerReferenceNumber.errorText + } label={i18n('Manufacturer Reference Number')} value={manufacturerReferenceNumber} data-test-id="create-ep-mrn" @@ -219,6 +222,7 @@ const LicenseKeyGroupFormContent = ({ onChange={increments => onDataChanged({ increments }, LKG_FORM_NAME) } + errorText={genericFieldInfo.increments.errorText} label={i18n('Increments')} value={increments} data-test-id="create-ep-increments" diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsReducer.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsReducer.js index 1e4a0df787..fb8dbe4564 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsReducer.js @@ -42,7 +42,10 @@ export default (state = {}, action) => { description: { isValid: true, errorText: '', - validations: [{ type: 'required', data: true }] + validations: [ + { type: 'validateName', data: true }, + { type: 'required', data: true } + ] } }, data: action.response diff --git a/openecomp-ui/test/softwareProduct/details/detailsView.test.js b/openecomp-ui/test/softwareProduct/details/detailsView.test.js index 46983f5d80..136ecde969 100644 --- a/openecomp-ui/test/softwareProduct/details/detailsView.test.js +++ b/openecomp-ui/test/softwareProduct/details/detailsView.test.js @@ -77,7 +77,7 @@ describe('Software Product Details: ', function () { 'description': { isValid: true, errorText: '', - validations: [{type: 'required', data: true}] + validations: [{type: 'validateName', data: true}, {type: 'required', data: true}] } }; qGenericFieldInfo = SchemaGenericFieldInfoFactory.build(); @@ -151,7 +151,7 @@ describe('Software Product Details: ', function () { dataMap } }, - finalizedLicenseModelList: finalizedLicenseModelList, + finalizedLicenseModelList: finalizedLicenseModelList, archivedLicenseModelList: [], archivedSoftwareProductList: [], licenseModel: { diff --git a/openecomp-ui/test/softwareProduct/details/test.js b/openecomp-ui/test/softwareProduct/details/test.js index 60506243ff..92390f61ef 100644 --- a/openecomp-ui/test/softwareProduct/details/test.js +++ b/openecomp-ui/test/softwareProduct/details/test.js @@ -67,8 +67,8 @@ describe('Software Product Details Module Tests', function () { await SoftwareProductActionHelper.fetchSoftwareProductList(store.dispatch); await SoftwareProductActionHelper.fetchFinalizedSoftwareProductList(store.dispatch); await SoftwareProductActionHelper.fetchArchivedSoftwareProductList(store.dispatch); - - expect(store.getState()).toEqual(expectedStore); + + expect(store.getState()).toEqual(expectedStore); }); it('Add Software Product', () => { @@ -116,7 +116,7 @@ describe('Software Product Details Module Tests', function () { 'description': { isValid: true, errorText: '', - validations: [{type: 'required', data: true}] + validations: [{type: 'validateName', data: true}, {type: 'required', data: true}] } }; const expectedFormName = forms.VENDOR_SOFTWARE_PRODUCT_DETAILS; -- cgit 1.2.3-korg