huawei-noah / vega

AutoML tools chain
http://www.noahlab.com.hk/opensource/vega/
Other
845 stars 176 forks source link

vega评估服务器,请求参数repeat_times未做校验,可设置成无穷大 #149

Closed jiangzc86 closed 3 years ago

jiangzc86 commented 3 years ago

image

zhangjiajin commented 3 years ago
    @staticmethod
    def _check_get_repeat_times(repeat_times):
        """Check validation of input repeat_times."""
        _repeat_times = repeat_times
        try:
            _repeat_times = int(_repeat_times)
        except ValueError:
            logging.warning("repeat_times {} is not a valid integer".format(_repeat_times))
            abort(400, "repeat_times {} is not a valid integer".format(_repeat_times))
        if not 0 < _repeat_times <= MAX_EVAL_EPOCHS:
            logging.warning("repeat_times {} is not in valid range (1-{})".format(_repeat_times, MAX_EVAL_EPOCHS))
            abort(400, "repeat_times {} is not in valid range (1-{})".format(_repeat_times, MAX_EVAL_EPOCHS))
        return _repeat_times