feat(search): Google-style search operators, server security hardening, Material 3 web UI#96
Merged
Conversation
…forced on-device Adds a pure QueryOperators parser for "exact phrase", -term, -"phrase", site:/-site:, intitle:/-intitle:, inurl:/-inurl:, filetype:/ext:, before:/after: (YYYY[-MM[-DD]] and YYYY/MM/DD), and OR/|. Operators the upstream engines understand (quotes, exclusions, site:, filetype:, OR) are forwarded in original token order; the rest become recall hints or are dropped, and every structural filter is enforced locally over the aggregated results so behavior is consistent across engines that ignore an operator. The operator-free text now drives lexical relevance (a vertical's site: clause no longer pollutes it), sorting, personalization, the contextual summary, and the on-device spell corrector (skipped for operator-laden queries). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016AYAgNYmBkxsEYcgzSAjgT
…ening Security: reject the forgeable 'Origin: null' on mutation POSTs (a page setting its own no-referrer policy, or a sandboxed iframe, could forge it and bypass the CSRF guard) and serve Referrer-Policy: same-origin so our own form posts carry a real origin; add Content-Security-Policy, Cache-Control: no-store, and Permissions-Policy on every response; make the network-mode token comparison constant-time and accept the token via Authorization: Bearer or X-SearchMob-Token headers in addition to the ?token= query parameter. UI: restyle the served pages to Material 3 (search-bar elevation and focus states, 16px-radius cards, pill buttons, chip and state-layer hovers with plain fallbacks, theme-derived active-tab colors instead of hardcoded hex) and add a collapsible search-operators cheat sheet under the home search box. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016AYAgNYmBkxsEYcgzSAjgT
…rs-material-ui-lv3vpe
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.
What & why
Three related upgrades to the search pipeline and the served (loopback/network) web UI, so SearchMob queries work like the major engines' do:
Google-fu search operators (engine layer). A new pure
QueryOperatorsparser supports"exact phrase",-term,-"phrase",site:/-site:(incl..edu-style TLD entries and*.hostnormalization),intitle:/-intitle:,inurl:/-inurl:,filetype:/ext:,before:/after:(YYYY,YYYY-MM,YYYY-MM-DD,YYYY/MM/DD, UTC), andOR/|. Operators the upstream engines understand are forwarded in original token order; the rest become bare recall hints or are dropped, and every structural filter is additionally enforced on-device over the aggregated results, so behavior is consistent even for engines that ignore an operator. The operator-free text now drives lexical relevance (fixing a pre-existing issue where a vertical'ssite:OR-group polluted relevance scoring), sorting, personalization, the Wikipedia summary lookup, and the spell corrector (skipped for operator-laden queries). Works identically in-app and on the served page.Security fixes (served pages).
Origin: nullwas treated as same-origin, but an attacker page can forge exactly that (its ownReferrer-Policy: no-referrer, or a sandboxed iframe) on a cross-site POST to the loopback server.Origin: null/ unparseable origins are now rejected, and the server servesReferrer-Policy: same-originso its own form posts carry a real origin (cross-origin still leaks nothing; result links keeprel="noreferrer").Content-Security-Policy(default-src 'none',form-action 'self',frame-ancestors 'none', …),Cache-Control: no-store, andPermissions-Policyon every response.MessageDigest.isEqual) and can be presented viaAuthorization: BearerorX-SearchMob-Tokenheaders, not just the history-leaking?token=query parameter (which stays for OpenSearch templates).Material 3 web UI. The served pages are restyled to Material 3: elevated 28px search bar with focus/hover states, 16px-radius cards, pill buttons, chip state layers (
color-mix()with plain fallbacks declared first), theme-derived active-tab colors replacing hardcoded hex, extended focus-visible rings, and a collapsible "Search operators" cheat sheet under the home search box. All theme-registry CSS variables and test-pinned markup kept intact. (The Android GUI is already Compose Material 3 and was intentionally left alone.)Relates to OpenSpec change: n/a (no OpenSpec change directory in this repo)
Checklist
feat//fix/branch offmain./gradlew ktlintCheck lint test assembleDebugis green locally — the sandbox cannot reachdl.google.com/the Gradle distribution, so this relies on CI; the new/changed pure-JVM engine code was compiled and its 47 new unit tests run green with a standalone Kotlin 2.4.0 compiler, and ktlint (CLI) reports no new findings vs.mainOrigin: nullbehavioropenspec validate <name> --strict) and tasks are checked off — n/a🤖 Generated with Claude Code
https://claude.ai/code/session_016AYAgNYmBkxsEYcgzSAjgT
Generated by Claude Code