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 missing input validation for website URL and element locator #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Sachin-NK
Copy link
Contributor

  • Added is_valid_url() function: Uses urllib.parse.urlparse to validate URL format, ensuring it includes a valid scheme and network location.
  • Added sanitize_locator() function: Sanitizes element locators using a regular expression to remove potentially harmful characters, allowing only alphanumeric characters, periods, hash symbols, and square brackets.
  • Modified scrape_website() function: Now uses the is_valid_url() function to validate user-provided URLs and the sanitize_locator() function to sanitize element locators before use. Improved input prompts to guide users.

- Added `is_valid_url()` function: Uses `urllib.parse.urlparse` to validate URL format, ensuring it includes a valid scheme and network location.
- Added `sanitize_locator()` function: Sanitizes element locators using a regular expression to remove potentially harmful characters, allowing only alphanumeric characters, periods, hash symbols, and square brackets.
- Modified `scrape_website()` function:  Now uses the `is_valid_url()` function to validate user-provided URLs and the `sanitize_locator()` function to sanitize element locators before use.  Improved input prompts to guide users.
@sunny7899
Copy link
Member

@Ki1er Can you resolve the code conflict please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing Input Validation for Website URL and Element Locator
2 participants