Skip to content

refactor: improve remote image resource handling#914

Open
psxjoy wants to merge 2 commits into
apache:mainfrom
psxjoy:chore_psx_20260511
Open

refactor: improve remote image resource handling#914
psxjoy wants to merge 2 commits into
apache:mainfrom
psxjoy:chore_psx_20260511

Conversation

@psxjoy
Copy link
Copy Markdown
Member

@psxjoy psxjoy commented May 11, 2026

Purpose of the pull request

What's changed?

Checklist

  • I have read the Contributor Guide.
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

@psxjoy psxjoy requested a review from Copilot May 11, 2026 15:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Introduces a configurable security policy for fetching remote images from URL cells, adding SSRF/redirect/size controls and corresponding unit tests.

Changes:

  • Added UrlImageFetchPolicy to define allowed schemes, private-network allowlists (hosts/CIDRs), redirect limits, and maximum image size.
  • Refactored UrlImageConverter to enforce the policy (scheme/host validation, redirect handling, byte limit, and image-type validation).
  • Added CidrBlock utility and a new JUnit test suite covering key policy behaviors.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
fesod-sheet/src/test/java/org/apache/fesod/sheet/converter/UrlImageConverterTest.java Adds tests for scheme restrictions, private-host/CIDR allowlisting, redirect behavior, content-type rejection, and size limits.
fesod-sheet/src/main/java/org/apache/fesod/sheet/converters/url/UrlImageFetchPolicy.java Adds the policy model + builder with normalization/validation for hosts/schemes and limit settings.
fesod-sheet/src/main/java/org/apache/fesod/sheet/converters/url/UrlImageConverter.java Refactors URL image fetching to enforce policy checks, redirect limits, and maximum read size; validates image type.
fesod-sheet/src/main/java/org/apache/fesod/sheet/converters/url/CidrBlock.java Adds CIDR parsing and matching used for private-network allowlisting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

@bengbengbalabalabeng
Copy link
Copy Markdown
Contributor

LGTM

@psxjoy psxjoy requested review from GOODBOY008, alaahong and delei May 12, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants