GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Hacksore/github-websocket-api: Reverse engineering the Github websocket API - alive.github.com

BranchesTags
Open more actions menu

Latest commit

 

History

13 Commits
13 Commits

Folders and files

NameName
Last commit message
Last commit date
.env.example
.env.example
 
 
.gitignore
.gitignore
 
 
DOM.md
DOM.md
 
 
README.md
README.md
 
 
client.ts
client.ts
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 
util.ts
util.ts
 
 
yarn.lock
yarn.lock
 
 

Repository files navigation

github-websocket-pipelines-api

Github has an undocumented websocket API hosted on alive.github.com for some realtime interactions.

🟡 Mildly Blocked

Able to get data if I reuse the payload that is sent from a real client to subscribe. Can't figure out how to craft the packet fully yet.

Events

  • Workflow Run
  • Notification Changed
  • Check Suites

New intel

It seems the session is in two parts, one a base64 encoded string with the payload seen below.

Schema: <base64String>--<sessionIdentifierFromDOM>

This is what the github webpage has as the first part session field in the websocket query string.

{
  "v": "V3",
  "u": "<userId>",
  "s": "<number>",
  "c": "<number>",
  "t": "<number>"
}

another piece of intel is how you subscribe to events, this is the decoded part of what the client will send as the first part.

{ "c": "notification-changed:<userId>", "t": 1667188552 }

check suites payload to send as the first part.

{ "c": "check_suites:<jobId>", "t": 1667192074 }

Auth

If use a valid user_session cookie you can request github and extract the websocket URL from the page.

The script is doing this automatically now.

How to run

  1. Create an .env file, copy the example. Source both your user id and a user session
  2. run yarn to install the deps
  3. run yarn start to start the client

Payloads/Events

I've attempted to give a good description to each of these payloads below.

ack

This is seems to be returned not matter what you send to the API.

{
  "e": "ack",
  "off": "1667055219967-0",
  "health": true
}

subscribe

This is what the client will send when you visit a github page. It looks to be asking github

please give me events for <sessionId>

{
  "subscribe": {
    "<sessionId>": ""
  }
}

unsubscribe

This is what the client will send when you navigating to a new page on github. It looks to be tell github saying

please unsubscribe me for all previous <sessionId> event subscriptions

{
  "unsubscribe": ["<sessionId>"]
}

notification-changed

This is emitted whenever the indicator needs to update. Anything that will leave items in your notifications inbox will trigger this.

{
  "e": "msg",
  "ch": "notification-changed:<userId>",
  "off": "1667056418489-0",
  "data": { "indicator_mode": "none", "wait": 371.57200000000006 }
}

workflow_run

This is emitted whenever a workflow run starts.

{
  "e": "msg",
  "ch": "workflow_run:<runId>:execution",
  "off": "1667059757243-0",
  "data": {
    "timestamp": "2022-10-29T16:09:15.000Z",
    "wait": 372.463,
    "reason": "Execution created"
  }
}

check_suites

This is emitted whenever a workflow job updates and has two states in the reason field. It can either be in_progress or completed.

{
  "e": "msg",
  "ch": "check_suites:<jobId>",
  "off": "1667056504426-0",
  "data": {
    "timestamp": "2022-10-29T15:15:04.000Z",
    "wait": 396.523,
    "reason": "check_suite #<jobId> updated: <state>",
    "log_archive": false
  }
}

Example

See demo in client.ts

Investigating

  • How do I get a jobId that is used

About

Reverse engineering the Github websocket API - alive.github.com

Topics

githubgithub-hackinggithub-reverse-engineeringrealtimereverse-engineering

Resources

Readme

Security policy

Security policy
Activity

Stars

17 stars

Watchers

2 watching

Forks

2 forks
Report repository

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.