Skip to content
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

feat(legal entity): extended legal entity length #216

Merged
merged 4 commits into from
Aug 14, 2024

Conversation

typecastcloud
Copy link
Contributor

@typecastcloud typecastcloud commented Jul 12, 2024

Description

Extended pattern with additional currency characters and length adjustment. Tests added.

Min length: 1
Max lenth: 160

Allows " (double quote \x22) to follow back-end implementation.
Allows £$€¥¢ to allow some additional currency symbols that are used in existing companies.

Why

Much longer company names exist than currently allowed.

Example:
https://find-and-update.company-information.service.gov.uk/company/03249311
88 characters

Issue

Refs: eclipse-tractusx/portal#360

Checklist

  • I have followed the contributing guidelines
  • I have performed a self-review of my own code
  • I have successfully tested my changes locally
  • I have added tests that prove my changes work
  • I have checked that new and existing tests pass locally with my changes
  • I have commented my code, particularly in hard-to-understand areas

Extended pattern with additional currency characters and length adjustment. Testing added.

Refs: eclipse-tractusx/portal#360
@typecastcloud typecastcloud requested a review from jjeroch July 15, 2024 07:42
@typecastcloud typecastcloud marked this pull request as ready for review July 16, 2024 11:24
@typecastcloud typecastcloud requested review from oyo and evegufy July 16, 2024 11:25
@jjeroch
Copy link
Contributor

jjeroch commented Jul 17, 2024

Looks good. @typecastcloud did you checked once if this also works for BPDM?
Since we are submitting the data to BPDM via the Gate, we should ensure that we dont receive limitations/errors from their side.
I guess all FE are neither validated as well, right? If so, I would directly create a FE ticket to validate the capability of the FE to display the Company everywhere correctly.

oyo
oyo previously approved these changes Jul 17, 2024
@typecastcloud
Copy link
Contributor Author

typecastcloud commented Jul 17, 2024

Looks good. @typecastcloud did you checked once if this also works for BPDM?
Since we are submitting the data to BPDM via the Gate, we should ensure that we dont receive limitations/errors from their side.
I guess all FE are neither validated as well, right? If so, I would directly create a FE ticket to validate the capability of the FE to display the Company everywhere correctly.

There is no limitation in BPDM Gate and Pool regarding the length of company names. We checked this a few weeks ago. @AmirMattarx @nicoprow could you please confirm.

edit: as noted by Amir 255 varchar limit depending on database/table settings.

Portal backend needs to be aligned with regex and all frontend elements need to be checked to properly support longer names. I can create a PR in the backend repository.

Double quote is already allowed in backend. A-Z 0-9 and _ is already covered by \w.
@AmirMattarx
Copy link

AmirMattarx commented Jul 17, 2024

Regarding the company name , in the DB of course there is limitation since the field is created with varchar 255 , that means the limit is 255 chars

@manojava-gk
Copy link
Contributor

manojava-gk commented Jul 22, 2024

@typecastcloud I got a security hot spot issue for postalCode pattern in another repo

postalCodePattern:
/^(?!.\s$)(?=[a-zA-Z\d-][-\s]?[a-zA-Z\d-]*$)[a-zA-Z\d\s-]{2,10}$/

That's because it's using '*' so the input can have infinite length which we should always limit. Use something like

{0,10} instead of '*'

So final regex - /^(?!.*\s$)(?=[a-zA-Z\d-]{0,10}[-\s]?[a-zA-Z\d-]{0,10}$)[a-zA-Z\d\s-]{2,10}$/

CC - @oyo

@typecastcloud
Copy link
Contributor Author

@typecastcloud I got a security hot spot issue for postalCode pattern in another repo

postalCodePattern: /^(?!.\s$)(?=[a-zA-Z\d-][-\s]?[a-zA-Z\d-]*$)[a-zA-Z\d\s-]{2,10}$/

That's because it's using '*' so the input can have infinite length which we should always limit. Use something like

{0,10} instead of '*'

So final regex - /^(?!.*\s$)(?=[a-zA-Z\d-]{0,10}[-\s]?[a-zA-Z\d-]{0,10}$)[a-zA-Z\d\s-]{2,10}$/

CC - @oyo

Hi,
postalCodePattern was not touched in this PR. Can we fix this security finding in a different PR?

@oyo
Copy link
Contributor

oyo commented Jul 23, 2024

Hi, postalCodePattern was not touched in this PR. Can we fix this security finding in a different PR?

okay for me to fix it in a separate PR

@evegufy evegufy merged commit 2250f34 into eclipse-tractusx:main Aug 14, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: USER READY
Development

Successfully merging this pull request may close these issues.

6 participants