Skip to content

Next patch release (v2.1.2) - #355

Open
Pfeil wants to merge 22 commits into
mainfrom
development
Open

Next patch release (v2.1.2)#355
Pfeil wants to merge 22 commits into
mainfrom
development

Conversation

@Pfeil

@Pfeil Pfeil commented Jul 27, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of encoded data entity identifiers when reading and writing crates.
    • Crate readers can now locate files using encoded or decoded names while keeping paths safely within the crate.
    • Saved files and ZIP entries now use decoded identifiers for consistent filenames.
    • Improved recovery when files have been renamed to encoded filenames.
  • Documentation

    • Added documentation clarifying how data entity paths behave when reading, creating, and writing crates.

dependabot Bot and others added 17 commits July 17, 2026 11:38
Bumps `jacksonVersion` from 2.22.0 to 2.22.1.

Updates `com.fasterxml.jackson.core:jackson-databind` from 2.22.0 to 2.22.1
- [Commits](https://github.com/FasterXML/jackson/commits)

Updates `com.fasterxml.jackson.datatype:jackson-datatype-jsr310` from 2.22.0 to 2.22.1

---
updated-dependencies:
- dependency-name: com.fasterxml.jackson.core:jackson-databind
  dependency-version: 2.22.1
  dependency-type: direct:production
- dependency-name: com.fasterxml.jackson.datatype:jackson-datatype-jsr310
  dependency-version: 2.22.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
…ot-read-back-in

fix: encoded paths are not read back
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Pfeil, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0a50e5a1-6e08-4bb8-9f9f-ab0ab5eb8751

📥 Commits

Reviewing files that changed from the base of the PR and between 90f814f and 3cd9985.

📒 Files selected for processing (4)
  • .github/workflows/codeql-analysis.yml
  • .github/workflows/gradle.yml
  • .github/workflows/publishRelease.yml
  • build.gradle
📝 Walkthrough

Walkthrough

Writers now decode entity IDs for folder and ZIP filenames. CrateReader resolves both decoded and original filename candidates within the crate directory. Tests cover encoded IDs, alternate filenames, path detection, and filename restoration.

Changes

Encoded filename resolution

Layer / File(s) Summary
Writer filename mapping
src/main/java/edu/kit/datamanager/ro_crate/entities/data/DataEntity.java, src/main/java/edu/kit/datamanager/ro_crate/writer/*, src/test/java/edu/kit/datamanager/ro_crate/writer/CommonWriterTest.java
Folder and ZIP writers decode entity IDs when creating output filenames and entries; writer tests assert ID-derived extraction paths.
Reader filename matching
src/main/java/edu/kit/datamanager/ro_crate/reader/CrateReader.java
Reader resolution checks decoded and original identifier candidates, normalizes paths, restricts matches to the crate folder, and logs matching details.
Encoded filename behavior tests
src/test/java/edu/kit/datamanager/ro_crate/crate/ReadAndWriteTest.java
Tests cover encoded IDs, decoded and encoded filenames, path resolution, and restoration of decoded filenames after resaving.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CrateReader
  participant IdentifierUtils
  participant CrateFolder
  participant WriteFolderStrategy
  CrateReader->>IdentifierUtils: Decode entity ID
  IdentifierUtils-->>CrateReader: Decoded candidate
  CrateReader->>CrateFolder: Check decoded and original filenames
  CrateFolder-->>CrateReader: Existing in-folder path
  WriteFolderStrategy->>IdentifierUtils: Decode entity ID for output
  IdentifierUtils-->>WriteFolderStrategy: Decoded filename
  WriteFolderStrategy->>CrateFolder: Copy entity to decoded filename
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is generic release wording and does not describe the actual changes in crate ID encoding and reader/writer behavior. Use a concise title that names the main change, such as handling encoded entity IDs in crate reading and writing.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch development

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…ut-7.x

chore(deps): update actions/checkout action to v7.0.1

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/edu/kit/datamanager/ro_crate/reader/CrateReader.java (1)

145-150: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Remove debug System.out.println.

This runs for every resolved data entity on every crate read and writes to stdout unconditionally. A logger is already available on this class (logger.debug(...)), or this line should simply be dropped before release.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/edu/kit/datamanager/ro_crate/reader/CrateReader.java` around
lines 145 - 150, Remove the unconditional System.out.println from the
checkFolderHasFile callback in CrateReader; rely on the existing logger.debug
only if this diagnostic is still needed, while preserving the usedFiles and
builder updates.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/main/java/edu/kit/datamanager/ro_crate/writer/WriteFolderStrategy.java`:
- Around line 72-82: Validate decoded destination names before writing in both
strategies: in WriteFolderStrategy.saveToFile, normalize the resolved path under
the destination folder and reject it if it does not remain contained, mirroring
CrateReader.checkFolderHasFile; in WriteZipStreamStrategy at the decoded
filename handling, reject or safely strip absolute markers and traversal
segments before constructing the zip entry name. Apply the changes to
src/main/java/edu/kit/datamanager/ro_crate/writer/WriteFolderStrategy.java lines
72-82 and
src/main/java/edu/kit/datamanager/ro_crate/writer/WriteZipStreamStrategy.java
lines 152-171.

---

Outside diff comments:
In `@src/main/java/edu/kit/datamanager/ro_crate/reader/CrateReader.java`:
- Around line 145-150: Remove the unconditional System.out.println from the
checkFolderHasFile callback in CrateReader; rely on the existing logger.debug
only if this diagnostic is still needed, while preserving the usedFiles and
builder updates.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: db7edca6-8df9-430c-8400-2cc6285c7098

📥 Commits

Reviewing files that changed from the base of the PR and between 2f83a33 and 90f814f.

📒 Files selected for processing (6)
  • src/main/java/edu/kit/datamanager/ro_crate/entities/data/DataEntity.java
  • src/main/java/edu/kit/datamanager/ro_crate/reader/CrateReader.java
  • src/main/java/edu/kit/datamanager/ro_crate/writer/WriteFolderStrategy.java
  • src/main/java/edu/kit/datamanager/ro_crate/writer/WriteZipStreamStrategy.java
  • src/test/java/edu/kit/datamanager/ro_crate/crate/ReadAndWriteTest.java
  • src/test/java/edu/kit/datamanager/ro_crate/writer/CommonWriterTest.java

Comment on lines +72 to 82
private void saveToFile(DataEntity entity, File file) throws IOException {
if (entity.getPath() != null) {
String id = entity.getId();
String filename = IdentifierUtils.decode(id).orElse(id);
if (entity.getPath().toFile().isDirectory()) {
FileUtils.copyDirectory(entity.getPath().toFile(), file.toPath().resolve(entity.getId()).toFile());
FileUtils.copyDirectory(entity.getPath().toFile(), file.toPath().resolve(filename).toFile());
} else {
FileUtils.copyFile(entity.getPath().toFile(), file.toPath().resolve(entity.getId()).toFile());
FileUtils.copyFile(entity.getPath().toFile(), file.toPath().resolve(filename).toFile());
}
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win

Unvalidated decoded id used to build output paths in both writer strategies. Both writers decode the entity id and use it directly to construct a destination location, without the containment check that CrateReader.checkFolderHasFile applies on the read side for the same reason ("defence-in-depth: ensure we are still inside the crate folder"). A decoded id that is absolute, or contains ../, escapes the intended output location (arbitrary file write on folder-write, Zip Slip on zip-write).

  • src/main/java/edu/kit/datamanager/ro_crate/writer/WriteFolderStrategy.java#L72-L82: after computing filename, normalize/resolve against the destination folder and reject (or throw) if the result doesn't stay under it, mirroring the reader's startsWith guard.
  • src/main/java/edu/kit/datamanager/ro_crate/writer/WriteZipStreamStrategy.java#L152-L171: reject (or strip) decoded filenames containing traversal segments/absolute markers before using them to build the zip entry name.
📍 Affects 2 files
  • src/main/java/edu/kit/datamanager/ro_crate/writer/WriteFolderStrategy.java#L72-L82 (this comment)
  • src/main/java/edu/kit/datamanager/ro_crate/writer/WriteZipStreamStrategy.java#L152-L171
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/edu/kit/datamanager/ro_crate/writer/WriteFolderStrategy.java`
around lines 72 - 82, Validate decoded destination names before writing in both
strategies: in WriteFolderStrategy.saveToFile, normalize the resolved path under
the destination folder and reject it if it does not remain contained, mirroring
CrateReader.checkFolderHasFile; in WriteZipStreamStrategy at the decoded
filename handling, reject or safely strip absolute markers and traversal
segments before constructing the zip entry name. Apply the changes to
src/main/java/edu/kit/datamanager/ro_crate/writer/WriteFolderStrategy.java lines
72-82 and
src/main/java/edu/kit/datamanager/ro_crate/writer/WriteZipStreamStrategy.java
lines 152-171.

Pfeil added 4 commits July 27, 2026 11:27
…onVersion-2.22.1

chore(deps): bump jacksonVersion from 2.22.0 to 2.22.1
…action-4.x

chore(deps): update github/codeql-action action to v4.37.3
…k-monorepo

fix(deps): update dependency org.junit:junit-bom to v6.1.2
…java-5.x

chore(deps): update actions/setup-java action to v5.6.0
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.

1 participant