Repository navigation
Conversation
AI-Assisted-By: Claude Opus 5.5 (xhigh)
This was referenced Oct 15, 2026
Author
|
Closing this here, as this repository is a mirror that only takes merge requests on GitLab. Moved to https://gitlab.com/ClearURLs/rules/-/merge_requests/88 |
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.
Covers GitLab issue 284 by @kalvdans. The same wrapper was reported here in #252 by @patrick-goli. Its example link has no scheme, which this rule leaves alone on purpose (see the examples), so #252 stays open.
Prerequisites
Description
LinkedIn wraps outbound links in two redirect pages:
linkedin.com/redir/redirect?url=…(for example certificate links on public profiles, see #252) andlinkedin.com/safety/go?url=…(the "You are leaving LinkedIn" page, for example for links in the feed, see GitLab issue 284). The destination is in theurlparameter, URL-encoded. This adds one redirection to the existingLinkedInprovider, so the link opens the destination directly without the LinkedIn hop.Safety of the pattern:
linkedin.com.example.orgdoes not match.http://orhttps://, plain or URL-encoded. The rule can never produce ajavascript:,data:or relative url, and an emptyurlis ignored.urlmay appear anywhere in the query; the capture stops at&or#.(?:[a-z0-9.-]*\.)?instead of the usual(?:[a-z0-9-]+\.)*?. Java's regex engine (URL Check, an Android app, ships this catalog) recurses once per repetition of a group, and the usual prefix overflowed a 512 KB thread stack at 5,000 host labels in a test. The class form handled inputs up to 160 KB in at most 10 ms, in Java and in JavaScriptCore.Affected fields
redirectionsof the providerLinkedInChange in data.min.json (provider
LinkedIn)Example URLs
https://www.linkedin.com/safety/go?url=https%3A%2F%2Fow.ly%2F1y7950PGZbq%3Ftrk%3Dfeed_main-feed-card-text(from GitLab issue 284)https://ow.ly/1y7950PGZbq?trk=feed_main-feed-card-texthttps://www.linkedin.com/redir/redirect?url=https%3A%2F%2Fexample%2Ecom%2Fcert%2F9hJUZz&urlhash=D0OThttps://example.com/cert/9hJUZzhttps://www.linkedin.com/safety/go?url=https%3A%2F%2Fexample.com%2F&trk=flagship-messaging-webhttps://example.com/https://www.linkedin.com/redir/redirect?url=www%2Eefset%2Eorg%2Fcert%2F9hJUZz&urlhash=D0OT(from #252)https://www.linkedin.com.evil.example/redir/redirect?url=https%3A%2F%2Fexample.com%2Fhttps://www.linkedin.com/redir/redirect?url=javascript%3Aalert(1)&urlhash=xhttps://www.linkedin.com/redir/redirect?urlhash=D0OTtrkstays in the first result: after the redirect it belongs to the ow.ly url, andtrkis too common a name for a global rule.Testing
Tested offline in URL Check 3.5 (Android 15 emulator), which applies this catalog with Java regexes: the current catalog plus this change gave the expected result in all 8 LinkedIn test cases (3 unwrapped, 5 unchanged; the table shows 7 of them, the 8th is a second destination without scheme), and in 50 of 50 cases together with the two companion changes (globalRules, instagram/vk). Without the change all 8 stay unchanged apart from
trkremoval. The pattern gives the same results in JavaScriptCore, with and without theiflag. Inputs up to 160 KB (long hosts, many parameters, long tokens) took at most 10 ms per pattern in Java and 8 ms in JavaScriptCore, with no stack overflow at a 512 KB thread stack.Companion PRs: #346 (instagram and vk.com redirections), #347 (globalRules). The three change different fields and merge without conflict in any order.
AI-Assisted-By: Claude Opus 5.5 (xhigh)