Skip to content

Provide app version validation#8

Merged
Vladyslav-Kuksiuk merged 5 commits into
masterfrom
secure-version
Jul 22, 2026
Merged

Provide app version validation#8
Vladyslav-Kuksiuk merged 5 commits into
masterfrom
secure-version

Conversation

@Vladyslav-Kuksiuk

@Vladyslav-Kuksiuk Vladyslav-Kuksiuk commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

This PR secures app version and binaries storage paths by adding explicit validation.

Resolves:

@Vladyslav-Kuksiuk Vladyslav-Kuksiuk self-assigned this Jul 21, 2026
Base automatically changed from provide-integrity-verification to master July 22, 2026 08:56
@Vladyslav-Kuksiuk
Vladyslav-Kuksiuk marked this pull request as ready for review July 22, 2026 09:23

@Oleg-Melnik Oleg-Melnik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Solid resolution of #6. The design choices are right: tag charset validation applied both at wiring time and re-applied at execution for direct task configuration, lexical containment checks on all five configurable paths (with the symlink limitation honestly documented), and the latest/versions/<tag> cache split so a tag literally named latest cannot alias the rolling cache — with a functional test proving both caches stay separate. Traversal coverage includes the URL-encoded form (a%2f) and asserts no files escape. This also retires the earlier v-prefix-assumption finding, since tags are now used verbatim end to end. Two non-blocking comments below.

Comment thread README.md
```kotlin
embedCode {
version.set("1.2.4")
version.set("v1.2.4")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The verbatim-tag semantics are a behavioral break for existing configurations: version.set("1.2.4") used to be auto-prefixed to v1.2.4, and after this change it requests a tag literally named 1.2.4, which fails at download with a message that gives no hint about the removed convention. The README documents the new behavior well, but nothing helps someone upgrading.

Cheap mitigations, either or both:

  • a one-line migration note here ("previous plugin versions prefixed v automatically; set the exact tag now");
  • when a pinned download fails and the tag does not start with v, append a hint to the error: "a release tag v<tag> may exist — previous plugin versions added this prefix automatically."

Related one-liner: the pinned cache moved from build/embed-code/<version> to build/embed-code/versions/<tag>, so caches from earlier plugin versions are orphaned (self-heals via one re-download; stale directories linger until a clean). Not worth documenting for end users, but worth knowing it's expected.


import org.gradle.api.InvalidUserDataException

private val validReleaseTag = Regex("[A-Za-z0-9][A-Za-z0-9._+~-]*")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Two edge notes on the accepted charset — both fine to leave as-is, but worth a conscious decision:

  1. Git allows hierarchical tag names (releases/1.2), and GitHub can publish releases under them; such tags are now impossible to install through this plugin. That's a reasonable fail-closed tradeoff (a / in a cache-directory segment is exactly what Validate configured versions to keep installation paths inside the build directory #6 is about), but consider stating the accepted charset in the version property KDoc / README so a user with a slashed tag reads it as a documented limitation rather than a bug.
  2. A tag equal to a Windows reserved device name (CON, NUL, AUX, COM1…) passes the regex but produces an unusable cache directory on Windows. Vanishingly unlikely for real releases — mentioning only so the omission is deliberate.

@Oleg-Melnik Oleg-Melnik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@Vladyslav-Kuksiuk LGTM with minor comments.

@Vladyslav-Kuksiuk
Vladyslav-Kuksiuk merged commit 0eb6603 into master Jul 22, 2026
2 checks passed
@Vladyslav-Kuksiuk
Vladyslav-Kuksiuk deleted the secure-version branch July 22, 2026 11:56
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.

2 participants