Skip to content

security: escape API values before rendering, add a security policy - #18

Merged
9t29zhmwdh-coder merged 1 commit into
mainfrom
security/escape-api-values
Jul 31, 2026
Merged

security: escape API values before rendering, add a security policy#18
9t29zhmwdh-coder merged 1 commit into
mainfrom
security/escape-api-values

Conversation

@9t29zhmwdh-coder

Copy link
Copy Markdown
Owner

Was mir aufgefallen ist

RepoLedger rendert die Repos irgendeines GitHub-Accounts, den du eintippst, also fremde Daten. Diese Werte gingen ungefiltert in ein innerHTML-Template. Eine Escaping-Funktion gab es im ganzen File nicht.

Wie schlimm ist das

Heute nicht ausnutzbar, und das sage ich deutlich, damit es nicht dramatischer klingt als es ist. Die angezeigten Felder sind von GitHub formatbeschränkt: Repo-Namen erlauben nur A-Za-z0-9._-, Sprachen und SPDX-Kennungen kommen aus festen Listen, der Rest sind Zahlen und Daten. Da passt kein Markup rein.

Trotzdem zugemacht. Die Beschränkung, die das sicher macht, ist GitHubs, nicht die dieser Seite, und sie gilt genau für diese Felder. Wer später die Repo-Beschreibung oder die Topics in die Tabelle nimmt, beides Freitext, hätte sofort eine Injektionsstelle, und im Code stünde nichts, was sie abfängt.

Geprüft

Die Funktion gegen fünf Eingaben laufen lassen, inklusive null und undefined:

"<script>alert(1)</script>"  ->  "&lt;script&gt;alert(1)&lt;/script&gt;"
"\" onmouseover=\"x"          ->  "&quot; onmouseover=&quot;x"
"normal-repo_name.js"        ->  "normal-repo_name.js"
null                         ->  ""

Für dich als Nutzer: an der Anzeige ändert sich nichts. Repo-Namen und Sprachen sehen genauso aus wie vorher, weil sie keine Sonderzeichen enthalten.

Ausserdem: SECURITY.md

Das Repo hatte keine. Es ist ein öffentliches Tool, das eine API anspricht und optional einen Personal Access Token entgegennimmt, und es gab keinen privaten Weg, ein Problem damit zu melden. Die Datei beschreibt auch, was mit dem Token passiert: er bleibt in der Seite, wird nicht gespeichert und geht nur an GitHub.

Nebenwirkungen

Version 1.1.7 mit CHANGELOG-Eintrag.

The table renders repositories belonging to whichever account you point the
page at, and every value went straight into an innerHTML template. There was
no escaping function in the file at all.

Nothing displayed today can carry markup: GitHub constrains repository names
to A-Za-z0-9._-, and languages and SPDX identifiers come from fixed lists. So
this is not an exploitable hole, and calling it one would be overstating it.

It is still worth closing. The constraint that makes those fields safe belongs
to GitHub, not to this page, and it covers exactly the fields shown now.
Adding a repository description or a topic list, both free text, would create
an injection point with nothing in the code to catch it.

Also adds SECURITY.md. This is a public tool that talks to an API and
optionally takes a personal access token, and there was no private route for
reporting a problem with it.
@9t29zhmwdh-coder
9t29zhmwdh-coder merged commit 559e845 into main Jul 31, 2026
2 checks passed
@9t29zhmwdh-coder
9t29zhmwdh-coder deleted the security/escape-api-values branch July 31, 2026 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant