fix: scrub checkout credential includes - #3
Conversation
| function isPathUnder(parent: string, child: string) { | ||
| const normalizedParent = normalizePathForComparison(tryRealpath(parent)); | ||
| const normalizedChild = normalizePathForComparison(tryRealpath(child)); | ||
| const relative = normalizedChild.slice(normalizedParent.length); |
There was a problem hiding this comment.
WARNING: isPathUnder never confirms that normalizedChild actually starts with normalizedParent.
relative = normalizedChild.slice(normalizedParent.length) is only meaningful when the child is a prefix-extension of the parent. Without checking normalizedChild.startsWith(normalizedParent) first, a child that does not share the parent prefix can still produce a relative substring that starts with / or \, causing a false-positive match. For example isPathUnder("/a/b", "/x/y/z") returns true (relative becomes "/z"). In practice this means an includeIf value not under RUNNER_TEMP could be classified as under it and get scrubbed, removing a legitimate user include. Verify the prefix (with a separator boundary) before computing the relative slice.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| if (parsed.hostname.toLowerCase() !== serverUrl.hostname.toLowerCase()) { | ||
| return undefined; | ||
| } | ||
| if (parsed.port !== serverUrl.port) return undefined; |
There was a problem hiding this comment.
WARNING: An explicit default port on the configured host lets embedded credentials survive the scrub.
parsed.port !== serverUrl.port is a strict string compare with no default-port normalization. A remote.origin.url such as https://x-access-token:token@github.com:443/owner/repo.git for serverUrl = https://github.com gives parsed.port = "443" vs serverUrl.port = "", so cleanConfiguredHostRemoteUrl returns undefined and the embedded token is left in place. Treat https/443 and http/80 as equivalent to an empty port (or compare via new URL default-port resolution) before deciding to scrub.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge The two previously-reported issues ( Files Reviewed (2 files)
Previous Review Summaries (2 snapshots, latest commit 6f89ae0)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 6f89ae0)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous review (commit 17125c8)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (6 files)
Reviewed by glm-5.2-short · Input: 31K · Output: 2.5K · Cached: 278.2K |
fix: scrub checkout credential includes
Root cause:
Changes:
Validation:
Impact: