(path: string)
| 204 | } |
| 205 | |
| 206 | async function readToken(path: string): Promise<string | null> { |
| 207 | try { |
| 208 | const raw = await readFile(path, 'utf8') |
| 209 | return raw.trim() || null |
| 210 | } catch (err) { |
| 211 | if (isENOENT(err)) return null |
| 212 | logForDebugging( |
| 213 | `[upstreamproxy] token read failed: ${err instanceof Error ? err.message : String(err)}`, |
| 214 | { level: 'warn' }, |
| 215 | ) |
| 216 | return null |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | /** |
| 221 | * prctl(PR_SET_DUMPABLE, 0) via libc FFI. Blocks same-UID ptrace of this |
no test coverage detected