feat: safely expand Confluence /x/<key> shortened links - #19
Merged
Conversation
…ct chain resolve_page_id_from_url now transparently resolves Confluence's /x/<key> shortened links (including Cloud's /wiki/x/<key> format) and the tinyurl.action?urlIdentifier=... hop they redirect through, before falling back to the existing pageId/spaces/display/spaceKey+title patterns. Redirects are never auto-followed; each hop's Location is validated (HTTPS, no userinfo, same origin) before being trusted, bounded by MAX_REDIRECT_HOPS to prevent an unbounded chain. The initial URL must itself be HTTPS, checked before any request is sent so the access token is never transmitted in cleartext.
trickstar0301
force-pushed
the
worktree-shorten-url
branch
from
August 20, 2026 20:40
dffebbf to
38a381f
Compare
takeoverjp
requested changes
Aug 21, 2026
takeoverjp
left a comment
Contributor
There was a problem hiding this comment.
@trickstar0301
Thank you very much for your first contribution to confluence2md! 🎉
This is a very valuable feature, and I learned a lot from reviewing your PR 😍
I've suggested very slight modification 📝
Could you please check it?
Co-authored-by: Kondo Takeo <takeoverjp@gmail.com>
takeoverjp
approved these changes
Aug 23, 2026
takeoverjp
left a comment
Contributor
There was a problem hiding this comment.
Thank you!
LGTM 👍
I'll release it soon!
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
is_confluence_short_url/expand_confluence_short_urltoconfluence.rsto resolve Confluence's shortened/x/<key>links (including Cloud's/wiki/x/<key>format) before page-ID resolution.Locationheader is only trusted after validating it is HTTPS, carries no userinfo, and is same-origin (host + port) with the short URL. The short URL itself must also be HTTPS, checked before any request is sent so the access token is never transmitted in cleartext.User-Agentversion string (now derived fromCARGO_PKG_VERSION).Test plan
mise run ci(fmt, clippy-D warnings, build,cargo test --all-targets,cargo machete) passes locallyLocationresolution, and Confluence Cloud short-link path detection