@qoder-ai/qodercli 1.1.87 → 1.1.89
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/bundle/qoder-worker-runtime.mjs +2 -2
- package/bundle/qodercli.js +2 -2
- package/bundle/vendor/qoder-security/.qoder-plugin/plugin.json +1 -1
- package/bundle/vendor/qoder-security/bin/bootstrap.cmd +48 -9
- package/bundle/vendor/qoder-security/bin/bootstrap.sh +176 -12
- package/bundle/vendor/qoder-security/bin/qodersec-launch.cmd +8 -8
- package/bundle/vendor/qoder-security/bin/qodersec-launch.sh +8 -8
- package/bundle/vendor/qoder-security/package.json +1 -1
- package/bundle/vendor/qoder-security/skills/security-scan/SKILL.md +7 -1
- package/package.json +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/bundle/qoder-worker-runtime.mjs
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 35404115 bytes
|
|
4
|
+
sha256: cd4fb41eb25cf6d7ddee66cae66ba21d3fa74ade13d65e81c42dd5e5e3576bc1
|
package/bundle/qodercli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/bundle/qodercli.js
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 35250342 bytes
|
|
4
|
+
sha256: b7a2d6d54bf868f7226abc759c10c6361ea4ab04ddd4c0615eb90ccef3524377
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "security-scan",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"displayName": "Qoder Security",
|
|
5
5
|
"description": "Automated security review for Qoder. Pattern-based warnings on edits, cloud-backed diff review on Stop, and agentic commit/push review with SHA tracking. All logic runs in the cross-platform qodersec binary.",
|
|
6
6
|
"author": {
|
|
@@ -36,27 +36,43 @@ if not exist "%BIN_DIR%" mkdir "%BIN_DIR%" >nul 2>nul
|
|
|
36
36
|
if not exist "%BIN_DIR%\." echo [bootstrap] ERROR: cannot create %BIN_DIR% >&2
|
|
37
37
|
if not exist "%BIN_DIR%\." exit /b 1
|
|
38
38
|
|
|
39
|
+
set "ARCHIVE_NAME=codesec-cli-windows-%ARCH%.zip"
|
|
39
40
|
set "DOWNLOAD=%BIN_DIR%\qodersec.download.zip"
|
|
41
|
+
set "MANIFEST=%BIN_DIR%\qodersec.download.manifest.json"
|
|
40
42
|
set "EXTRACT_DIR=%BIN_DIR%\qodersec.download"
|
|
41
43
|
set "EXTRACTED=%EXTRACT_DIR%\codesec-cli.exe"
|
|
42
|
-
set "QODERSEC_DOWNLOAD_URL=%BUCKET_URL%/%VERSION
|
|
44
|
+
set "QODERSEC_DOWNLOAD_URL=%BUCKET_URL%/%VERSION%/%ARCHIVE_NAME%"
|
|
45
|
+
set "QODERSEC_MANIFEST_URL=%BUCKET_URL%/%VERSION%/manifest.json"
|
|
43
46
|
set "QODERSEC_DOWNLOAD_OUT=%DOWNLOAD%"
|
|
47
|
+
set "QODERSEC_MANIFEST_OUT=%MANIFEST%"
|
|
48
|
+
set "QODERSEC_ARCHIVE_NAME=%ARCHIVE_NAME%"
|
|
44
49
|
set "QODERSEC_EXTRACT_DIR=%EXTRACT_DIR%"
|
|
45
50
|
del /q "%DOWNLOAD%" >nul 2>nul
|
|
51
|
+
del /q "%MANIFEST%" >nul 2>nul
|
|
46
52
|
rmdir /s /q "%EXTRACT_DIR%" >nul 2>nul
|
|
47
53
|
|
|
48
54
|
echo [bootstrap] Downloading %QODERSEC_DOWNLOAD_URL%
|
|
49
55
|
set "POWERSHELL_EXE=%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe"
|
|
50
56
|
if not exist "%POWERSHELL_EXE%" set "POWERSHELL_EXE=powershell.exe"
|
|
51
|
-
REM Step 1: download. Invoke-WebRequest is
|
|
52
|
-
REM feedback 4bc07021: the download
|
|
53
|
-
REM
|
|
54
|
-
REM
|
|
57
|
+
REM Step 1: download the version manifest and archive. Invoke-WebRequest is
|
|
58
|
+
REM ConstrainedLanguage-safe (confirmed in feedback 4bc07021: the download
|
|
59
|
+
REM succeeded there, only Expand-Archive failed). Timeouts keep the updater lock
|
|
60
|
+
REM from being held forever by a stalled connection.
|
|
61
|
+
"%POWERSHELL_EXE%" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "$ErrorActionPreference='Stop'; Invoke-WebRequest -UseBasicParsing -TimeoutSec 60 -Uri $env:QODERSEC_MANIFEST_URL -OutFile $env:QODERSEC_MANIFEST_OUT"
|
|
62
|
+
if errorlevel 1 goto manifest_download_failed
|
|
63
|
+
if not exist "%MANIFEST%" goto manifest_download_failed
|
|
55
64
|
"%POWERSHELL_EXE%" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "$ErrorActionPreference='Stop'; Invoke-WebRequest -UseBasicParsing -TimeoutSec 900 -Uri $env:QODERSEC_DOWNLOAD_URL -OutFile $env:QODERSEC_DOWNLOAD_OUT"
|
|
56
65
|
if errorlevel 1 goto download_failed
|
|
57
66
|
if not exist "%DOWNLOAD%" goto download_failed
|
|
58
67
|
|
|
59
|
-
REM Step 2:
|
|
68
|
+
REM Step 2: verify the archive against the SHA-256 in the version manifest.
|
|
69
|
+
REM Missing/invalid metadata and mismatches all fail closed before extraction.
|
|
70
|
+
"%POWERSHELL_EXE%" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "$ErrorActionPreference='Stop'; $m=Get-Content -Raw -LiteralPath $env:QODERSEC_MANIFEST_OUT | ConvertFrom-Json; if ($m.latest -cne $env:VERSION) { throw 'manifest version mismatch' }; $entries=@($m.files | Where-Object { $_.os -ceq 'windows' -and $_.arch -ceq $env:ARCH -and $_.url -clike ('*/' + $env:QODERSEC_ARCHIVE_NAME) }); if ($entries.Count -ne 1) { throw 'manifest must contain exactly one matching platform archive' }; $e=$entries[0]; if (([string]$e.sha256) -notmatch '^[0-9A-Fa-f]{64}$') { throw ('missing or invalid SHA-256 for ' + $env:QODERSEC_ARCHIVE_NAME) }; $actual=(Get-FileHash -Algorithm SHA256 -LiteralPath $env:QODERSEC_DOWNLOAD_OUT).Hash; if ($actual -ne ([string]$e.sha256)) { throw ('SHA-256 mismatch for ' + $env:QODERSEC_ARCHIVE_NAME) }"
|
|
71
|
+
if errorlevel 1 goto checksum_verification_failed
|
|
72
|
+
|
|
73
|
+
echo [bootstrap] SHA-256 verified
|
|
74
|
+
|
|
75
|
+
REM Step 3: extract. Prefer System32 tar.exe (works under ConstrainedLanguage);
|
|
60
76
|
REM without tar.exe (old/stripped Windows) fall back to Expand-Archive, which
|
|
61
77
|
REM still works under FullLanguage. Either path failing reports extraction failed.
|
|
62
78
|
mkdir "%EXTRACT_DIR%" >nul 2>nul
|
|
@@ -77,12 +93,12 @@ if not exist "%EXTRACTED%" goto extraction_failed
|
|
|
77
93
|
|
|
78
94
|
:extract_done
|
|
79
95
|
|
|
80
|
-
REM Step
|
|
96
|
+
REM Step 4: best-effort Mark-of-the-Web unblock; never fails the install.
|
|
81
97
|
"%POWERSHELL_EXE%" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "Unblock-File -LiteralPath (Join-Path $env:QODERSEC_EXTRACT_DIR 'codesec-cli.exe') -ErrorAction SilentlyContinue" >nul 2>nul
|
|
82
98
|
|
|
83
99
|
echo [bootstrap] Verifying %EXTRACTED%
|
|
84
100
|
"%EXTRACTED%" version
|
|
85
|
-
if errorlevel 1 goto
|
|
101
|
+
if errorlevel 1 goto executable_verification_failed
|
|
86
102
|
move /y "%EXTRACTED%" "%BIN_DIR%\qodersec.exe" >nul 2>nul
|
|
87
103
|
if errorlevel 1 goto install_failed
|
|
88
104
|
set "CHANNEL=global"
|
|
@@ -95,34 +111,57 @@ set "VERSION_FILE=%BIN_DIR%\qodersec-version.json"
|
|
|
95
111
|
>> "%VERSION_FILE%" echo }
|
|
96
112
|
if not exist "%VERSION_FILE%" goto metadata_failed
|
|
97
113
|
del /q "%DOWNLOAD%" >nul 2>nul
|
|
114
|
+
del /q "%MANIFEST%" >nul 2>nul
|
|
98
115
|
rmdir /s /q "%EXTRACT_DIR%" >nul 2>nul
|
|
99
116
|
|
|
100
117
|
echo [bootstrap] Done
|
|
101
118
|
exit /b 0
|
|
102
119
|
|
|
120
|
+
:manifest_download_failed
|
|
121
|
+
del /q "%DOWNLOAD%" >nul 2>nul
|
|
122
|
+
del /q "%MANIFEST%" >nul 2>nul
|
|
123
|
+
rmdir /s /q "%EXTRACT_DIR%" >nul 2>nul
|
|
124
|
+
echo [bootstrap] ERROR: manifest download failed >&2
|
|
125
|
+
exit /b 1
|
|
126
|
+
|
|
103
127
|
:download_failed
|
|
104
128
|
del /q "%DOWNLOAD%" >nul 2>nul
|
|
129
|
+
del /q "%MANIFEST%" >nul 2>nul
|
|
105
130
|
rmdir /s /q "%EXTRACT_DIR%" >nul 2>nul
|
|
106
131
|
echo [bootstrap] ERROR: download failed >&2
|
|
107
132
|
exit /b 1
|
|
108
133
|
|
|
134
|
+
:checksum_verification_failed
|
|
135
|
+
del /q "%DOWNLOAD%" >nul 2>nul
|
|
136
|
+
del /q "%MANIFEST%" >nul 2>nul
|
|
137
|
+
rmdir /s /q "%EXTRACT_DIR%" >nul 2>nul
|
|
138
|
+
echo [bootstrap] ERROR: SHA-256 verification failed >&2
|
|
139
|
+
exit /b 1
|
|
140
|
+
|
|
109
141
|
:extraction_failed
|
|
110
142
|
del /q "%DOWNLOAD%" >nul 2>nul
|
|
143
|
+
del /q "%MANIFEST%" >nul 2>nul
|
|
111
144
|
rmdir /s /q "%EXTRACT_DIR%" >nul 2>nul
|
|
112
145
|
echo [bootstrap] ERROR: extraction failed >&2
|
|
113
146
|
exit /b 1
|
|
114
147
|
|
|
115
|
-
:
|
|
148
|
+
:executable_verification_failed
|
|
149
|
+
del /q "%DOWNLOAD%" >nul 2>nul
|
|
150
|
+
del /q "%MANIFEST%" >nul 2>nul
|
|
116
151
|
echo [bootstrap] ERROR: downloaded executable failed version check >&2
|
|
117
152
|
echo [bootstrap] Preserved executable for diagnostics: %EXTRACTED% >&2
|
|
118
153
|
exit /b 1
|
|
119
154
|
|
|
120
155
|
:install_failed
|
|
121
156
|
del /q "%DOWNLOAD%" >nul 2>nul
|
|
157
|
+
del /q "%MANIFEST%" >nul 2>nul
|
|
122
158
|
rmdir /s /q "%EXTRACT_DIR%" >nul 2>nul
|
|
123
159
|
echo [bootstrap] ERROR: cannot replace qodersec.exe; another process may be using it >&2
|
|
124
160
|
exit /b 1
|
|
125
161
|
|
|
126
162
|
:metadata_failed
|
|
163
|
+
del /q "%DOWNLOAD%" >nul 2>nul
|
|
164
|
+
del /q "%MANIFEST%" >nul 2>nul
|
|
165
|
+
rmdir /s /q "%EXTRACT_DIR%" >nul 2>nul
|
|
127
166
|
echo [bootstrap] ERROR: cannot write %VERSION_FILE% >&2
|
|
128
167
|
exit /b 1
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
# bootstrap.sh — Download qodersec binary for the current platform.
|
|
3
3
|
#
|
|
4
|
-
# Pure shell
|
|
4
|
+
# Pure shell bootstrap. Version is read from QODERSEC_CLI_VERSION_* env vars
|
|
5
5
|
# (set by qodersec-launch.cmd, with CODESEC_CLI_VERSION_* fallback for compat).
|
|
6
|
-
#
|
|
7
|
-
# after bootstrap completes.
|
|
6
|
+
# The qodersec version manifest is verified here; qodercli download is handled
|
|
7
|
+
# by `qodersec ensure-deps` after bootstrap completes.
|
|
8
8
|
#
|
|
9
9
|
# Download strategy: read latest/manifest.json to get version, then download
|
|
10
|
-
#
|
|
11
|
-
#
|
|
10
|
+
# the archive and its versioned manifest (e.g. /0.6.0/manifest.json). The
|
|
11
|
+
# manifest's SHA-256 must match before extraction; a missing/invalid checksum is
|
|
12
|
+
# a hard failure. The default Qoder distribution endpoints serve signed binaries
|
|
13
|
+
# so macOS/Windows hosts accept them.
|
|
12
14
|
# OSS package name stays codesec-cli-*.tar.gz (CI/CD compat); binary is renamed
|
|
13
15
|
# to qodersec after extraction.
|
|
14
16
|
set -e
|
|
@@ -58,12 +60,12 @@ resolve_version() {
|
|
|
58
60
|
echo "${VERSION}"
|
|
59
61
|
return
|
|
60
62
|
fi
|
|
61
|
-
# Otherwise read from manifest
|
|
63
|
+
# Otherwise read from manifest; this request also holds the update lock.
|
|
62
64
|
if command -v curl >/dev/null 2>&1; then
|
|
63
|
-
curl -fsSL "${BUCKET_URL}/latest/manifest.json" 2>/dev/null | \
|
|
65
|
+
curl -fsSL --connect-timeout 10 --max-time 60 "${BUCKET_URL}/latest/manifest.json" 2>/dev/null | \
|
|
64
66
|
grep '"latest"' | sed 's/.*"latest"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/'
|
|
65
67
|
elif command -v wget >/dev/null 2>&1; then
|
|
66
|
-
wget -qO- "${BUCKET_URL}/latest/manifest.json" 2>/dev/null | \
|
|
68
|
+
wget --timeout=30 --tries=1 -qO- "${BUCKET_URL}/latest/manifest.json" 2>/dev/null | \
|
|
67
69
|
grep '"latest"' | sed 's/.*"latest"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/'
|
|
68
70
|
else
|
|
69
71
|
echo "${VERSION}"
|
|
@@ -73,10 +75,12 @@ resolve_version() {
|
|
|
73
75
|
RESOLVED_VERSION="$(resolve_version)"
|
|
74
76
|
[ -n "${RESOLVED_VERSION}" ] || { echo "[bootstrap] failed to resolve version" >&2; exit 1; }
|
|
75
77
|
|
|
76
|
-
# Construct download
|
|
77
|
-
#
|
|
78
|
+
# Construct download URLs from the versioned directory. The manifest is release
|
|
79
|
+
# metadata produced alongside the archive and carries the archive's SHA-256.
|
|
80
|
+
# OSS package name stays codesec-cli-* for CI/CD compatibility.
|
|
78
81
|
FILENAME="codesec-cli-${OS}-${ARCH}.tar.gz"
|
|
79
82
|
DOWNLOAD_URL="${BUCKET_URL}/${RESOLVED_VERSION}/${FILENAME}"
|
|
83
|
+
MANIFEST_URL="${BUCKET_URL}/${RESOLVED_VERSION}/manifest.json"
|
|
80
84
|
|
|
81
85
|
echo "[bootstrap] downloading qodersec ${RESOLVED_VERSION} (${OS}/${ARCH})..."
|
|
82
86
|
echo "[bootstrap] ${DOWNLOAD_URL}"
|
|
@@ -96,21 +100,181 @@ mkdir -p "${STAGE_DIR}" || { echo "[bootstrap] cannot create ${STAGE_DIR}" >&2;
|
|
|
96
100
|
# only substitutes a trailing run of Xs, so a ".tar.gz" suffix would create a
|
|
97
101
|
# literal fixed file and fail with "File exists" on the next run. tar does not
|
|
98
102
|
# need the extension.
|
|
103
|
+
TMPFILE=""
|
|
104
|
+
MANIFEST_FILE=""
|
|
105
|
+
trap 'rm -f "${TMPFILE}" "${MANIFEST_FILE}"; rm -rf "${STAGE_DIR}"' EXIT
|
|
106
|
+
trap 'exit 1' HUP INT TERM
|
|
99
107
|
TMPFILE="$(mktemp "${TMPDIR:-/tmp}/qodersec-XXXXXX")"
|
|
108
|
+
MANIFEST_FILE="$(mktemp "${TMPDIR:-/tmp}/qodersec-manifest-XXXXXX")"
|
|
100
109
|
echo "[bootstrap] TMPFILE: ${TMPFILE}"
|
|
101
|
-
trap 'rm -rf "${TMPFILE}" "${STAGE_DIR}"' EXIT
|
|
102
110
|
|
|
103
111
|
# Every download is bounded: the background updater holds the update lock for
|
|
104
112
|
# the whole run, so a stalled connection would otherwise park it there.
|
|
105
113
|
if command -v curl >/dev/null 2>&1; then
|
|
114
|
+
curl -fsSL --connect-timeout 10 --max-time 60 -o "${MANIFEST_FILE}" "${MANIFEST_URL}" || { echo "[bootstrap] manifest download failed" >&2; exit 1; }
|
|
106
115
|
curl -fsSL --connect-timeout 10 --max-time 900 -o "${TMPFILE}" "${DOWNLOAD_URL}" || { echo "[bootstrap] download failed" >&2; exit 1; }
|
|
107
116
|
elif command -v wget >/dev/null 2>&1; then
|
|
117
|
+
wget --timeout=30 --tries=1 -qO "${MANIFEST_FILE}" "${MANIFEST_URL}" || { echo "[bootstrap] manifest download failed" >&2; exit 1; }
|
|
108
118
|
wget --timeout=30 --tries=1 -qO "${TMPFILE}" "${DOWNLOAD_URL}" || { echo "[bootstrap] download failed" >&2; exit 1; }
|
|
109
119
|
else
|
|
110
120
|
echo "[bootstrap] curl or wget required" >&2; exit 1
|
|
111
121
|
fi
|
|
112
122
|
|
|
113
|
-
#
|
|
123
|
+
# Locate this exact archive in the version manifest. Fail closed when the entry
|
|
124
|
+
# or digest is absent: silently accepting an unverified archive reintroduces the
|
|
125
|
+
# poisoning path this check is intended to close.
|
|
126
|
+
# Parse JSON structurally using POSIX awk (no jq/Python runtime dependency).
|
|
127
|
+
# Never search across object boundaries or fall back to versions/history entries.
|
|
128
|
+
EXPECTED_SHA256="$(
|
|
129
|
+
LC_ALL=C awk -v filename="${FILENAME}" -v version="${RESOLVED_VERSION}" -v os="${OS}" -v arch="${ARCH}" '
|
|
130
|
+
function fail() { invalid = 1; exit 1 }
|
|
131
|
+
function hex4( h, i, n) {
|
|
132
|
+
h = substr(json, pos, 4)
|
|
133
|
+
if (length(h) != 4 || h ~ /[^0-9A-Fa-f]/) fail()
|
|
134
|
+
pos += 4
|
|
135
|
+
for (i = 1; i <= 4; i++) n = n * 16 + index("0123456789abcdef", tolower(substr(h, i, 1))) - 1
|
|
136
|
+
return n
|
|
137
|
+
}
|
|
138
|
+
function utf8(n) {
|
|
139
|
+
if (n < 128) return sprintf("%c", n)
|
|
140
|
+
if (n < 2048) return sprintf("%c%c", 192 + int(n / 64), 128 + n % 64)
|
|
141
|
+
if (n < 65536) return sprintf("%c%c%c", 224 + int(n / 4096), 128 + int(n / 64) % 64, 128 + n % 64)
|
|
142
|
+
return sprintf("%c%c%c%c", 240 + int(n / 262144), 128 + int(n / 4096) % 64, 128 + int(n / 64) % 64, 128 + n % 64)
|
|
143
|
+
}
|
|
144
|
+
function next_token( c, e, n, low) {
|
|
145
|
+
while (substr(json, pos, 1) ~ /^[ \t\r\n]$/ && pos <= length(json)) pos++
|
|
146
|
+
c = substr(json, pos++, 1)
|
|
147
|
+
token = c; text = ""
|
|
148
|
+
if (c != "\"") {
|
|
149
|
+
if (c == "" || index("{}[]:,", c)) return
|
|
150
|
+
pos--
|
|
151
|
+
while (pos <= length(json) && substr(json, pos, 1) !~ /[ \t\r\n{}\[\]:,]/)
|
|
152
|
+
text = text substr(json, pos++, 1)
|
|
153
|
+
if (text !~ /^(true|false|null|-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?)$/) fail()
|
|
154
|
+
token = "literal"; return
|
|
155
|
+
}
|
|
156
|
+
token = "string"
|
|
157
|
+
while (pos <= length(json)) {
|
|
158
|
+
c = substr(json, pos++, 1)
|
|
159
|
+
if (c == "\"") return
|
|
160
|
+
if (c ~ /[[:cntrl:]]/) fail()
|
|
161
|
+
if (c == "\\") {
|
|
162
|
+
e = substr(json, pos++, 1)
|
|
163
|
+
if (e == "u") {
|
|
164
|
+
n = hex4()
|
|
165
|
+
if (n >= 55296 && n <= 56319) {
|
|
166
|
+
if (substr(json, pos, 2) != "\\u") fail()
|
|
167
|
+
pos += 2; low = hex4()
|
|
168
|
+
if (low < 56320 || low > 57343) fail()
|
|
169
|
+
n = 65536 + (n - 55296) * 1024 + low - 56320
|
|
170
|
+
} else if (n >= 56320 && n <= 57343) fail()
|
|
171
|
+
# Decode before checking keys: latest and \\u006catest
|
|
172
|
+
# are the same key, including for duplicate detection.
|
|
173
|
+
text = text utf8(n); continue
|
|
174
|
+
}
|
|
175
|
+
if (e == "" || !index("\"\\/bfnrt", e)) fail()
|
|
176
|
+
if (e == "b") c = sprintf("%c", 8)
|
|
177
|
+
else if (e == "f") c = sprintf("%c", 12)
|
|
178
|
+
else if (e == "n") c = "\n"
|
|
179
|
+
else if (e == "r") c = "\r"
|
|
180
|
+
else if (e == "t") c = "\t"
|
|
181
|
+
else c = e
|
|
182
|
+
}
|
|
183
|
+
text = text c
|
|
184
|
+
}
|
|
185
|
+
fail()
|
|
186
|
+
}
|
|
187
|
+
function value(ctx, depth, id, key, child, url, entryos, entryarch, sha) {
|
|
188
|
+
if (depth > 64) fail()
|
|
189
|
+
result = ""; result_type = token
|
|
190
|
+
if (token == "{") {
|
|
191
|
+
id = ++object_id; next_token()
|
|
192
|
+
if (token != "}") while (1) {
|
|
193
|
+
if (token != "string") fail()
|
|
194
|
+
key = text
|
|
195
|
+
if (seen[id SUBSEP key]++) fail()
|
|
196
|
+
next_token(); if (token != ":") fail()
|
|
197
|
+
next_token(); child = "ignore"
|
|
198
|
+
if (ctx == "root" && key == "files") {
|
|
199
|
+
if (token != "[") fail()
|
|
200
|
+
child = "files"
|
|
201
|
+
}
|
|
202
|
+
value(child, depth + 1)
|
|
203
|
+
if (ctx == "root" && key == "latest") {
|
|
204
|
+
if (result_type != "string") fail()
|
|
205
|
+
latest = result
|
|
206
|
+
}
|
|
207
|
+
if (ctx == "file" && (key == "url" || key == "os" || key == "arch" || key == "sha256")) {
|
|
208
|
+
if (result_type != "string") fail()
|
|
209
|
+
if (key == "url") url = result
|
|
210
|
+
if (key == "os") entryos = result
|
|
211
|
+
if (key == "arch") entryarch = result
|
|
212
|
+
if (key == "sha256") sha = result
|
|
213
|
+
}
|
|
214
|
+
if (token != ",") break
|
|
215
|
+
next_token()
|
|
216
|
+
}
|
|
217
|
+
if (token != "}") fail()
|
|
218
|
+
if (ctx == "file" && entryos == os && entryarch == arch &&
|
|
219
|
+
substr(url, length(url) - length(filename)) == "/" filename) {
|
|
220
|
+
matches++; digest = sha
|
|
221
|
+
}
|
|
222
|
+
next_token(); result = ""; result_type = "object"; return
|
|
223
|
+
}
|
|
224
|
+
if (token == "[") {
|
|
225
|
+
next_token()
|
|
226
|
+
if (token != "]") while (1) {
|
|
227
|
+
if (ctx == "files" && token != "{") fail()
|
|
228
|
+
value(ctx == "files" ? "file" : "ignore", depth + 1)
|
|
229
|
+
if (token != ",") break
|
|
230
|
+
next_token()
|
|
231
|
+
}
|
|
232
|
+
if (token != "]") fail()
|
|
233
|
+
next_token(); result = ""; result_type = "array"; return
|
|
234
|
+
}
|
|
235
|
+
if (token != "string" && token != "literal") fail()
|
|
236
|
+
result = text; result_type = token; next_token()
|
|
237
|
+
}
|
|
238
|
+
{ json = json $0 "\n" }
|
|
239
|
+
END {
|
|
240
|
+
if (invalid) exit 1
|
|
241
|
+
pos = 1; next_token()
|
|
242
|
+
if (token != "{") fail()
|
|
243
|
+
value("root", 0)
|
|
244
|
+
if (token != "" || latest != version || matches != 1 ||
|
|
245
|
+
length(digest) != 64 || digest ~ /[^0-9A-Fa-f]/) fail()
|
|
246
|
+
print digest
|
|
247
|
+
}
|
|
248
|
+
' "${MANIFEST_FILE}"
|
|
249
|
+
)" || { echo "[bootstrap] missing or invalid SHA-256 manifest for ${FILENAME}" >&2; exit 1; }
|
|
250
|
+
case "${EXPECTED_SHA256}" in
|
|
251
|
+
""|*[!0-9A-Fa-f]*) echo "[bootstrap] missing or invalid SHA-256 for ${FILENAME}" >&2; exit 1 ;;
|
|
252
|
+
esac
|
|
253
|
+
if [ "${#EXPECTED_SHA256}" -ne 64 ]; then
|
|
254
|
+
echo "[bootstrap] missing or invalid SHA-256 for ${FILENAME}" >&2
|
|
255
|
+
exit 1
|
|
256
|
+
fi
|
|
257
|
+
|
|
258
|
+
if command -v sha256sum >/dev/null 2>&1; then
|
|
259
|
+
ACTUAL_SHA256="$(sha256sum "${TMPFILE}" | awk '{print $1}')"
|
|
260
|
+
elif command -v shasum >/dev/null 2>&1; then
|
|
261
|
+
ACTUAL_SHA256="$(shasum -a 256 "${TMPFILE}" | awk '{print $1}')"
|
|
262
|
+
elif command -v openssl >/dev/null 2>&1; then
|
|
263
|
+
ACTUAL_SHA256="$(openssl dgst -sha256 "${TMPFILE}" | sed 's/^.*=[[:space:]]*//')"
|
|
264
|
+
else
|
|
265
|
+
echo "[bootstrap] no SHA-256 tool available (sha256sum, shasum, or openssl required)" >&2
|
|
266
|
+
exit 1
|
|
267
|
+
fi
|
|
268
|
+
EXPECTED_SHA256="$(printf '%s' "${EXPECTED_SHA256}" | tr '[:upper:]' '[:lower:]')"
|
|
269
|
+
ACTUAL_SHA256="$(printf '%s' "${ACTUAL_SHA256}" | tr '[:upper:]' '[:lower:]')"
|
|
270
|
+
if [ "${ACTUAL_SHA256}" != "${EXPECTED_SHA256}" ]; then
|
|
271
|
+
echo "[bootstrap] SHA-256 mismatch for ${FILENAME}" >&2
|
|
272
|
+
exit 1
|
|
273
|
+
fi
|
|
274
|
+
echo "[bootstrap] SHA-256 verified"
|
|
275
|
+
|
|
276
|
+
# Extract only after integrity verification. OSS package contains codesec-cli,
|
|
277
|
+
# which is renamed to qodersec during installation.
|
|
114
278
|
tar xzf "${TMPFILE}" -C "${STAGE_DIR}" 2>/dev/null || tar xzf "${TMPFILE}" --strip-components=1 -C "${STAGE_DIR}" 2>/dev/null || { echo "[bootstrap] extraction failed" >&2; exit 1; }
|
|
115
279
|
|
|
116
280
|
# Install: OSS package ships codesec-cli, the on-disk name is qodersec.
|
|
@@ -29,14 +29,14 @@ REM Tell the Go binary to use qodersec-specific naming (log file, etc.)
|
|
|
29
29
|
set "CODESEC_LOG_NAME=qodersec"
|
|
30
30
|
REM Pinned dependency versions (updated when plugin is published)
|
|
31
31
|
REM Set both QODERSEC_* and CODESEC_* for Go binary compatibility
|
|
32
|
-
set "QODERSEC_CLI_VERSION_GLOBAL=0.9.
|
|
33
|
-
set "QODERSEC_CLI_VERSION_CN=0.9.
|
|
34
|
-
set "CODESEC_CLI_VERSION_GLOBAL=0.9.
|
|
35
|
-
set "CODESEC_CLI_VERSION_CN=0.9.
|
|
36
|
-
set "QODERCLI_VERSION_GLOBAL=1.1.
|
|
37
|
-
set "QODERCLI_VERSION_CN=1.1.
|
|
38
|
-
set "QODERCLI_MANIFEST_URL_GLOBAL=https://download.qoder.com/qodercli/channels/1.1.
|
|
39
|
-
set "QODERCLI_MANIFEST_URL_CN=https://static.qoder.com.cn/qoder-cli-cn/channels/1.1.
|
|
32
|
+
set "QODERSEC_CLI_VERSION_GLOBAL=0.9.6"
|
|
33
|
+
set "QODERSEC_CLI_VERSION_CN=0.9.6"
|
|
34
|
+
set "CODESEC_CLI_VERSION_GLOBAL=0.9.6"
|
|
35
|
+
set "CODESEC_CLI_VERSION_CN=0.9.6"
|
|
36
|
+
set "QODERCLI_VERSION_GLOBAL=1.1.81"
|
|
37
|
+
set "QODERCLI_VERSION_CN=1.1.81"
|
|
38
|
+
set "QODERCLI_MANIFEST_URL_GLOBAL=https://download.qoder.com/qodercli/channels/1.1.81/manifest.json"
|
|
39
|
+
set "QODERCLI_MANIFEST_URL_CN=https://static.qoder.com.cn/qoder-cli-cn/channels/1.1.81/manifest.json"
|
|
40
40
|
|
|
41
41
|
REM Hardcoded home — inherited QODERSEC_HOME/CODESEC_HOME are ignored and
|
|
42
42
|
REM overwritten below to prevent arbitrary command execution via env var hijacking.
|
|
@@ -14,14 +14,14 @@ export QODER_PLUGIN_ROOT="$PLUGIN_ROOT"
|
|
|
14
14
|
export CODESEC_LOG_NAME="qodersec"
|
|
15
15
|
|
|
16
16
|
# Pinned dependency versions (updated when plugin is published).
|
|
17
|
-
export QODERSEC_CLI_VERSION_GLOBAL="0.9.
|
|
18
|
-
export QODERSEC_CLI_VERSION_CN="0.9.
|
|
19
|
-
export CODESEC_CLI_VERSION_GLOBAL="0.9.
|
|
20
|
-
export CODESEC_CLI_VERSION_CN="0.9.
|
|
21
|
-
export QODERCLI_VERSION_GLOBAL="1.1.
|
|
22
|
-
export QODERCLI_VERSION_CN="1.1.
|
|
23
|
-
export QODERCLI_MANIFEST_URL_GLOBAL="https://download.qoder.com/qodercli/channels/1.1.
|
|
24
|
-
export QODERCLI_MANIFEST_URL_CN="https://static.qoder.com.cn/qoder-cli-cn/channels/1.1.
|
|
17
|
+
export QODERSEC_CLI_VERSION_GLOBAL="0.9.6"
|
|
18
|
+
export QODERSEC_CLI_VERSION_CN="0.9.6"
|
|
19
|
+
export CODESEC_CLI_VERSION_GLOBAL="0.9.6"
|
|
20
|
+
export CODESEC_CLI_VERSION_CN="0.9.6"
|
|
21
|
+
export QODERCLI_VERSION_GLOBAL="1.1.81"
|
|
22
|
+
export QODERCLI_VERSION_CN="1.1.81"
|
|
23
|
+
export QODERCLI_MANIFEST_URL_GLOBAL="https://download.qoder.com/qodercli/channels/1.1.81/manifest.json"
|
|
24
|
+
export QODERCLI_MANIFEST_URL_CN="https://static.qoder.com.cn/qoder-cli-cn/channels/1.1.81/manifest.json"
|
|
25
25
|
|
|
26
26
|
# Hooks may run with a minimal PATH; add the usual install directories.
|
|
27
27
|
export PATH="$HOME/.qodersec/bin:$HOME/.local/bin:/usr/local/bin:/opt/homebrew/bin:$PATH"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "security-scan",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"description": "Automated security review for Qoder. Pattern-based warnings on edits, cloud-backed diff review on Stop, and agentic commit/push review with SHA tracking.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"private": true
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Qoder security scanning.
|
|
2
|
+
description: "Qoder security scanning. Load before any qodersec use, even from memory or for -h/--help. Use for /security-scan, L2 lightweight/L3 deep security review, L4 full-repo/path cloud scans, cloud scan status/results, or code handoff: push, PR/MR, merge, publish, release, deploy, remote setup for push."
|
|
3
3
|
name: security-scan
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Route security intent to exactly one of four isolated workflows: project/file cloud scan, asynchronous cloud scan result query, L2 lightweight review, or L3 deep review. Keep all qodersec execution private and preserve the decision boundaries below.
|
|
7
7
|
|
|
8
|
+
## Load before qodersec use
|
|
9
|
+
|
|
10
|
+
Before any agent-initiated qodersec invocation, load `security-scan` through the Skill tool if it is not already loaded and follow this body. This includes commands recalled from memory, copied from earlier runs, supplied by the user, or discovered via `-h`/`--help`; load the skill before even requesting help. Memory and help output describe syntax, not authorization, and never replace this workflow. If the skill cannot be loaded, stop instead of executing qodersec directly.
|
|
11
|
+
|
|
12
|
+
L4 project/file scans upload code to the cloud and consume Credits. Obtain upload/cost confirmation before scanning; for a full-repository scan, ask the separate SCA question afterward. Scan approval never authorizes remediation or a later handoff: follow the independent scan, remediation, and post-fix authorization gates below. Respect the L2 lightweight/L3 deep product switches only in their applicable workflows.
|
|
13
|
+
|
|
8
14
|
## Route explicit intent first
|
|
9
15
|
|
|
10
16
|
Use the first matching route. Do not show the fixed mode picker when the user has already supplied a mode or scope.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qoder-ai/qodercli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.89",
|
|
4
4
|
"description": "Qoder AI CLI - AI-powered coding assistant",
|
|
5
5
|
"author": "Qoder AI",
|
|
6
6
|
"type": "module",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"sharp": "^0.34.5"
|
|
21
21
|
},
|
|
22
22
|
"optionalDependencies": {
|
|
23
|
-
"@qoder-ai/qodercli-ripgrep-darwin-arm64": "1.1.
|
|
24
|
-
"@qoder-ai/qodercli-ripgrep-darwin-x64": "1.1.
|
|
25
|
-
"@qoder-ai/qodercli-ripgrep-linux-arm64": "1.1.
|
|
26
|
-
"@qoder-ai/qodercli-ripgrep-linux-x64": "1.1.
|
|
27
|
-
"@qoder-ai/qodercli-ripgrep-win32-arm64": "1.1.
|
|
28
|
-
"@qoder-ai/qodercli-ripgrep-win32-x64": "1.1.
|
|
23
|
+
"@qoder-ai/qodercli-ripgrep-darwin-arm64": "1.1.89",
|
|
24
|
+
"@qoder-ai/qodercli-ripgrep-darwin-x64": "1.1.89",
|
|
25
|
+
"@qoder-ai/qodercli-ripgrep-linux-arm64": "1.1.89",
|
|
26
|
+
"@qoder-ai/qodercli-ripgrep-linux-x64": "1.1.89",
|
|
27
|
+
"@qoder-ai/qodercli-ripgrep-win32-arm64": "1.1.89",
|
|
28
|
+
"@qoder-ai/qodercli-ripgrep-win32-x64": "1.1.89"
|
|
29
29
|
},
|
|
30
30
|
"engines": {
|
|
31
31
|
"node": ">=20.0.0"
|