Validate downloaded plugin binary size#2941
Merged
Merged
Conversation
To protect against a malicious plugin OCI image. This patch introcudes a new config setting `plugin_download_max_size` that controlls the maximum allowed plugin binary size (Default 512 MiB). We now check the reported plugin size in the Tar Header of the extracted OCI image against that limit and fail if it is exceeded. For good measure we also now check if there's enough disk space left to extract the plugin before we try to do so and if the amount of bytes we copied matched what was reported in the Tar Header. Signed-off-by: Jan Martens <jan@martens.eu.org>
Co-authored-by: Wojciech Slabosz <wojciech.slabosz@sap.com> Signed-off-by: Jan Martens <44572196+JanMa@users.noreply.github.com>
Signed-off-by: Alexander Scheel <alex.scheel@control-plane.io>
JanMa
approved these changes
Apr 20, 2026
satoqz
approved these changes
Apr 20, 2026
Member
Author
|
Thank you @JanMa for patch development! |
2 tasks
satoqz
added a commit
that referenced
this pull request
Apr 20, 2026
To protect against a malicious plugin OCI image. This patch introcudes a new config setting `plugin_download_max_size` that controlls the maximum allowed plugin binary size (Default 512 MiB). We now check the reported plugin size in the Tar Header of the extracted OCI image against that limit and fail if it is exceeded. For good measure we also now check if there's enough disk space left to extract the plugin before we try to do so and if the amount of bytes we copied matched what was reported in the Tar Header. Signed-off-by: Jan Martens <jan@martens.eu.org> Signed-off-by: Jan Martens <44572196+JanMa@users.noreply.github.com> Signed-off-by: Alexander Scheel <alex.scheel@control-plane.io> Co-authored-by: Alexander Scheel <alex.scheel@control-plane.io> Co-authored-by: Jan Martens <jan@martens.eu.org> Co-authored-by: Jan Martens <44572196+JanMa@users.noreply.github.com> Co-authored-by: Wojciech Slabosz <wojciech.slabosz@sap.com>
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.
To protect against a malicious plugin OCI image. This patch introcudes a new config setting
plugin_download_max_sizethat controlls the maximum allowed plugin binary size (Default 512 MiB). We now check the reported plugin size in the Tar Header of the extracted OCI image against that limit and fail if it is exceeded. For good measure we also now check if there's enough disk space left to extract the plugin before we try to do so and if the amount of bytes we copied matched what was reported in the Tar Header.Description
Rationale
Resolves: #
Acknowledgements
(GitHub Copilot, Cursor, Claude Code, &c) in authoring these changes or
filling out the pull request description or associated issue.
DCO ownership statement
and this change did not use post-BUSL-licensed code from HashiCorp.
Existing MPL-licensed code is still allowed, subject to attribution.
Code authored by yourself and submitted to HashiCorp for inclusion is
also allowed.