-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restrict size of common string attribute kinds #4584
Conversation
d6da0e4
to
2671a7f
Compare
CodSpeed Performance ReportMerging #4584 will not alter performanceComparing Summary
|
2671a7f
to
292bb88
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work
Please can you add a newsfragment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
backend/infrahub/core/attribute.py
Outdated
@classmethod | ||
def validate_content(cls, value: Any, name: str, schema: AttributeSchema) -> None: | ||
super().validate_content(value, name, schema) | ||
if ATTRIBUTE_TYPES[schema.kind] in [Text, Password]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add URL
here as well, don't think it will ever be relevant but you never know..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed this one, I don't think we should hardcode the list if kinds that will be validated here, mostlikely this list will grow in the future and we'll forget about it
Might be better to have a list of kinds that are exempted from the check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking closer into into it, ideally we should apply the validation to all attributes, after serialize
, (except if the kind is exempted from the check)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, added modifications to validate any non-large attribute. This is done after serializing to avoid an extra serialization.
4f8c85a
to
302f474
Compare
302f474
to
1b038be
Compare
Would fix #4432