Filter obfuscation option - #1377
Open
fbacall wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new JS rehydration currently targets spans without data-filter-link (causing runtime errors) and the Ruby helper introduces Base64 without requiring the stdlib, which can raise NameError when enabled.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a configurable “filter link obfuscation” mechanism to reduce crawler-driven load by rendering facet filters as non-link elements in initial HTML and rehydrating them into links client-side, plus fixes a JS page-load error in the private groups toggle.
Changes:
- Add
obfuscate_filterssetting and controller coverage to verify facet links render as<a>vs obfuscated<span data-filter-link>. - Update
filter_linkhelper to optionally emit obfuscated spans containing a base64url-encoded URL. - Add client-side logic to convert obfuscated facet spans back into
<a>elements on page load; hardenshow_private_groups.jsagainst missing DOM nodes.
File summaries
| File | Description |
|---|---|
| test/controllers/materials_controller_test.rb | Adds coverage for obfuscated vs normal facet filter rendering. |
| config/tess.example.yml | Documents new obfuscate_filters config option. |
| app/helpers/search_helper.rb | Implements obfuscated rendering for facet filter links. |
| app/assets/javascripts/filters.js | Rehydrates obfuscated facet spans into real links on turbolinks:load. |
| app/assets/javascripts/show_private_groups.js | Prevents page-load errors when expected elements aren’t present. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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 of changes
spans with the href encoded via base64, that get turned into links via Javascript.Motivation and context
Malicious crawlers were following every href on the page, trying every filter permutation.
Checklist