matrix-org / matrix-org/matrix-widget-api

Permission issues in the release tarball

Open
#33 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
95
Forks
24
Avg merge
16h 16m
Merged PRs (30d)
1

Description

Describe the bug
The compressed tarball for this package in the Yarn registry has some permission issues preventing it from being correctly extracted.

To Reproduce
Steps to reproduce the behavior:

  1. With an unprivileged user initialize a package.json file:
    yarn init -y
  2. Add this project as a dependency:
    yarn add matrix-widget-api
  3. Get the URL in the Yarn registry and download the tarball:
$ pkg_url=$(cat yarn.lock | grep ".com/matrix-widget-api" | awk -F'"' '{ print $2 }')
$ wget "${pkg_url}"
  1. Extract the archive:
$ mkdir extracted
$ tar zxvf matrix-widget-api-*.tgz -C extracted/
  1. Lots of errors will appear:
package/src/models/validation/utils.ts
tar: package/src/models/validation/utils.ts: Cannot open: Permission denied
tar: Exiting with failure status due to previous errors
  1. If you retry the extract command with the --delay-directory-restore flag, it works at first, but a few directories will miss the execute attribute:
$ tar zxvf matrix-widget-api-*.tgz --delay-directory-restore -C extracted/
$ rm -rf extracted/
rm: cannot remove 'extracted/package/src': Permission denied
rm: cannot remove 'extracted/package/LICENSE': Permission denied
rm: cannot remove 'extracted/package/lib': Permission denied
rm: cannot remove 'extracted/package/README.md': Permission denied
rm: cannot remove 'extracted/package/dist': Permission denied
rm: cannot remove 'extracted/package/CONTRIBUTING.rst': Permission denied
rm: cannot remove 'extracted/package/package.json': Permission denied
  1. It's possible to fix the errors from (6) by adjusting the attributes:
$ find extracted/ -type d -exec chmod a+x {} \;
$ rm -rf extracted/
# works now

Expected behavior
Extraction was expected to work correctly without the need for extra flags and operations, similarly to other projects. For example, matrix-js-sdk:

$ yarn add matrix-js-sdk
$ pkg_url=$(cat yarn.lock | grep ".com/matrix-js-sdk" | awk -F'"' '{ print $2 }')
$ wget "${pkg_url}"

$ mkdir extracted
$ tar zxvf matrix-js-sdk-*.tgz -C extracted/
$ rm -rf extracted
# works right away

Desktop (please complete the following information):

  • OS: Linux Mint 19.3 Tricia
  • Yarn: 1.7.0
  • tar: GNU tar 1.29

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the extraction failure as an unprivileged user using package.json, yarn.lock, and the published matrix-widget-api tarball. Inspect the archive's permissions, especially under package/src/models/validation/utils.ts, and compare with the matrix-js-sdk archive; done means extraction and removal work without extra flags or chmod operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
release
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.