GHSA-g485-8j3v-p6x8 — @tdurieux/anonymous_github
HIGHGHSA-g485-8j3v-p6x8 is a high-severity (CVSS 8.1) vulnerability in @tdurieux/anonymous_github. A fix is available for @tdurieux/anonymous_github — see the affected versions and patch details below.
@tdurieux/anonymous_github Vulnerable to XSS via Unsanitized GitHub Repository Content Rendering in Anonymous GitHub Origin
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.
@tdurieux/anonymous_githubnpmDescription
Summary
Anonymous GitHub fetches repository content (e.g., markdown files) from GitHub's API and renders it without sanitization. On the client side, markdown is parsed with marked (with sanitize: false) and injected into the DOM via $sce.trustAsHtml() + ng-bind-html, bypassing AngularJS's built-in XSS protection. An attacker can craft a malicious GitHub repository whose README executes arbitrary JavaScript in the Anonymous GitHub origin.
Details
README fetched from GitHub API
The server fetches the README via GitHub's REST API and stores the raw markdown in MongoDB:
// https://github.com/tdurieux/anonymous_github/blob/b2d77faa6c6f35ad9ae6ed46e3a3fa4681ac84c2/src/core/source/GitHubRepository.ts#L162-L174
const ghRes = await oct.repos.getReadme({
owner: this.owner,
repo: this.repo,
ref: selected?.commit,
});
const readme = Buffer.from(
ghRes.data.content,
ghRes.data.encoding as BufferEncoding
).toString("utf-8");
selected.readme = readme;
await model.save();
It is then served to the client with no sanitization:
// https://github.com/tdurieux/anonymous_github/blob/b2d77faa6c6f35ad9ae6ed46e3a3fa4681ac84c2/src/server/routes/repository-private.ts#L254-L260
return res.send(
await repo.readme({
accessToken: token,
force: req.query.force == "1",
branch: req.query.branch as string,
})
);
Client-side rendering via $sce.trustAsHtml() + ng-bind-html
The client fetches the raw README, parses it with renderMD() (which uses marked with sanitize: false), then bypasses AngularJS sanitization:
// https://github.com/tdurieux/anonymous_github/blob/b2d77faa6c6f35ad9ae6ed46e3a3fa4681ac84c2/public/script/app.js#L1219-L1226
const res = await $http.get(`/api/repo/${o.owner}/${o.repo}/readme`, {
params: { force: force === true ? "1" : "0", branch: $scope.source.branch },
});
$scope.readme = res.data;
// https://github.com/tdurieux/anonymous_github/blob/b2d77faa6c6f35ad9ae6ed46e3a3fa4681ac84c2/public/script/app.js#L1339-L1343
const html = renderMD(
$scope.anonymize_readme,
`https://github.com/${o.owner}/${o.repo}/raw/${$scope.source.branch}/`
);
$scope.html_readme = $sce.trustAsHtml(html); // sink: bypasses Angular XSS protection
The renderMD() function explicitly disables sanitization:
// https://github.com/tdurieux/anonymous_github/blob/b2d77faa6c6f35ad9ae6ed46e3a3fa4681ac84c2/public/script/utils.js#L165-L176
marked.setOptions({
sanitize: false, // HTML in markdown is preserved as-is
// ...
});
return marked.parse(md, { renderer });
The resulting HTML is bound to the DOM via ng-bind-html, which trusts the string marked by $sce.trustAsHtml() and inserts it as innerHTML.
Impact
- Stored XSS: Any malicious GitHub repository can execute JavaScript in the Anonymous GitHub origin when a user anonymizes it or views its content
- Account Takeover: Steal authentication tokens and session cookies
- Data Exfiltration: Access other users' anonymization configurations and private repository data via
/api/userand/api/repo/list
Proof of Concept
- Create a GitHub repository with a malicious
README.md:
# Innocent README
<img src=x onerror="alert(document.domain)">
- On Anonymous GitHub, enter the malicious repository URL to anonymize it
- The XSS executes immediately when the README preview is rendered on the anonymize page
Remediation
- Sanitize markdown output with DOMPurify before rendering (the dependency already exists but is unused)
- Serve HTML files with
Content-Disposition: attachmentor in a sandboxed iframe on a separate origin - Replace
$sce.trustAsHtml()with properngSanitizeusage - HTML-escape filenames and paths in directory listing templates
- Add Content Security Policy headers
Credits
Zhengyu Liu, Jingcheng Yang
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | @tdurieux/anonymous_github | ≥ 2.2.0&&< 2.3.0 | 2.3.0npm install @tdurieux/anonymous_github@2.3.0 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for @tdurieux/anonymous_github, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update @tdurieux/anonymous_github to 2.3.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-g485-8j3v-p6x8 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-g485-8j3v-p6x8 can be triaged on real exposure rather than presence alone.
Tailored to GHSA-g485-8j3v-p6x8. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-g485-8j3v-p6x8 in your dependencies?
O3 Security finds GHSA-g485-8j3v-p6x8 across npm dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.