Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using unlighthouse-ci --output-path= <path> removes the target directory. #200

Closed
I-0h opened this issue Mar 28, 2024 · 3 comments
Closed

Comments

@I-0h
Copy link

I-0h commented Mar 28, 2024

Describe the bug

Using unlighthouse-ci --output-path= <path> removes the target directory.
Specifying a path can have catastrophic effects if the command is run with the wrong permissions or on an unprotected directory.

Reproduction

unlighthouse-ci --output-path= <an_unprotected_path_with_stuff_you_want_to_keep>

System / Nuxt Info

System:
    OS: macOS 14.0
    CPU: (10) arm64 Apple M1 Pro
    Memory: 60.92 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.4.0 - /opt/homebrew/bin/node
    npm: 10.2.4 - /opt/homebrew/bin/npm
    pnpm: 7.15.0 - /usr/local/bin/pnpm
  Browsers:
    Brave Browser: 121.1.62.162
    Chrome: 123.0.6312.87
    Safari: 17.0

Resolution

Prevent this behavior by only attempting to remove reports/ if it exists and clearly document CI option behavior.

@harlan-zw
Copy link
Owner

Thanks for the issue, will jump on it when I have a chance. PRs welcome otherwise :)

@apsolut
Copy link

apsolut commented Apr 23, 2024

also running just unlighthouse-ci for me deleted old reports I created with unlighthouse

@harlan-zw
Copy link
Owner

Have pushed up a fix for this, it would no longer attempt to delete the output path, only the generated runtime folder which has a path as <outputPath>/<siteUrl>/<cacheKey> which should avoid anything accidental happening.

also running just unlighthouse-ci for me deleted old reports I created with unlighthouse

The CI will always reset the cache, I'd suggest just using unlighthouse

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

No branches or pull requests

3 participants