Description
CSS selector input from users is not validated. Invalid selectors silently fail to extract data with no error message. Users believe data was scraped when extraction silently failed.
Steps to Reproduce
- User provides CSS selector: "div[class~=invalid" (missing bracket)
- Scraper attempts to parse: $('div[class~=invalid')
- Selector silently fails
- Returns empty results
- User assumes no data exists on page
Environment Information
- Framework: Cheerio/jsdom
- Input: CSS selector from user
- Validation: None
- Application version: Current main branch
Expected Behavior
CSS selectors validated before use. Invalid selectors rejected with clear error message. User can correct and retry.
Actual Behavior
File: src/services/scraper.js
Uses user selector without validation: $(userSelector)
Code Reference
File: src/services/scraper.js
Missing: CSS selector validation
Additional Context
Validate selectors:
try {
cheerio.parseSelector(userSelector);
} catch (e) {
return error('Invalid CSS selector');
}
GSSoC Points Estimate: Level 1 (Bug/Validation)
Suggested Labels
- gssoc:approved
- type:bug
- severity:medium
- area:validation
Description
CSS selector input from users is not validated. Invalid selectors silently fail to extract data with no error message. Users believe data was scraped when extraction silently failed.
Steps to Reproduce
Environment Information
Expected Behavior
CSS selectors validated before use. Invalid selectors rejected with clear error message. User can correct and retry.
Actual Behavior
File: src/services/scraper.js
Uses user selector without validation: $(userSelector)
Code Reference
File: src/services/scraper.js
Missing: CSS selector validation
Additional Context
Validate selectors:
GSSoC Points Estimate: Level 1 (Bug/Validation)
Suggested Labels