Fix Ollama authentication#165
Merged
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wos-sessionsupport with exact legacy and numeric-chunk NextAuth cookie matching.POST /api/web_searchbefore public/api/tags.core::is_same_origincomparator and extracts the Ollama settings redirect sequence intofetch_settings_html_at.Upstream mapping
30ae39a7e: AuthKit cookie discovery and manual validation.aa401f1d8: WorkOS/sign-in redirect classification.8f4cf6819: authenticated API-key probe before catalog fetch.6b3e8a026: unproven422fails closed; cancellation is not converted into a success-shaped fallback.58732f0bb: validation/catalog same-origin guard.16defab54: this port has fixed HTTPS endpoints rather than configurable endpoint overrides.Security invariants
https://ollama.comand the current request path are serialized; sibling-domain and path-scoped cookies never cross their scope.signin.ollama.com, WorkOS authorization, and all cross-origin redirects stop withAuthRequiredbefore a credentialed follow-up.ollama.com.200/400proves a key;401/403are invalid/revoked, and other statuses fail before catalog fetch.Already present / non-applicable
Validation
Initial RED/GREEN: focused Ollama tests failed before AuthKit, WorkOS redirect, authenticated validation, cookie scope, redirect-path scope, and exact NextAuth chunk behavior were added; then passed.
Follow-up RED/GREEN: focused tests were added for the canonical same-origin helper, per-hop cookie scope recomputation, mockito same-origin redirect flow, signin/WorkOS terminal redirects, and bounded redirect exhaustion before the redirect seam was extracted; core HTTP (4) and Ollama (17) focused tests passed.
Fresh full validation:
cargo fmt --manifest-path rust/Cargo.toml --all -- --checkcargo fmt --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml --all -- --checkcargo test --manifest-path rust/Cargo.toml(544 passed)cargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml(303 passed)cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warningscargo clippy --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml --all-targets -- -D warningsgit diff --checkManual Windows validation with a real authenticated browser profile was not run, to avoid accessing user credentials; native tests cover cookie scope and request sequencing.