Skip to content

feat: auto-detect auth walls after successful authentication#63

Merged
avifenesh merged 7 commits intomainfrom
feature/auto-detect-auth-walls-34
Feb 24, 2026
Merged

feat: auto-detect auth walls after successful authentication#63
avifenesh merged 7 commits intomainfrom
feature/auto-detect-auth-walls-34

Conversation

@avifenesh
Copy link
Collaborator

Summary

  • Add auth wall detection module (scripts/auth-wall-detect.js) using three-heuristic AND logic: domain cookies exist, URL matches auth patterns, and DOM contains login elements
  • Integrate detection into the goto action - when an auth wall is detected, automatically closes headless browser and relaunches in headed mode for a checkpoint
  • Add --no-auth-wall-detect opt-out flag
  • Return authWallDetected and checkpointCompleted fields in goto response when triggered

Test Plan

  • 19 unit tests for auth-wall-detect.js covering all heuristics, edge cases, error handling, real-world providers (Google, Microsoft)
  • 7 integration tests verifying web-ctl.js source-level integration
  • All 443 tests pass (26 new, 0 regressions)
  • Manual test: auth with a provider, goto URL that triggers auth wall, verify checkpoint opens

Related Issues

Closes #34

Three-heuristic AND-logic detection:
1. Domain cookies exist for target URL
2. Current page URL matches auth patterns
3. DOM contains login elements or text

Short-circuits on first failing heuristic for efficiency.
When navigating via goto, automatically detect auth walls using the
three-heuristic module. On detection: close headless browser, relaunch
headed for interactive checkpoint, return post-auth snapshot.

Opt out with --no-auth-wall-detect flag.
Unit tests for the detection module with 14 test cases covering:
- Three-heuristic AND logic (each can fail independently)
- Cookie domain matching (parent + exact)
- Real-world providers (Google, Microsoft)
- Error handling for page.$ and textContent failures
- Exported constants validation

Integration tests verifying web-ctl.js source-level integration.
…add tests

- Parallelize DOM selector checks with Promise.allSettled (perf)
- Limit textContent to first 5000 chars (perf/memory)
- Cap checkpoint timeout at 3600s max (security)
- Add tests for invalid URL and cookie read error paths
- Add case-insensitive URL matching test
@avifenesh avifenesh merged commit 2e56c85 into main Feb 24, 2026
2 of 3 checks passed
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.

Auto-detect auth walls after successful authentication

1 participant