Skip to content

Make the session-refresh test own every Supabase env var it reads - #206

Merged
ralyodio merged 1 commit into
masterfrom
proxy-test-env
Sep 5, 2026
Merged

Make the session-refresh test own every Supabase env var it reads#206
ralyodio merged 1 commit into
masterfrom
proxy-test-env

Conversation

@ralyodio

@ralyodio ralyodio commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Fix for the deterministic CI failure introduced by #205

Run Tests on master (runs 33978537165, 33978629242) failed on
src/proxy.test.ts > Supabase session refresh and referral cookie > refreshes an expiring session for a browser and writes the new tokens back with expected '***' to be 'anon-key', which blocks the droplet deploy.

Cause. refreshSession reads process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || process.env.SUPABASE_ANON_KEY at call time. The test stubbed only SUPABASE_ANON_KEY, so in CI the real NEXT_PUBLIC_SUPABASE_ANON_KEY won. The URL pair has the opposite precedence (SUPABASE_URL first), which is why that assertion passed. Not an import-time read; the env is read lazily inside the function.

Fix. The test stubs all four variables (SUPABASE_URL, NEXT_PUBLIC_SUPABASE_URL, SUPABASE_ANON_KEY, NEXT_PUBLIC_SUPABASE_ANON_KEY) in beforeEach and unstubs in afterEach, so it owns every value the code can read. One-file change, no production code touched.

Proof.

  • Pre-fix test with NEXT_PUBLIC_SUPABASE_ANON_KEY=real-looking-key NEXT_PUBLIC_SUPABASE_URL=https://x.supabase.co: 1 failed, expected 'real-looking-key' to be 'anon-key' (CI's failure reproduced).
  • Fixed test with those set (plus SUPABASE_URL/SUPABASE_ANON_KEY set to other values): 27 passed.
  • Fixed test with all four unset: 27 passed.
  • pnpm test: 2731 passed, 9 skipped, 0 failed. pnpm typecheck: clean. pnpm lint: 0 errors (248 pre-existing warnings).

🤖 Generated with Claude Code

https://claude.ai/code/session_01WJaXiqE9BDoNfoJBhfXroC

CI failed on "refreshes an expiring session for a browser and writes the
new tokens back" with `expected '***' to be 'anon-key'`: the test stubbed
SUPABASE_ANON_KEY but refreshSession prefers NEXT_PUBLIC_SUPABASE_ANON_KEY,
which CI sets to the real key. The URL pair has the opposite precedence,
so that half passed by luck. Stub all four variables so the test passes
with and without real keys in the environment.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJaXiqE9BDoNfoJBhfXroC
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

ThreatCrush Security Scan

99 finding(s)

HIGH/CRITICAL: 11 | MEDIUM: 29 | LOW: 59

Severity Rule Location
HIGH secret-private-key src/app/settings/seedbox-section.tsx:412
HIGH secret-generic-api-key docs/incidents/2026-05-okshanaby-supply-chain.md:18
HIGH tls-verification-disabled src/app/api/iptv-proxy/route.ts:38
HIGH tls-verification-disabled src/app/api/iptv/channels/route.ts:35
HIGH tls-verification-disabled src/app/api/iptv/playlists/[id]/route.ts:73
HIGH tls-verification-disabled src/app/api/iptv/playlists/route.ts:64
HIGH js-cors-origin-reflected src/app/api/public/shares/[slug]/checkout/route.ts:40
HIGH js-cors-origin-reflected src/app/api/public/vod/[slug]/checkout/route.ts:34
HIGH tls-verification-disabled src/lib/iptv/shares/upstream.ts:37
HIGH tls-verification-disabled workers/iptv-cache/epg-fetcher.ts:25
HIGH tls-verification-disabled workers/iptv-cache/playlist-fetcher.ts:62
MEDIUM secret-jwt .github/workflows/ci.yml:120
MEDIUM secret-jwt .github/workflows/ci.yml:121
MEDIUM secret-jwt .github/workflows/ci.yml:123
MEDIUM secret-jwt .github/workflows/ci.yml:162
MEDIUM secret-jwt .github/workflows/ci.yml:164
MEDIUM secret-jwt docs/tunein (2).py:9
MEDIUM secret-jwt docs/tunein.py:9
MEDIUM sh-remote-script-execution scripts/setup-server.sh:182
MEDIUM sh-remote-script-execution scripts/setup-server.sh:419
MEDIUM sh-remote-script-execution scripts/setup-server.sh:428
MEDIUM sh-unquoted-expansion-destructive scripts/setup-server.sh:1073
MEDIUM sh-unquoted-expansion-destructive scripts/setup-server.sh:1083
MEDIUM js-unescaped-html-sink src/app/api/player/route.ts:110
MEDIUM js-unescaped-html-sink src/app/api/player/route.ts:249
MEDIUM js-unescaped-html-sink src/app/blog/[slug]/page.tsx:40
MEDIUM js-unescaped-html-sink src/app/blog/[slug]/page.tsx:66
MEDIUM js-unescaped-html-sink src/app/email/email-content.tsx:566
MEDIUM js-open-redirect src/app/login/page.tsx:50
MEDIUM js-open-redirect src/app/pricing/page.tsx:161
MEDIUM js-open-redirect src/app/rent/[slug]/rent-client.tsx:170
MEDIUM js-unescaped-html-sink src/app/rss/rss-content.tsx:615
MEDIUM js-open-redirect src/app/vod/[slug]/vod-client.tsx:134
MEDIUM js-open-redirect src/app/watch/[slug]/watch-client.tsx:129
MEDIUM js-unescaped-html-sink src/app/youtube/youtube-content.tsx:546
MEDIUM js-open-redirect src/components/account/iptv-subscription-section.tsx:124
MEDIUM js-open-redirect src/components/account/iptv-subscription-section.tsx:156
MEDIUM js-unescaped-html-sink src/components/news/news-section.tsx:361
MEDIUM js-unescaped-html-sink src/components/news/news-section.tsx:734
MEDIUM redos-nested-quantifier src/lib/metadata-enrichment/metadata-enrichment.ts:317
LOW tls-verification-disabled docs/tunein (2).py:34
LOW tls-verification-disabled docs/tunein (2).py:37
LOW py-xpath-injection docs/tunein (2).py:37
LOW tls-verification-disabled docs/tunein (2).py:47
LOW py-xpath-injection docs/tunein (2).py:47
LOW tls-verification-disabled docs/tunein.py:34
LOW tls-verification-disabled docs/tunein.py:37
LOW py-xpath-injection docs/tunein.py:37
LOW tls-verification-disabled docs/tunein.py:47
LOW py-xpath-injection docs/tunein.py:47

…and 49 more. Full results in the Security tab.

Snippets are redacted; ThreatCrush never prints matched credential material.

@ralyodio
ralyodio merged commit ac208f1 into master Sep 5, 2026
9 checks passed
@ralyodio
ralyodio deleted the proxy-test-env branch September 5, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant