Commit Graph
11 Commits
Author SHA1 Message Date
SirHumza c01fc3fb10 WIP: SDK-port net branches + findings archive 2026-09-23 16:56:25 +02:00
SirHumza 96c02b8cb4 WIP: debug gate, monotonic clock, titleId sessions, debounce, resolve cache 2026-09-22 17:58:07 +02:00
SirHumza cdb431cfa6 Names tiers, SFO parser, close-frame/diagnostics hardening
- detect: cost-tiered resolution; plugin path skips multi-MB app.db
  scan (game-process safety); payload tries pronunc, sfo, appxml,
  baked table, then app.db; sfo TITLE via app0/sce_sys paths
- sfo.c: bounds-checked PARAM.SFO parser + unit tests incl malformed
- nametable: generated fallback from title DB + generator script
- discord: malformed close frames reconnect loudly; one-time warning
  when artwork requested but no application_id configured
- ws comments de-BearSSLed; gitignore covers artifacts; drop .DS_Store,
  untrack test binary; README art claim corrected
2026-09-19 01:37:55 +02:00
SirHumza bf5579d6da Stable gateway backend: mbedTLS, 8MB READY, JSON-safe parsing
- BearSSL replaced with mbedTLS (TLSv1.3 passes Cloudflare)
- 8MB frame cap + truncation-proof gateway op/seq scanner
- Thread-safe compat, locked logging, atomic config with template
- Daemon keeps last-good config, persistent presence timer
- 256B token buffers, weak-libc shims, portable build preflights
- Tests: gateway spoof + OOM cases pass

Still open: display names fall back to titleId in sandbox,
cover art needs shared Discord app assets. Backend fully functional.
2026-09-19 01:03:17 +02:00
SirHumza 6dbfa1512c Harden networking, lifecycle, and build validation
Add BearSSL integration, strict utility handling, WebSocket validation,
plugin lifecycle cleanup, host regression tests, and reproducible GoldHEN
build support.
2026-08-27 20:38:39 +02:00
SirHumza 949240f590 daemon: auth via user session token; fix ws/gateway protocol bugs
The public Discord gateway rejects OAuth2 access tokens (close 4004),
so v1 could never set presence: switch config to a raw user token and
delete the oauth/http module.

- handle close frames; exit fatal on 4004 instead of looping forever
- fix reversed IPv4 packing in sceNetConnect (wrong host)
- fix SSL_read treating WANT_READ/no-data as disconnect
- keep frame bytes glued to the 101 handshake response (HELLO)
- grow recv buffer for large READY payloads; drain-and-skip >2MB
- mask all client frames incl. control; overflow-safe length checks
- drop RESUME (was dead: connect wiped session_id); fresh IDENTIFY
- clear presence stays online, add elapsed timestamps
- tick gateway every second so heartbeats never land late
- connect backoff 5s..300s; live config reload each cycle
2026-08-23 11:07:38 +02:00
SirHumza 58a8017a87 stealth: add capabilities + presence to identify, drop Origin header
Real desktop clients send the gateway capabilities bitfield and an
initial presence inside IDENTIFY, and native clients do not send an
Origin header on the WebSocket upgrade. Match all three for a closer
desktop-client profile.
2026-08-14 20:33:12 +02:00
SirHumza a726d3dcb6 stealth: plausible desktop-client fingerprint instead of PS4/orbisRPC
- identify properties now present a Windows Discord desktop fingerprint
  (os windows, browser 'Discord Client', Electron UA) rather than
  advertising os:'PS4', browser:'orbisRPC'
- HTTP user-agent (API calls + WS upgrade) now a desktop-client UA
  instead of 'orbisRPC/1.0'
2026-08-14 20:28:47 +02:00
SirHumza d40fc600c4 revise: fix TLS handshake, heartbeat ack, RESUME, seq parse, party
ws: SSL_connect on the non-blocking socket now polls WANT_READ/WANT_WRITE
  with a deadline (previously it would fail the very first handshake);
  handshake response read in chunks so the 5s deadline can't spuriously
  trip; ws_send_text errors on oversized frames instead of silently
  truncating; added ws_send_pong for RFC6455 server pings.
discord: heartbeat ack tracking -> reconnect on 2x-interval silence;
  handle op 7 (reconnect) and op 9 (invalid session, clears session_id);
  parse the sequence from the correct "s" field (was "seq", never
  matched, heartbeat always sent d:0); READY captures session_id for
  RESUME; reconnect now RESUMEs (op 6) when a session exists and falls
  back to IDENTIFY on invalid-session; party size now emitted in the
  activity; dropped the unused 'intent' arg; zeroed gateway-fetch buffer.
main: use config presence_state (was hardcoded); reset last_name after
  reconnect so the current game is re-pushed immediately.
cfg: clamp poll_interval_s to [5,300]; atomic config save (tmp+rename).
log: seconds in timestamps; rotate log at 512 KB.
jsonlite: jl_obj_get/jl_arr_at return non-const (fixes const-drop
  warnings); stringify emits proper "null" for missing pair values.
detect: trim whitespace around app.xml title; drop per-poll log spam.
2026-08-14 20:24:24 +02:00
SirHumza 90c86d9f1a fix: leaks, OOB read, handshake timeout, identify shape, b64 terminator
- jsonlite: jl_free leaked every object inside an array (sibling pairs,
  keys, values). Verified 39/39 allocs freed (was 15 leaked/presence).
- discord: IDENTIFY now sends required connection properties
  os/browser/device; dropped bot-only intents field for user connection.
- ws: recv_frame returns bytes actually copied (was full payload length ->
  jl_parse OOB read on >1023B frames); handshake SSL_read handles
  WANT_READ with 5s deadline (was infinite busy-wait); per-frame random
  client mask (RFC 6455 5.3) instead of static 0x12345678.
- main: daemon retries token/gateway failures instead of exiting
  (GoldHEN payload runs once per boot).
- b64: NUL-terminate output (callers relied on pre-zeroed buffers).
2026-08-14 19:58:57 +02:00
SirHumza af1a48dbf3 chore: rename project PS4RP -> orbisRPC
- Repo renamed to SirHumza/orbisRPC on GitHub
- Source dir PS4RP/ -> orbisrpc/
- Binaries ps4rp.{elf,fself,bin} -> orbisrpc.{elf,fself,bin}
- On-console config dir /data/PS4RP -> /data/orbisRPC
- Build outputs, HTTP UA, net pool/socket names, README, SETUP
  guide all updated to orbisRPC
2026-08-14 10:31:14 +02:00