Your GitHub Token Can Be Stolen With One Click — Here Is What Developers Need to Know

If you use VSCode and have ever opened a GitHub repository through github.dev or the web-based editor, there is a critical vulnerability you should know about right now. A single clicked link — nothing more — can give an attacker full read-write access to every repository in your GitHub account, including private ones.

This is not a theoretical risk. The bug was just disclosed publicly by security researcher Ammar Askar, and it is currently the top story on Hacker News with nearly 300 upvotes and hundreds of comments. Here is what is going on and what you should do about it.

The Short Version

When you open a repository on github.dev, GitHub sends an OAuth token to that browser-based VSCode instance. This token is not scoped to a single repository — it has full access to every repo you can reach. A flaw in how VSCode handles webview keyboard events means a malicious page rendered inside a VSCode webview (Markdown preview, Jupyter notebook, or any rendered HTML) can spoof keyboard input, programmatically open the command palette, and exfiltrate that token — all triggered by you clicking a single link.

In other words: you click a link in a Markdown file, and someone now has your GitHub credentials.

How the Attack Works

To understand the exploit, you need to know how VSCode sandboxes untrusted content.

Webview Isolation

VSCode renders untrusted content — Markdown previews, Jupyter notebook outputs, HTML files — inside <iframe> elements called "webviews." These iframes use a different origin (vscode-webview://) from the main VSCode window (vscode-file://), which isolates them via the browser's same-origin policy. JavaScript running inside the webview cannot directly access VSCode's APIs or the Node.js layer.

This is good security design. But the isolation creates a usability problem: keyboard shortcuts like Ctrl+Shift+P need to work even when your cursor is inside a webview.

The Keyboard Event Leak

To solve this, VSCode registers a keydown event listener inside the webview that forwards every keystroke to the main VSCode window via postMessage. This is how your keyboard shortcuts keep working regardless of where you click.

Here is the problem: the same mechanism that forwards your real keystrokes also accepts fake keystrokes. A script running inside the untrusted webview can call postMessage directly, pretending the user pressed Ctrl+Shift+P, typing commands, and hitting Enter. The main VSCode window has no way to distinguish spoofed events from real ones.

The Exploit Chain

The full attack sequence works like this:

  1. You open a repository on github.dev, which receives a full-access OAuth token.
  2. You view a Markdown file (or Jupyter notebook, or any content that renders in a webview) that contains a crafted malicious payload.
  3. The payload's JavaScript sends spoofed did-keydown messages to open the VSCode command palette.
  4. It types commands through more spoofed keystrokes to access VSCode's internal APIs and extract the stored GitHub OAuth token.
  5. The token is exfiltrated to an attacker-controlled server.

All of this happens after a single click. No file downloads, no code execution prompts, no warnings.

Why This Matters More Than You Think

You might be thinking: "I do not browse random repos on github.dev." But the attack surface is wider than that:

  • Pull requests: Reviewing a PR from an external contributor means rendering their Markdown and HTML in your webview.
  • README files: Any repo you navigate to could contain weaponized content in its README.
  • Jupyter notebooks: Running community notebooks from GitHub renders arbitrary HTML inside webviews.
  • Issues and wiki pages: Any rendered content in the GitHub ecosystem passes through these same mechanisms.

The token itself is the real prize. With it, an attacker can read and write to all your repositories — including private ones. They can inject backdoors, steal intellectual property, or use your account to distribute malware to anyone who trusts your projects.

What VSCode Did Right

It is worth noting that VSCode's architecture was not careless. The webview sandbox is a legitimate security boundary, and the cross-origin isolation is correctly implemented. The bug is specifically in the keyboard event forwarding mechanism — a trade-off between usability and security that was exploited in an unexpected way. VSCode has a responsible disclosure process and the researcher did coordinate with the team before going public.

Immediate Steps for Developers

  1. Update VSCode immediately. If a patch has been released, apply it now. The fix likely validates the origin or authenticity of keyboard events.
  2. Revoke and rotate GitHub tokens. Go to GitHub Settings → Applications → Authorized OAuth Apps and review what tokens are active. Revoke any that look suspicious.
  3. Use fine-grained personal access tokens instead of broad OAuth tokens wherever possible. Scope tokens to specific repositories.
  4. Be cautious with github.dev links. Until you confirm you are patched, avoid opening github.dev from untrusted sources.
  5. Review rendered content settings. In VSCode, you can disable trusted mode for webviews or use stricter Markdown rendering policies.
  6. Enable two-factor authentication on your GitHub account if you have not already. Token theft is less damaging when 2FA blocks unauthorized logins from new devices.

The Bigger Picture

This vulnerability highlights a recurring theme in developer tool security: the tension between convenience and safety. VSCode is fundamentally an Electron app running JavaScript with access to your filesystem and network. Every feature that makes it feel seamless — previewing files, running notebooks, editing in the browser — expands the attack surface.

As AI-powered coding assistants like GitHub Copilot become deeply integrated into our editors, this tension will only grow. These tools need broad access to your code, your tokens, and your development environment to function. That makes the security of the host editor more critical than ever.

Supply chain attacks are no longer limited to package managers and dependency trees. Your IDE is part of the supply chain now. Treat it accordingly.

Takeaways

Security researcher Ammar Askar chose full disclosure, arguing that the risk to developers warranted immediate public awareness. Whether you agree with that decision or not, the vulnerability is real and the exposure is significant.

The key lessons:

  • Always assume rendered content — even in your trusted editor — can be hostile.
  • Broad-scope tokens are a liability. Minimize their scope and lifespan.
  • Keep your development tools updated. Security patches are not optional maintenance.
  • The convenience of web-based development tools comes with real security trade-offs.

This is one of those vulnerabilities that makes you rethink your daily workflow for a moment — and then go update your tools. Do the update.