@involvex/youtube-music-cli 0.0.22 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ ## [0.0.23](https://github.com/involvex/youtube-music-cli/compare/v0.0.22...v0.0.23) (2026-02-20)
2
+
1
3
  ## [0.0.22](https://github.com/involvex/youtube-music-cli/compare/v0.0.21...v0.0.22) (2026-02-20)
2
4
 
3
5
  ### Features
@@ -38,7 +38,7 @@ function buildLastfmSignature(params, secret) {
38
38
  .sort()
39
39
  .map(k => `${k}${params[k]}`)
40
40
  .join('');
41
- return createHash('md5')
41
+ return createHash('sha256')
42
42
  .update(sorted + secret)
43
43
  .digest('hex');
44
44
  }
@@ -7,6 +7,7 @@ declare class StaticFileService {
7
7
  * Get MIME type for a file extension
8
8
  */
9
9
  private getMimeType;
10
+ private resolveSafeFilePath;
10
11
  /**
11
12
  * Load index.html into memory
12
13
  */
@@ -1,7 +1,7 @@
1
1
  // Static file serving service for web UI
2
2
  import { readFile } from 'node:fs/promises';
3
3
  import { existsSync } from 'node:fs';
4
- import { extname, join, dirname } from 'node:path';
4
+ import { extname, join, dirname, normalize, resolve, sep } from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import { logger } from "../logger/logger.service.js";
7
7
  const MIME_TYPES = {
@@ -55,6 +55,23 @@ class StaticFileService {
55
55
  const ext = extname(filePath).toLowerCase();
56
56
  return MIME_TYPES[ext] || 'application/octet-stream';
57
57
  }
58
+ resolveSafeFilePath(urlPath) {
59
+ let decodedPath;
60
+ try {
61
+ decodedPath = decodeURIComponent(urlPath);
62
+ }
63
+ catch {
64
+ return null;
65
+ }
66
+ const relativePath = normalize(decodedPath).replace(/^[\\/]+/, '');
67
+ const rootPath = resolve(this.webDistDir);
68
+ const resolvedPath = resolve(rootPath, relativePath);
69
+ const rootPrefix = rootPath.endsWith(sep) ? rootPath : `${rootPath}${sep}`;
70
+ if (resolvedPath !== rootPath && !resolvedPath.startsWith(rootPrefix)) {
71
+ return null;
72
+ }
73
+ return resolvedPath;
74
+ }
58
75
  /**
59
76
  * Load index.html into memory
60
77
  */
@@ -111,7 +128,12 @@ class StaticFileService {
111
128
  return;
112
129
  }
113
130
  // Serve static files
114
- const filePath = join(this.webDistDir, urlPath);
131
+ const filePath = this.resolveSafeFilePath(urlPath);
132
+ if (!filePath) {
133
+ res.writeHead(400, { 'Content-Type': 'text/plain' });
134
+ res.end('Bad Request');
135
+ return;
136
+ }
115
137
  try {
116
138
  // Check if file exists
117
139
  if (!existsSync(filePath)) {
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@involvex/youtube-music-cli",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "description": "- A Commandline music player for youtube-music",
5
5
  "repository": {
6
6
  "type": "git",
package/readme.md CHANGED
@@ -105,7 +105,7 @@ brew install involvex/youtube-music-cli/youtube-music-cli
105
105
  winget install Involvex.YoutubeMusicCLI
106
106
  ```
107
107
 
108
- > Maintainers: tag pushes trigger `.github/workflows/homebrew-publish.yml` and `.github/workflows/winget-publish.yml`. Set `WINGETCREATE_TOKEN` and make sure `Involvex.YoutubeMusicCLI` exists in winget-pkgs for automated updates.
108
+ > Maintainers: tag pushes trigger `.github/workflows/homebrew-publish.yml` and `.github/workflows/winget-publish.yml`. Homebrew uses the tap format `involvex/youtube-music-cli/youtube-music-cli`, so ensure the formula file exists on the default branch at `Formula/youtube-music-cli.rb` for the tap installation to work. Set `WINGETCREATE_TOKEN` and make sure `Involvex.YoutubeMusicCLI` exists in winget-pkgs for automated updates.
109
109
 
110
110
  ### From Source
111
111