Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(images): add referrerpolicy attribute for privacy protection#2588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
AldenWangExis wants to merge2 commits intocotes2020:master
base:master
Choose a base branch
Loading
fromAldenWangExis:feat/img-referrerpolicy

Conversation

@AldenWangExis
Copy link

@AldenWangExisAldenWangExis commentedNov 13, 2025
edited
Loading

Type of change

  • New feature (non-breaking change which adds functionality)

Description

This PR adds referrer policy support to prevent HTTP Referer headers from being sent when loading images. This enhancement is particularly useful for:

  1. Privacy protection: Prevents external image hosts from tracking where images are being displayed
  2. Hotlink protection bypass: Enables displaying images from platforms with referrer-based hotlink protection (e.g., WeChat Official Account images)
  3. Enhanced security: Reduces information leakage to third-party image servers

Changes Made

1. Meta Tag in Head (head.html)

Added<meta name="referrer" content="never"> to the document head for global referrer policy.

2. Image Tag Attributes (refactor-content.html)

Modified the image processing logic to injectreferrerpolicy="no-referrer" attribute to all dynamically generated<img> tags in post content.

3. Sidebar Avatar (sidebar.html)

Addedreferrerpolicy="no-referrer" attribute to the avatar image in the sidebar.

Additional context

Opened#2586

Testing

Tested with:

  • WeChat Official Account images (mmbiz.qpic.cn domain)
  • Various image formats (jpg, png, gif)
  • Both lazy-loaded and LQIP images
  • Avatar images in sidebar
  • Images with different Kramdown attributes (.shadow)

Branch Information

  • Base branch:master (or latest release branch)
  • Feature branch:feat/img-referrerpolicy
  • Commits: 2 commits
    • feat(images): add referrerpolicy attribute for privacy protection
    • feat(privacy): add referrer meta tag to prevent information leakage

Add <meta name="referrer" content="never"> to document headfor enhanced privacy protection and hotlink bypass capability.This prevents browsers from sending HTTP Referer headers whenloading external resources, particularly useful for:- Displaying images from platforms with referrer-based hotlink protection- Reducing information leakage to third-party servers- Enhancing user privacyImplements W3C Referrer Policy specification.
Inject referrerpolicy="no-referrer" to image tags in:- refactor-content.html: post content images- sidebar.html: avatar imagePrevents Referer header leakage and enables displaying imagesfrom platforms with referrer-based hotlink protection.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@AldenWangExis

[8]ページ先頭

©2009-2025 Movatter.jp