fix(cli): honest User-Agent token on linkedin-search

The last portal CLI still sending a full Chrome spoof after #283 and
4551346. Live-verified: search and detail endpoints serve identical
responses to Mozilla/5.0 (compatible; linkedin-search-cli/1.0).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Mads Lorentzen
2026-08-07 15:53:46 +02:00
co-authored by Claude Fable 5
parent beb53f1a9f
commit da12d6e38e
2 changed files with 7 additions and 3 deletions
@@ -12,9 +12,7 @@ export function writeError(error: string, code: string): void {
process.stderr.write(JSON.stringify({ error, code }) + "\n")
}
const UA =
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 " +
"(KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
const UA = "Mozilla/5.0 (compatible; linkedin-search-cli/1.0)"
/** Fetch HTML with exponential backoff on 429/5xx. Returns "" on a 404. */
export async function htmlFetch(url: string): Promise<string> {
+6
View File
@@ -51,6 +51,12 @@ per-file diff commands.
### Fixed
- **The linkedin-search CLI identifies honestly** - its `User-Agent` was a full Chrome
browser string, the last portal CLI still spoofing after #283 and the jobbank/jobdanmark
fix. It now sends `Mozilla/5.0 (compatible; linkedin-search-cli/1.0)`, the same token
format as every other portal. Verified live on both the search and detail endpoints:
identical 200 responses with full content under the honest token.
- **A `.env` was committable** (`.gitignore`, `tools/security_guards.py`). `/add-portal`
can generate a skill for a portal that only returns usable content through a paid
fetching service, and such a skill reads an API token from the environment - but