Commit a9b07fae authored by Dave Pisek's avatar Dave Pisek

DAST scans site profile: Fix inprogress transition

This commit fixes an issue that occurs when a profile that is currently
being validated is edited and eventually transitions into a
failed-validation state.

It prevents the validate-site toggle from being activated and the
validation section from being opened without a validation-token.
parent 0e335a91
......@@ -178,9 +178,7 @@ export default {
if (this.glFeatures.securityOnDemandScansSiteValidation) {
await this.fetchValidationStatus();
if ([PASSED, INPROGRESS].some(this.validationStatusMatches)) {
this.isSiteValidationActive = true;
}
this.isSiteValidationActive = this.validationStatusMatches(PASSED);
}
}
},
......@@ -249,10 +247,10 @@ export default {
this.validationStatus = status;
if (this.validationStatusMatches(INPROGRESS)) {
this.fetchValidationTimeout = setTimeout(
this.fetchValidationStatus,
DAST_SITE_VALIDATION_POLL_INTERVAL,
);
await new Promise(resolve => {
this.fetchValidationTimeout = setTimeout(resolve, DAST_SITE_VALIDATION_POLL_INTERVAL);
});
await this.fetchValidationStatus();
}
} catch (exception) {
this.showErrors({
......
......@@ -443,7 +443,7 @@ describe('DastSiteProfileForm', () => {
describe.each`
givenValidationStatus | expectedDescription | shouldShowDefaultDescriptionAfterToggle | shouldHaveSiteValidationActivated | shouldHaveSiteValidationDisabled | shouldPoll
${DAST_SITE_VALIDATION_STATUS.PENDING} | ${'Site must be validated to run an active scan.'} | ${false} | ${false} | ${false} | ${false}
${DAST_SITE_VALIDATION_STATUS.INPROGRESS} | ${'Validation is in progress...'} | ${false} | ${true} | ${true} | ${true}
${DAST_SITE_VALIDATION_STATUS.INPROGRESS} | ${'Validation is in progress...'} | ${false} | ${false} | ${true} | ${true}
${DAST_SITE_VALIDATION_STATUS.PASSED} | ${'Validation succeeded. Both active and passive scans can be run against the target site.'} | ${false} | ${true} | ${false} | ${false}
${DAST_SITE_VALIDATION_STATUS.FAILED} | ${'Validation failed. Please try again.'} | ${true} | ${false} | ${false} | ${false}
`(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment