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

fix: Improve RegExp for URLs in Admin settings #3553

Merged
merged 2 commits into from
Oct 28, 2019
Merged

fix: Improve RegExp for URLs in Admin settings #3553

merged 2 commits into from
Oct 28, 2019

Conversation

reetamnandi
Copy link
Contributor

Fixes #3528

Short description of what this resolves:

RegExp for URLs improved to allow acceptance of localhost or 127.0.0.1 URLs in Admin settings.

Checklist

  • I have read the Contribution & Best practices Guide.
  • My branch is up-to-date with the Upstream development branch.
  • The acceptance, integration, unit tests and linter pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@auto-label auto-label bot added the fix label Oct 11, 2019
@reetamnandi
Copy link
Contributor Author

@kushthedude Please review.

// user:pass authentication
+ '(?:\\S+(?::\\S*)?@)?'
+ '(?:'
// IP address exclusion
// private & local networks
+ '(?!(?:10|127)(?:\\.\\d{1,3}){3})'
+ '(?!(?:10)(?:\\.\\d{1,3}){3})'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any link/resource to verify the validity of this check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Loopback IP address ranges from 127.0.0.0 to 127.255.255.255 and as per the Issue the Loopback address(es) should be valid for testing purposes so I removed the 127 address from the exclusion list as it was just excluding any addresses beginning with 10/127.

@kushthedude
Copy link
Member

@reetam-nandi Can you please add a gif or video, showing reg-ex is working fine for all previous rules and new rules ?

@reetamnandi
Copy link
Contributor Author

@kushthedude please check the following link which tests out the RegEx with necessary test cases.

Copy link
Member

@kushthedude kushthedude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Copy link
Contributor

@uds5501 uds5501 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@kushthedude kushthedude merged commit ce9872f into fossasia:development Oct 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Admin Settings: Improve RegEx for API & FE URL in FE Settings
4 participants