Skip to content

[cherry-pick: release-v0.37.x] fix: prevent unbounded tar layer allocation - #3235

Merged
tekton-robot merged 1 commit into
tektoncd:release-v0.37.xfrom
anwesha-palit-redhat:cherry-pick-SRVKP-13858
Sep 10, 2026
Merged

[cherry-pick: release-v0.37.x] fix: prevent unbounded tar layer allocation#3235
tekton-robot merged 1 commit into
tektoncd:release-v0.37.xfrom
anwesha-palit-redhat:cherry-pick-SRVKP-13858

Conversation

@anwesha-palit-redhat

Copy link
Copy Markdown
Contributor

Previously, readTarLayer used the tar header's declared size directly in make([]byte, header.Size), allowing a malicious bundle to specify an arbitrarily large size and potentially cause the CLI to exhaust available memory and crash.

Updated readTarLayer to use a bounded reader with a 10 MiB maximum layer size, preventing attacker-controlled tar metadata or oversized layer contents from causing excessive memory allocation. Added regression coverage to verify that layers exceeding the maximum size are rejected.

Signed-off-by: Anwesha Palit [apalit@redhat.com]

Assisted-by: Claude Opus 4.6

Changes

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Run the code checkers with make check
  • Regenerate the manpages, docs and go formatting with make generated
  • Commit messages follow commit message best practices

See the contribution guide
for more details.

Release Notes

Previously, `readTarLayer` used the tar header's declared size directly in `make([]byte, header.Size)`, allowing a malicious bundle to specify an arbitrarily large size and potentially cause the CLI to exhaust available memory and crash.

Updated `readTarLayer` to use a bounded reader with a 10 MiB maximum layer size, preventing attacker-controlled tar metadata or oversized layer contents from causing excessive memory allocation. Added regression coverage to verify that layers exceeding the maximum size are rejected.

Signed-off-by: Anwesha Palit [apalit@redhat.com]

Assisted-by: Claude Opus 4.6
@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Sep 10, 2026
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 10, 2026
@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 10, 2026
@pratap0007

Copy link
Copy Markdown
Contributor

/approve
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 10, 2026
@tekton-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: divyansh42, pratap0007

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [divyansh42,pratap0007]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pratap0007

Copy link
Copy Markdown
Contributor

/retest

@tekton-robot
tekton-robot merged commit f6595a6 into tektoncd:release-v0.37.x Sep 10, 2026
30 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants