Protection against misuse with system-wide quota definitions (#670)
* Added quota for meta data per software module Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Added unit test for "meta data per module" quota Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * quota test enhancements Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Verify enforcement of meta data quota via REST Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Quota for distribution set meta data Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Verify enforcement of distribution set meta data quota via REST Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * software modules per distribution set quota Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Integration test enhancements for Modules per DistSet quota Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Quota for software module types per distribution set type Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Quota for max artifacts per software module Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Quotas for ActionStatus per Action and Messages per ActionStatus Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Quota attributes per target Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Quota targets per rollout group Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Quota max targets per rollout group Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Quota max targets per rollout group Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Quota max targets per rollout group Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Quota max targets per rollout group Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Quota max targets per group Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * quota max actions per target Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Quota max targets per rollout group Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Quota max actions per target Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Quota max actions per target Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Quota max targets per auto assignment Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Quota max targets per manual assignment Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Quota max targets per auto assignment Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Quota max targets per auto assign Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Quota max targets per auto assignment Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Quota max actions per target Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Quota max targets per manual assignment Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix issues caused by merge Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix failing tests Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix failing tests Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Improve JavaDoc Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix failing tests Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix Sonar issues Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix Sonar findings Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Quota max artifact size Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Optimize quota configuration Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix test failures Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix failing tests Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Improve test coverage Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Quota max rollout groups per rollout Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix failing tests Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Configure Rollout UI enhancements Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * UI enhancements Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Minor changes Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Quota max targets per group Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Quota max targets per group Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * fix failing tests Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix failing tests Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix Sonar findings Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix Sonar findings Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix failing tests Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix failing tests Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix Sonar finding Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix code review findings Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix review findings Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * New approach for 'max artifact size' enforcement Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix failing tests Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix failing tests Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix failing tests Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix Sonar findings Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix failing tests Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Reduce max artifact size for tests Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix Kai's review findings Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com>
This commit is contained in:
committed by
Kai Zimmermann
parent
fcc15a0484
commit
6dd98d2134
@@ -48,4 +48,54 @@ public class PropertiesQuotaManagement implements QuotaManagement {
|
||||
return securityProperties.getDos().getMaxMessagesPerActionStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMetaDataEntriesPerSoftwareModule() {
|
||||
return securityProperties.getDos().getMaxMetaDataEntriesPerSoftwareModule();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMetaDataEntriesPerDistributionSet() {
|
||||
return securityProperties.getDos().getMaxMetaDataEntriesPerDistributionSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSoftwareModulesPerDistributionSet() {
|
||||
return securityProperties.getDos().getMaxSoftwareModulesPerDistributionSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSoftwareModuleTypesPerDistributionSetType() {
|
||||
return securityProperties.getDos().getMaxSoftwareModuleTypesPerDistributionSetType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxArtifactsPerSoftwareModule() {
|
||||
return securityProperties.getDos().getMaxArtifactsPerSoftwareModule();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTargetsPerRolloutGroup() {
|
||||
return securityProperties.getDos().getMaxTargetsPerRolloutGroup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxActionsPerTarget() {
|
||||
return securityProperties.getDos().getMaxActionsPerTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTargetsPerManualAssignment() {
|
||||
return securityProperties.getDos().getMaxTargetsPerManualAssignment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTargetsPerAutoAssignment() {
|
||||
return securityProperties.getDos().getMaxTargetsPerAutoAssignment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxArtifactSize() {
|
||||
return securityProperties.getDos().getMaxArtifactSize();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import javax.validation.ValidationException;
|
||||
|
||||
import org.eclipse.hawkbit.repository.exception.QuotaExceededException;
|
||||
import org.eclipse.hawkbit.repository.exception.RolloutIllegalStateException;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
@@ -75,9 +76,11 @@ public final class RolloutHelper {
|
||||
*/
|
||||
public static void verifyRolloutGroupParameter(final int amountGroup, final QuotaManagement quotaManagement) {
|
||||
if (amountGroup <= 0) {
|
||||
throw new ValidationException("the amount of groups cannot be lower than zero");
|
||||
throw new ValidationException("The amount of groups cannot be lower than zero");
|
||||
} else if (amountGroup > quotaManagement.getMaxRolloutGroupsPerRollout()) {
|
||||
throw new ValidationException("the amount of groups cannot be greater than 500");
|
||||
throw new QuotaExceededException(
|
||||
"The amount of groups cannot be greater than " + quotaManagement.getMaxRolloutGroupsPerRollout());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,9 +92,9 @@ public final class RolloutHelper {
|
||||
*/
|
||||
public static void verifyRolloutGroupTargetPercentage(final float percentage) {
|
||||
if (percentage <= 0) {
|
||||
throw new ValidationException("the percentage must be greater than zero");
|
||||
throw new ValidationException("The percentage must be greater than zero");
|
||||
} else if (percentage > 100) {
|
||||
throw new ValidationException("the percentage must not be greater than 100");
|
||||
throw new ValidationException("The percentage must not be greater than 100");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user