-
Notifications
You must be signed in to change notification settings - Fork 659
eslint security spike #31887
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
Open
zabelin-vladimir
wants to merge
6
commits into
DevExpress:25_2
Choose a base branch
from
zabelin-vladimir:eslintSecuritySpike
base: 25_2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
eslint security spike #31887
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4b71625
eslint security spike
zabelin-vladimir 2534e31
change runner to devextreme-shr2
zabelin-vladimir 67d3cc9
move powershell to bash
zabelin-vladimir ca20b5a
fix teargets
zabelin-vladimir ca06a1d
fix bash command
zabelin-vladimir 647d3fc
try to move to default github runner
zabelin-vladimir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| @devexpress:registry=https://npm.pkg.github.com | ||
| //npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN} | ||
| always-auth=true |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| export default function(results, _context) { | ||
| const esc = (s) => String(s).replace(/[&<>"']/g, m => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[m])); | ||
| const rel = (p) => p.replace(process.cwd().replace(/\\/g,'/'), '').replace(/^[/\\]/, '').replace(/\\/g,'/'); | ||
|
|
||
| const bad = results.filter(r => r.errorCount || r.warningCount); | ||
| const totalErrors = bad.reduce((a, r) => a + r.errorCount, 0); | ||
| const totalWarnings = bad.reduce((a, r) => a + r.warningCount, 0); | ||
|
|
||
| const sections = bad.map(r => { | ||
| const file = rel(r.filePath); | ||
| const items = r.messages.map(m => { | ||
| const sev = m.severity === 2 ? 'error' : 'warning'; | ||
| const pos = `${m.line ?? 0}:${m.column ?? 0}`; | ||
| return `<li class="${sev}"><span class="sev">${sev}</span> <code>${esc(m.ruleId ?? 'parser')}</code> — ${esc(m.message)} <span class="pos">(${esc(file)}:${pos})</span></li>`; | ||
| }).join(''); | ||
| return `<section><h3>${esc(file)} — ${r.errorCount} error(s), ${r.warningCount} warning(s)</h3><ul>${items}</ul></section>`; | ||
| }).join(''); | ||
|
|
||
| const html = `<!doctype html><meta charset="utf-8"><title>ESLint report</title> | ||
| <style> | ||
| body{font:14px/1.45 system-ui,Segoe UI,Arial,sans-serif;margin:24px;max-width:1200px} | ||
| h1{margin:0 0 12px}h3{margin:16px 0 8px} | ||
| code{background:#f6f6f6;padding:0 4px;border-radius:4px} | ||
| section{padding:12px 14px;border:1px solid #eee;border-radius:10px;margin:12px 0;border-radius:10px} | ||
| ul{margin:0 0 0 18px} li{margin:4px 0} .sev{display:inline-block;min-width:60px} | ||
| .error .sev{color:#b00020;font-weight:600} .warning .sev{color:#aa7a00;font-weight:600} .pos{opacity:.7} | ||
| </style> | ||
| <h1>ESLint report</h1> | ||
| <p>Files with issues: <b>${bad.length}</b> | Errors: <b>${totalErrors}</b> | Warnings: <b>${totalWarnings}</b></p> | ||
| ${bad.length ? sections : '<p>No problems found.</p>'}`; | ||
| return html; | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The HTML escape function doesn't handle all potential XSS vectors. While basic HTML entities are escaped, consider using a well-tested library or ensuring all user-controlled data (file paths, messages, rule IDs) are properly escaped. The current implementation is adequate for the basic cases but could be more robust.