Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

NotificationsYou must be signed in to change notification settings

Hacksore/github-websocket-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Github has an undocumented websocket API hosted onalive.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 thesession 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 partsession 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 validuser_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. runyarn to install the deps
  3. runyarn 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 thereason field. It can either bein_progress orcompleted.

{"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 inclient.ts

Investigating

  • How do I get ajobId that is used

About

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

Topics

Resources

Security policy

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp