-
Notifications
You must be signed in to change notification settings - Fork 2
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 character sets for attribute values #397
base: release/v7
Are you sure you want to change the base?
Conversation
packages/content/src/attributes/types/proprietary/ProprietaryJSON.ts
Outdated
Show resolved
Hide resolved
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.
Requires additional approval of @stnmtz once we want to merge this PR.
The base branch was changed.
@Magnus-Kuhn you can add docs now yourself against: nmshd/documentation#307 |
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.
Seeing what you did with #437 I think we should do all this in the controller and not on serval level. Additionally it wouldn't be a breaking change then.
@@ -28,7 +29,7 @@ export class RelationshipAttribute<TValueClass extends AttributeValues.Relations | |||
public value: TValueClass; | |||
|
|||
@serialize() | |||
@validate({ max: 100 }) | |||
@validate({ max: 100, regExp: characterSets.din91379DatatypeC }) |
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.
this key is only machine read, I don't see a reason why we should limit the charset here.
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.
My reason for validating everything was that integrators can safely copy attributes into their systems, even if they can't handle all characters
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 don't see someone not being able to "handle" this.
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.
The reason for creating the norm and making it mandatory was that there were non-conformant IT systems (some that weren't even using UTF8) - see https://www.it-planungsrat.de/fileadmin/beschluesse/2022/Beschluss2022-51_Umsetzung.pdf. I would not be as confident with this.
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.
Ehm, nope?! The main reason is that we don't want to have ✌🏼😜😜😜🤣😆🥹😅
as a display name or surname.
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.
Okay, then there has been some misunderstanding
@@ -30,7 +31,7 @@ export interface IRelationshipAttributeCreationHints extends ISerializable { | |||
@type("RelationshipAttributeCreationHints") | |||
export class RelationshipAttributeCreationHints extends Serializable implements IRelationshipAttributeCreationHints { | |||
@serialize() | |||
@validate({ max: PROPRIETARY_ATTRIBUTE_MAX_TITLE_LENGTH }) | |||
@validate({ max: PROPRIETARY_ATTRIBUTE_MAX_TITLE_LENGTH, regExp: characterSets.din91379DatatypeC }) |
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.
why are title and description validated?
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.
If a query has forbidden characters, then there would be no attribute that fits to the query
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.
ehm, what? this would require that title and description are validated in the attribute itself..
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.
They are currently validated in the Proprietary... types
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.
True, but also there I'd heavily argue that this is necessary.
Doing it in serval validates requests and notifications as well |
But it requires you to duplicate the logic everywhere ... I don't see a reason for doing that. |
Additionally the error message for regex sucks. When doing that in controllers we would have the possibility to return a WAY BETTER error message than |
Also generally the regex checks for e.g. Email occur in content - which also has a big error message. Do you suggest moving them all (and maybe the string length checks as well) into the controller? |
I don't know why this has to be a general thing. I see a thing that gets introduced in almost every content class, which is not ok and we should find a solution for that - and I proposed a solution. Projecting this to "but then we should remove all regex validations" is very misplaced here. |
nmshd/documentation#309 does documentation, #448 is an alternative approach |
Readiness checklist