@capgo/cli 4.10.2 → 4.10.6-beta.1
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/.github/workflows/build.yml +12 -12
- package/.github/workflows/bump_version.yml +2 -2
- package/.github/workflows/check_posix_paths.yml +222 -0
- package/.github/workflows/test.yml +1 -1
- package/CHANGELOG.md +414 -0
- package/bun.lockb +0 -0
- package/dist/index.js +54258 -39666
- package/package.json +22 -17
- package/src/api/channels.ts +28 -5
- package/src/api/versions.ts +2 -3
- package/src/app/add.ts +5 -5
- package/src/app/debug.ts +39 -24
- package/src/app/delete.ts +12 -8
- package/src/app/info.ts +4 -1
- package/src/app/set.ts +5 -3
- package/src/bundle/cleanup.ts +5 -5
- package/src/bundle/delete.ts +2 -2
- package/src/bundle/list.ts +2 -2
- package/src/bundle/upload.ts +15 -24
- package/src/bundle/zip.ts +93 -89
- package/src/channel/add.ts +10 -4
- package/src/channel/delete.ts +8 -3
- package/src/channel/set.ts +1 -2
- package/src/index.ts +5 -6
- package/src/init.ts +121 -21
- package/src/key.ts +2 -2
- package/src/types/supabase.types.ts +97 -172
- package/src/utils.ts +76 -15
- package/test/VerifyZip.java +83 -0
- package/test/VerifyZip.swift +54 -0
- package/test/check-posix-paths.js +21 -0
- package/test/test_upload/app.js +3 -0
- package/test/test_upload/assets/check-posix-paths.js +21 -0
- package/test/test_upload/index.html +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import SSZipArchive
|
|
3
|
+
|
|
4
|
+
func verifyZipFile(zipFilePath: String) -> Bool {
|
|
5
|
+
let destUnZip = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("extracted")
|
|
6
|
+
|
|
7
|
+
var unzipError: NSError?
|
|
8
|
+
let success = SSZipArchive.unzipFile(atPath: zipFilePath,
|
|
9
|
+
toDestination: destUnZip.path,
|
|
10
|
+
preserveAttributes: true,
|
|
11
|
+
overwrite: true,
|
|
12
|
+
nestedZipLevel: 1,
|
|
13
|
+
password: nil,
|
|
14
|
+
error: &unzipError,
|
|
15
|
+
delegate: nil,
|
|
16
|
+
progressHandler: { (entry, _, _, _) in
|
|
17
|
+
if entry.contains("\\") {
|
|
18
|
+
print("Windows path is not supported: \(entry)")
|
|
19
|
+
exit(1)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let fileURL = destUnZip.appendingPathComponent(entry)
|
|
23
|
+
let canonicalPath = fileURL.path
|
|
24
|
+
let canonicalDir = destUnZip.path
|
|
25
|
+
|
|
26
|
+
if !canonicalPath.hasPrefix(canonicalDir) {
|
|
27
|
+
print("SecurityException, Failed to ensure directory is the start path: \(canonicalDir) of \(canonicalPath)")
|
|
28
|
+
exit(1)
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
completionHandler: nil)
|
|
32
|
+
|
|
33
|
+
if !success || unzipError != nil {
|
|
34
|
+
print("Failed to unzip file: \(zipFilePath)")
|
|
35
|
+
print("Error: \(unzipError?.localizedDescription ?? "")")
|
|
36
|
+
return false
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
print("ZIP file is valid: \(zipFilePath)")
|
|
40
|
+
return true
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let zipFilePaths = CommandLine.arguments.dropFirst()
|
|
44
|
+
|
|
45
|
+
if zipFilePaths.isEmpty {
|
|
46
|
+
print("Usage: swift run VerifyZip <zip-file1> <zip-file2> ...")
|
|
47
|
+
exit(1)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
for zipFilePath in zipFilePaths {
|
|
51
|
+
if !verifyZipFile(zipFilePath: zipFilePath) {
|
|
52
|
+
exit(1)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const AdmZip = require('adm-zip');
|
|
2
|
+
|
|
3
|
+
const zip = new AdmZip('build.zip');
|
|
4
|
+
const zipEntries = zip.getEntries(); // an array of ZipEntry records
|
|
5
|
+
|
|
6
|
+
let errorFound = false;
|
|
7
|
+
|
|
8
|
+
zipEntries.forEach((zipEntry) => {
|
|
9
|
+
const entryName = zipEntry.entryName;
|
|
10
|
+
if (entryName.includes('\\')) {
|
|
11
|
+
console.error(`Non-POSIX path detected: ${entryName}`);
|
|
12
|
+
errorFound = true;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
if (errorFound) {
|
|
17
|
+
console.error('Non-POSIX paths detected in the zip file');
|
|
18
|
+
process.exit(1);
|
|
19
|
+
} else {
|
|
20
|
+
console.log('All paths are POSIX compliant.');
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const AdmZip = require('adm-zip');
|
|
2
|
+
|
|
3
|
+
const zip = new AdmZip('build.zip');
|
|
4
|
+
const zipEntries = zip.getEntries(); // an array of ZipEntry records
|
|
5
|
+
|
|
6
|
+
let errorFound = false;
|
|
7
|
+
|
|
8
|
+
zipEntries.forEach((zipEntry) => {
|
|
9
|
+
const entryName = zipEntry.entryName;
|
|
10
|
+
if (entryName.includes('\\')) {
|
|
11
|
+
console.error(`Non-POSIX path detected: ${entryName}`);
|
|
12
|
+
errorFound = true;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
if (errorFound) {
|
|
17
|
+
console.error('Non-POSIX paths detected in the zip file');
|
|
18
|
+
process.exit(1);
|
|
19
|
+
} else {
|
|
20
|
+
console.log('All paths are POSIX compliant.');
|
|
21
|
+
}
|
|
File without changes
|