physionet-build icon indicating copy to clipboard operation
physionet-build copied to clipboard

validate_aws_id is broken

Open bemoody opened this issue 2 years ago • 0 comments

The code in pull #2101 is wrong:

def validate_aws_id(value):
    """"
    Validate an AWS ID.
    """
    aws_id_pattern = r"\b\d{12}\b"
    if value is not None and not re.search(aws_id_pattern, value):
        raise ValidationError(
            "Invalid AWS ID. Please provide a valid AWS ID, which should be a 12-digit number."
        )

Yes, this rejects plenty of things that are not valid AWS IDs, but does it reject everything that is not a valid AWS ID?

What does re.search do?

bemoody avatar Oct 12 '23 22:10 bemoody