Skip to content

Commit e7bb38c

Browse files
committed
Add patch-backport manifest json Update security-scan to allow ignoring backported patches
1 parent d41b9d7 commit e7bb38c

7 files changed

Lines changed: 53 additions & 0 deletions

patches/backported-patches.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"finding_id": "GHSA-3pwg-f3hj-wp8p",
4+
"affected_versions": "<1.109.1",
5+
"patch_path": "common/fix-terminal-autoreplies.diff",
6+
"link": "https://github.com/microsoft/vscode/security/advisories/GHSA-3pwg-f3hj-wp8p"
7+
},
8+
{
9+
"finding_id": "CVE-2026-21523",
10+
"affected_versions": "<1.109.1",
11+
"patch_path": "common/fix-terminal-autoreplies.diff",
12+
"link": "https://msrc.microsoft.com/update-guide/vulnerability/CVE-2026-21523"
13+
}
14+
]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Backporting fix for GHSA-3pwg-f3hj-wp8p advisory: https://github.com/microsoft/vscode/security/advisories/GHSA-3pwg-f3hj-wp8p
2+
3+
Based on commit: https://github.com/microsoft/vscode/commit/670c6d9b2a6588cc90a1e347015966dc391795ba
4+
5+
Index: code-editor-src/src/vs/workbench/contrib/terminalContrib/autoReplies/common/terminalAutoRepliesConfiguration.ts
6+
===================================================================
7+
--- code-editor-src.orig/src/vs/workbench/contrib/terminalContrib/autoReplies/common/terminalAutoRepliesConfiguration.ts
8+
+++ code-editor-src/src/vs/workbench/contrib/terminalContrib/autoReplies/common/terminalAutoRepliesConfiguration.ts
9+
@@ -26,6 +26,7 @@ export const terminalAutoRepliesConfigur
10+
},
11+
{ type: 'null' }]
12+
},
13+
+ restricted: true,
14+
default: {}
15+
},
16+
};

patches/sagemaker.series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ common/build.diff
1818
common/integration.diff
1919
common/replace-gulp-untar.diff
2020
common/fix-ts-rootdir-webpack.diff
21+
common/fix-terminal-autoreplies.diff
2122
web-server/suppress-known-errors-build-integration.diff
2223
web-server/local-storage.diff
2324
web-server/base-path.diff

patches/web-embedded-with-terminal.series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ common/build.diff
1818
common/integration.diff
1919
common/replace-gulp-untar.diff
2020
common/fix-ts-rootdir-webpack.diff
21+
common/fix-terminal-autoreplies.diff
2122
web-embedded/readd-workbench.diff
2223
web-embedded/suppress-known-errors-build-integration.diff
2324
web-embedded/disable-built-in-walkthroughs-from-c.diff

patches/web-embedded.series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ common/build.diff
1818
common/integration.diff
1919
common/replace-gulp-untar.diff
2020
common/fix-ts-rootdir-webpack.diff
21+
common/fix-terminal-autoreplies.diff
2122
web-embedded/readd-workbench.diff
2223
web-embedded/suppress-known-errors-build-integration.diff
2324
web-embedded/disable-built-in-walkthroughs-from-c.diff

patches/web-server.series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ common/build.diff
1818
common/integration.diff
1919
common/replace-gulp-untar.diff
2020
common/fix-ts-rootdir-webpack.diff
21+
common/fix-terminal-autoreplies.diff
2122
web-server/suppress-known-errors-build-integration.diff
2223
web-server/local-storage.diff
2324
web-server/base-path.diff

scripts/security-scan.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,21 @@ scan_github_advisories() {
329329
local repo_owner="microsoft"
330330
local repo_name="vscode"
331331
local vscode_version=$(jq -r '.version' third-party-src/package.json)
332+
local backported_file="patches/backported-patches.json"
332333

333334
echo "Found VS Code version: $vscode_version"
334335

336+
# Load backported patches list if exists
337+
local -A backported_patches
338+
if [ -f "$backported_file" ]; then
339+
echo "Loading backported patches from $backported_file"
340+
local finding_ids=$(jq -r '.[].finding_id' "$backported_file")
341+
while IFS= read -r finding_id; do
342+
[ -n "$finding_id" ] && backported_patches["$finding_id"]=1
343+
done <<< "$finding_ids"
344+
echo "Loaded ${#backported_patches[@]} backported patches to ignore"
345+
fi
346+
335347
echo "Fetching security advisories from GitHub API for $repo_owner/$repo_name"
336348

337349
# Fetch security advisories using GitHub CLI
@@ -426,6 +438,13 @@ scan_github_advisories() {
426438
is_version_affected=true
427439
fi
428440

441+
# Check if this advisory is in the backported patches list
442+
if [[ -v backported_patches["$ghsa_id"] ]] || [[ "$cve_id" != "N/A" && -v backported_patches["$cve_id"] ]]; then
443+
echo "ℹ️ Ignoring - patch backported to current version"
444+
advisory_index=$((advisory_index + 1))
445+
continue
446+
fi
447+
429448
# Count concerning advisories based on combined criteria
430449
# Advisory is concerning if BOTH conditions are met:
431450
# 1. Version is affected AND 2. Severity is medium/high/critical

0 commit comments

Comments
 (0)