swagger-api / swagger-api/swagger-ui
Make it more difficult to accidentally write an unsanitized URL to the DOM
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Is your feature request related to a problem?
Aside from constant vigilance, there's nothing keeping us from accidentally introducing a URL-related XSS bug in a pull request.
Describe the solution you'd like
- instead of pulling in
sanitizeUrleverywhere we need it, modify our Link component to sanitize anyhref(and maybe some other attributes?) it receives - add a linter rule that requires users to use Link instead of bare anchor elements
and there you have it! sanitized URLs become the path of least resistance in new code!
Additional context
Occurred to me while reviewing a PR https://github.com/swagger-api/swagger-ui/pull/5395/files#diff-2d31cb4d375fa2c819408dbbaf4fac66R3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the linked pull request and the existing sanitizeUrl and Link usage described in the issue. Define the scope of URL-bearing attributes and the linter behavior; the work is done when Link sanitizes the intended inputs and the rule consistently discourages bare anchors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, security, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100