Skip to content

Fix ~360 bugs, security issues and performance problems found in 21 rounds of code review - #1

Merged
ShikeChen-MS merged 8 commits into
mainfrom
code-review-fixes
Nov 14, 2026
Merged

ShikeChen-MS merged 8 commits into
mainfrom
code-review-fixes

Conversation

@ShikeChen-MS

@ShikeChen-MS ShikeChen-MS commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

This PR collects the fixes from 21 rounds of independent code review of TermRest. Each round, seven reviewers read one area each for bugs, security flaws and performance problems:

  • HTTP and TLS
  • recording and history
  • workspace and CLI
  • collections and YAML
  • scripting
  • TUI shell
  • TUI views

Every finding was triaged before the next round started. Each accepted finding was fixed with a test that fails without the fix, and the whole suite was verified on Windows, Linux and Native AOT. About 360 findings are fixed: roughly 65 security, 30 performance, and the rest bugs.

What a script does stays the user's responsibility, as designed: scripts run in the runtime the user chooses.

Highlights

Security

  • Files from outside the workspace folder (rounds 20–21):
    • Requests send body and form-data files only from the workspace folder, also once links are resolved, unless files from outside it are allowed for that folder (Tools › Settings › Outside files, or --allow-outside-files). A cloned collection could otherwise upload any file the user can read, such as SSH keys.
    • Links are followed as the OS follows them, including an absolute link target with .. after another link.
    • On Windows, client certificates and the CA bundle on a network share outside the folder aren't opened until then either, and the Body tab doesn't look up paths outside the folder. Looking at \\server\share makes Windows sign in to that server with the user's credentials.
  • Credentials only go where they belong.
    • A redirect to another host drops auth headers, API keys, cookies and the client certificate chosen for the original URL.
    • A Digest or NTLM password is never sent in answer to a Basic challenge.
    • v3 credential sets are chosen by their URL rules, including in duplicated folders.
    • A curl command pasted into a request from history becomes a standalone request, without the original request's auth or scripts.
  • No header injection: header values containing CR, LF or NUL are refused.
  • Secrets are masked in history and redacted in recordings, reports, errors and the UI in every form a server may echo them back:
    • URL-escaped and JSON-escaped
    • UTF-16 and UTF-32, and JSON after a byte order mark
    • URL user info and proxy passwords
    • more credential header names, such as X-Auth-Key and Ocp-Apim-Subscription-Key
    • values that scripts store
  • cURL export quotes safely. It refuses a request that curl would send differently, or that TermRest itself would not send.
  • Files:
    • Saves are atomic, go through symbolic links and keep file permissions, and copies of private files stay private.
    • A cloned workspace's settings can't silently send requests through a proxy or turn off TLS verification.
    • Script runtimes are never started from the workspace folder.

Collections and environments

  • Postman v2.1 JSON and v3 YAML files round-trip unchanged. YAML is read back exactly as it will be written before it is saved, including final line breaks and block scalars at the end of a file.
  • Hostile files are refused instead of crashing or hanging TermRest: deep nesting, devices, huge files and self-referencing variables.
  • v3 secrets, credential sets, and collections without a root definition are read as Postman writes them.
    • The workspace now loads Native Git collections whose requests are all in folders.
    • convert and validate refuse folders that aren't collections.
  • A workspace folder that can't be listed, or a link to a collection folder that is gone, is reported as a load error. Before, the workspace failed to open, or the collection disappeared without a word.

Scripts

  • The Python, JavaScript, C# and PowerShell workers keep a run's output, tests and variable changes when a thrown value can't be described, or when the request the scripts left can't be sent. Previously the whole run failed with "The script runner failed".
  • Output, memory and run time are bounded, and PowerShell's console capture works across runspaces.
  • Error headings say whether the scripts didn't run or failed.
  • In Python, tr.request.headers can be replaced with a dict, any other mapping, or a list of pairs, as with requests.
  • On Linux and macOS, a C# #:project path is passed by its real path: NuGet drops the projects a project references when the path to it goes through a symbolic link, such as macOS's /var.

HTTP and TLS

  • TLS details are recorded when the handshake completes and read again after the response. Protocol, cipher and client certificate are therefore correct for servers that close the connection after responding, and for servers that ask for the certificate later through a TLS 1.2 renegotiation.
  • Content-Type and charset handling is lenient:
    • a header with a stray ; is kept as received;
    • legacy code pages are decoded;
    • UTF-16 without a byte order mark is detected.

TUI

  • The editor's context follows reloads, deletes, requests opened from history, and Ctrl+N. That context is the inherited auth, scripts, client certificate and body file.
  • Requests typed outside a collection are consistent scratch requests.
  • Copy as cURL refuses requests TermRest wouldn't send.
  • The response view shows at most 1 MB of the body and of script output.

CLI and tests

  • send, run, history, convert and validate have clearer exit codes and messages.
  • A new test project, TermRest.Cli.Tests, runs the built termrest as a separate process.
  • history --show tells a response without a body (204, HEAD) from one whose body wasn't kept.
  • The suite now has 1026 tests.

Commits

Commit Content
2314827 Core, CLI and TUI: fixes from 18 rounds of code review
3d2c151 Docs: what 18 rounds of code review settled
ea35bad Core and TUI: fixes from review round 19
bc8b69c Docs: review round 19
d0a28a1 Core, CLI and TUI: fixes from review rounds 20 and 21
ede24b0 Docs: review rounds 20 and 21
f8ca53d Core and CLI: fixes from the Copilot review of this PR
a1444ca Core: fixes from the second Copilot review of this PR

The fixes span all three layers, so the code is in one commit per review batch, with the README changes in a separate commit. Every commit builds on its own.

Testing

Check Result
Windows, full suite 1026 tests: 1018 passed, 8 platform skips
Linux, WSL Ubuntu 24.04, full suite 1021 tests: 1011 passed, 10 Windows-only or root skips (run before the one-line YAML key fix and the Copilot review fixes; CI runs them on Ubuntu and macOS, and the new Linux-only tests fail without their fixes in WSL)
New security tests, Linux The link tests fail with the round-21 fixes reverted and pass with them
Native AOT publish, win-x64 0 warnings, ~20.2 MB
termrest validate over 797 real v3 collections from public repositories 788 pass; the rest are the 7 known invalid sample files and 2 folders that aren't collections

macOS is covered by CI only. The new renegotiation test skips its assertion where the test server can't renegotiate (macOS). The two macOS failures on bc8b69c (a C# #:project build through /var, and a PowerShell memory bound measured on Linux and Windows only) are fixed in d0a28a1.

Notes

  • Two redaction tests use Stripe's public sample test key. It is written as "sk_test_" + "…" so GitHub push protection doesn't flag it.
  • The five comments of the two Copilot reviews of this PR are fixed in f8ca53d and a1444ca, each with a test that fails without its fix.
  • The review loop continues: round 22 is under way. If it finds anything, the fixes will land on this branch as follow-up commits.

ShikeChen-MS and others added 6 commits November 13, 2026 22:09
Eighteen rounds of independent review, by seven reviewers each round (HTTP, recording, workspace and CLI, collections, scripting, TUI shell, TUI views), looked for bugs, security flaws and performance problems. About 345 findings were fixed, 60 of them security fixes, each with a test that fails without its fix, verified on Windows, Linux and Native AOT. What a script does stays the user's responsibility, as designed.

Security: credentials go only where they belong. Redirects to other hosts drop auth headers, API keys, cookies and the client certificate chosen for the original URL; a Digest or NTLM password is never sent to a Basic challenge; v3 credential sets are chosen by their URL rules (also in a copy of a folder); a curl command pasted into a request from history no longer takes its folder's auth. Header values with CR, LF or NUL are refused. Secrets are masked in the history and redacted in recordings, reports, errors and the UI in the forms a server may echo them (URL- and JSON-escaped, UTF-16 and UTF-32, JSON after a byte order mark, URL user info, proxy passwords, names such as X-Auth-Key or Ocp-Apim-Subscription-Key, values scripts store). Exported curl commands quote what they must and refuse what curl would send differently or TermRest would not send. Files are written atomically, through links, keeping their permissions; copies of private files stay private; a cloned workspace's settings can't silently send requests through its proxy or turn TLS checks off; script runtimes are never started from the workspace folder.

Collections and environments: Postman v2.1 JSON and v3 YAML round-trip unchanged, and YAML is read back as it will be written (final line breaks, block scalars at the end of a file) before it is saved. Hostile files (deep nesting, devices, huge files, self-referencing variables) are refused instead of crashing or hanging. v3 secrets, credential sets and collections without a root definition are read as Postman writes them: the workspace now loads Native Git collections whose requests are all in folders, and convert and validate refuse folders that aren't collections.

Scripts: the Python, JavaScript, C# and PowerShell workers keep a script's output, tests and variable changes when a thrown value can't be described or the request the scripts left can't be sent, instead of failing the whole run. Output, memory and run time are bounded (PowerShell's console writer works across runspaces), and errors say whether the scripts didn't run or failed.

HTTP: TLS details are read when the handshake completes and again after the response, so the protocol, cipher and client certificate are right for servers that close the connection or ask for the certificate later. A Content-Type that .NET's parser rejects (a stray ;) is kept as received, and bodies are decoded from legacy code pages and from UTF-16 without a byte order mark.

TUI: the editor's context (inherited auth, scripts, client certificate, body file) follows reloads, deletes, requests from history and Ctrl+N; a request typed where a deleted one was is a scratch request; Copy as cURL refuses what TermRest wouldn't send; the response's body and script output are shown up to 1 MB.

CLI: clearer exit codes and messages for send, run, history, convert and validate. A new test project, TermRest.Cli.Tests, runs the built termrest as a separate process; the suite has 1009 tests.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
README: how credentials are masked and redacted (history, recordings, reports), where redirects and v3 credential sets send them, and what a curl command pasted into a request from history takes; what curl export refuses; what scripts' output and errors look like, and what happens to a request the scripts leave unusable (Python headers as a dict too); how YAML files keep their final line break; which folders in postman/collections are collections, and what convert and validate accept; how TLS details are read; the Scripts tab's and the response's limits.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A curl command pasted into a request opened from the history no longer keeps that request's description, scripts and script settings: as one imported from the menu, it is a request of its own, and the request's scripts (which could add its credentials) don't run for the host it names. A collection folder in postman/collections that has a folder named postman is opened as that collection when it is given on its own (run, send, import-curl, history, the UI), not as a workspace. Python scripts can replace tr.request.headers with any mapping, such as requests' CaseInsensitiveDict or urllib's headers, as well as with a dict or pairs. The test server echoes without a client certificate where Kestrel can't renegotiate (macOS), so the round-18 renegotiation test passes on the macOS CI job.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
README: a curl command pasted into a request from the history takes neither the auth nor the scripts of that request or its folders; Python's tr.request.headers can be replaced with any mapping.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Requests send body and form-data files only from the workspace folder, also once links are resolved, unless files from outside it are allowed for that folder (Tools › Settings › Outside files, kept in the user's settings; or --allow-outside-files on send, run and certs list): a cloned collection could otherwise upload any file the user can read. Links are followed as the OS follows them, so an absolute link target with a .. after another link (/proc/self/cwd/d/../.ssh/id_rsa) no longer passes as text. On Windows, client certificates and the CA bundle on a network share outside the folder are not opened until then either, and the Body tab no longer looks up a path outside the folder, nor any file outside File mode: looking at \\server\share makes Windows sign in to that server with the user's credentials.

A folder of the workspace that can't be listed, and a link in postman/collections (or postman/collections, environments or globals themselves) to something that is gone, are now load errors; before, the workspace failed to open, or the collection vanished without a word. On Linux and macOS, a C# #:project path is passed by its real path, as NuGet drops the projects a project references when the path to it goes through a symbolic link (macOS's /var); with a PowerShell output-memory bound measured on macOS, this fixes the macOS CI job. A curl command pasted into a request from the history while it is on its way detaches that send and clears the response pane. history --show tells a response without a body (204, HEAD) from one whose body isn't kept. YAML keys that hold " *" are written double-quoted, as YamlDotNet reads them as text. The CLI tests' server reads a request's body before it answers.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
README: files from outside the workspace folder (body and form-data files; on Windows, certificates and the CA bundle on network shares) are used only once allowed for that folder, in Tools › Settings › Outside files or with --allow-outside-files (send, run, certs list), and the Body tab doesn't look such paths up; folders that can't be listed and links to folders that are gone are load errors; YAML keys that hold " *" are written double-quoted.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 14, 2026 20:21
@ShikeChen-MS ShikeChen-MS changed the title Fix ~350 bugs, security issues and performance problems found in 19 rounds of code review Fix ~360 bugs, security issues and performance problems found in 21 rounds of code review Nov 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical issues can silently omit failed request loads while reporting success and override explicit redaction settings, risking incomplete outputs and sensitive-data exposure.

3 open issues
What changed in this PR

This PR hardens TermRest’s Core, CLI, and terminal UI through fixes collected across 19 review rounds, with regression coverage for security, data preservation, and performance.

Changes:

  • Strengthens credential handling, redaction, runtime selection, and workspace permissions.
  • Improves collection round-tripping, save-conflict detection, CLI diagnostics, and UI behavior.
  • Adds CLI integration infrastructure and expands Core and TUI regression tests.
File Description
tests/​TermRest.Tui.Tests/​UiTests.cs Tests Unicode-safe wrapping.
tests/​TermRest.Tui.Tests/​TimerResolutionTests.cs Makes timing checks more tolerant of load.
tests/​TermRest.Tui.Tests/​SyntaxTests.cs Covers nested interpolation and scan performance.
tests/​TermRest.Tui.Tests/​ScriptsDialogTests.cs Tests workspace runtime selection.
tests/​TermRest.Tui.Tests/​KeyValueTableTests.cs Covers checkbox clicks and selection.
tests/​TermRest.Tui.Tests/​Infrastructure/​LocalEchoServer.cs Adds controllable delayed responses.
tests/​TermRest.Tui.Tests/​CollectionTreeTests.cs Tests Unicode names and duplicate labels.
tests/​TermRest.Tui.Tests/​BulkEditTests.cs Covers row fidelity and masked secrets.
tests/​TermRest.Core.Tests/​VariableResolverTests.cs Tests expansion limits and variable precedence.
tests/​TermRest.Core.Tests/​UrlMatchPatternTests.cs Covers internationalized and IPv6 hosts.
tests/​TermRest.Core.Tests/​TextFileTests.cs Tests save failures and unsafe inputs.
tests/​TermRest.Core.Tests/​PostmanRequestMapperTests.cs Verifies preservation of value types.
tests/​TermRest.Core.Tests/​PostmanFidelityTests.cs Tests mixed line-ending normalization.
tests/​TermRest.Core.Tests/​MeasuredAloneTests.cs Measures script-output memory usage.
tests/​TermRest.Core.Tests/​Infrastructure/​TestPowerShell.cs Updates runtime-check invocation.
tests/​TermRest.Core.Tests/​Infrastructure/​TestPki.cs Adds certificate scenarios and store cleanup.
tests/​TermRest.Core.Tests/​Infrastructure/​TestCSharp.cs Updates runtime-check invocation.
tests/​TermRest.Core.Tests/​Infrastructure/​EchoServer.cs Adds TLS, authentication, and response fixtures.
tests/​TermRest.Core.Tests/​CertificateLoaderTests.cs Covers read errors and certificate caching.
tests/​TermRest.Core.Tests/​BodyFileTests.cs Tests legacy XML encodings.
tests/​TermRest.Cli.Tests/​TermRest.Cli.Tests.csproj Adds the CLI integration test project.
tests/​TermRest.Cli.Tests/​Infrastructure/​Termrest.cs Runs isolated CLI subprocesses.
TermRest.slnx Includes CLI tests in the solution.
src/​TermRest.Tui/​Views/​ScriptsEditor.cs Preserves untouched scripts during editing.
src/​TermRest.Tui/​Views/​RequestEditor.cs Adds context and body-file refresh hooks.
src/​TermRest.Tui/​Views/​RecordingIndicator.cs Displays elapsed hours beyond one day.
src/​TermRest.Tui/​Views/​KeyValueTable.cs Fixes checkbox, keyboard, and rebinding behavior.
src/​TermRest.Tui/​Views/​HistoryView.cs Bounds entries and batches list updates.
src/​TermRest.Tui/​Views/​CollectionTree.cs Safely displays and distinguishes collection names.
src/​TermRest.Tui/​Views/​AuthEditor.cs Masks tokens and refreshes inherited auth.
src/​TermRest.Tui/​TuiApp.cs Improves startup, configuration, and error logging.
src/​TermRest.Tui/​TimerResolution.cs Adapts UI pacing to activity.
src/​TermRest.Tui/​Theming/​ThemeCatalog.cs Handles theme dependencies and safe copy names.
src/​TermRest.Tui/​Syntax/​SyntaxLexer.cs Limits recursive interpolation highlighting.
src/​TermRest.Tui/​Syntax/​PythonLexer.cs Bounds quote-run checks.
src/​TermRest.Tui/​Syntax/​PowerShellLexer.cs Bounds variable and type scans.
src/​TermRest.Tui/​Syntax/​JavaScriptLexer.cs Limits regular-expression scanning.
src/​TermRest.Tui/​Syntax/​CSharpLexer.cs Avoids repeated scans of malformed literals.
src/​TermRest.Tui/​Dialogs/​ThemeDialog.cs Improves copying, saving, and preview restoration.
src/​TermRest.Tui/​Dialogs/​ScriptsDialog.cs Clarifies runtime paths and check status.
src/​TermRest.Tui/​Dialogs/​RecordingDialog.cs Fixes browse-button and label behavior.
src/​TermRest.Tui/​Dialogs/​EnvironmentsDialog.cs Improves imports, empty state, and saving.
src/​TermRest.Core/​Yaml/​YamlFolding.cs Preserves whitespace and surrogate pairs.
src/​TermRest.Core/​Yaml/​YamlFile.cs Validates rendered YAML before saving.
src/​TermRest.Core/​Workspace/​WorkspaceSettings.cs Adds environment identity and proxy classification.
src/​TermRest.Core/​Workspace/​UserSettings.cs Stores permissions and protects unreadable settings.
src/​TermRest.Core/​Variables/​VariableResolver.cs Bounds expansion and adjusts dynamic-variable precedence.
src/​TermRest.Core/​Scripting/​ScriptRuntimeLocator.cs Restricts executable lookup and runtime-check location.
src/​TermRest.Core/​Scripting/​ScriptModel.cs Distinguishes script failure headings.
src/​TermRest.Core/​Recording/​SecretNames.cs Refines automatic secret-name detection.
src/​TermRest.Core/​Recording/​HarEntryWriter.cs Improves encoding handling and transfer metadata.
src/​TermRest.Core/​Postman/​V3/​V3Names.cs Hardens filenames and collection discovery.
src/​TermRest.Core/​Postman/​PostmanUrl.cs Adds credential masking and URL-location helpers.
src/​TermRest.Core/​Postman/​PostmanRequestMapper.cs Preserves value types and optional fields.
src/​TermRest.Core/​Postman/​PostmanEnvironment.cs Adds conflict checks and validated YAML saves.
src/​TermRest.Core/​Postman/​PostmanCollection.cs Detects save conflicts and reports conversion losses.
src/​TermRest.Core/​Postman/​CollectionNodes.cs Loads folder credential sets.
src/​TermRest.Core/​Model/​AuthSpec.cs Represents URL-selected credential sets.
src/​TermRest.Core/​Json/​PostmanJson.cs Rejects duplicate properties and unpaired surrogates.
src/​TermRest.Core/​IO/​FileStamp.cs Tracks external file changes.
src/​TermRest.Core/​IO/​FileChangedException.cs Reports save conflicts.
src/​TermRest.Core/​Import/​ShellWords.cs Refines dialect detection and Unicode escapes.
src/​TermRest.Core/​Http/​HttpExchange.cs Adds received-body size metadata.
src/​TermRest.Core/​Http/​BodyFile.cs Supports legacy XML encodings.
src/​TermRest.Core/​History/​HistoryStore.cs Serializes mutations and improves cleanup reporting.
src/​TermRest.Core/​Certificates/​UrlMatchPattern.cs Normalizes internationalized and IPv6 hosts.
src/​TermRest.Core/​Certificates/​CertificateRegistry.cs Guards against external registry changes.
src/​TermRest.Core/​Certificates/​CertificateLoader.cs Improves read errors and failure cleanup.
src/​TermRest.Core/​Auth/​AuthApplier.cs Restricts challenge schemes and refines secret handling.
src/​TermRest.Cli/​ValidateAndCertsCommands.cs Improves validation and certificate diagnostics.
src/​TermRest.Cli/​ThemesCommand.cs Handles settings failures and duplicate theme names.
src/​TermRest.Cli/​SendCommand.cs Handles ambiguity, export errors, and binary output.
src/​TermRest.Cli/​ScriptOutput.cs Uses shared script-error headings.
src/​TermRest.Cli/​RequestOptions.cs Adds file permissions and configuration diagnostics.
src/​TermRest.Cli/​ImportCurlCommand.cs Improves input, target selection, and save errors.
src/​TermRest.Cli/​HistoryCommand.cs Reports read and cleanup failures accurately.
src/​TermRest.Cli/​ConvertCommand.cs Guards incomplete conversions and reports format losses.
src/​TermRest.Cli/​ConsoleText.cs Adds Unicode-safe Windows standard streams.
src/​TermRest.Cli/​CliApp.cs Supports graceful cancellation and Unicode command output.

Review effort: Balanced

Comment thread src/TermRest.Cli/RequestOptions.cs Resolved
Comment thread src/TermRest.Core/Import/ShellWords.cs Resolved
send, run, convert and validate tell files of a v3 collection that could not be read from the note about non-HTTP requests that are not shown by a flag the collection sets as it loads (HasUnreadableFiles), not by the text of its warnings: a file or folder that could not be read and whose name holds "non-HTTP" was taken for that note, so the commands succeeded without it and convert wrote the collection without it. Names added to recordingRedact win over the names known not to be credentials (Access-Control-Allow-Credentials). A PowerShell curl.exe command whose double-quoted value ends in a backslash ("C:\temp\") is read as PowerShell when a backtick ends one of its lines: in PowerShell's "…" only the backtick escapes, and the other shells' reading took the value for one that went on past it, so the URL became part of the body.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 14, 2026 20:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Environment saves can create world-readable copies containing secrets, while same-size, timestamp-preserving external edits can be silently overwritten without conflict detection.

2 open issues
2 previously missed issues

In code that hasn't changed since last review

Medium severity Propagate inaccessible child discovery errors

src/​TermRest.Core/​Postman/​V3/​V3Names.cs:99

For a collection with no root definition or root-level request, an unreadable child directory can make discovery classify the whole collection as absent, silently hiding its readable requests too. Propagate the discovery error so MayBeCollection retains the candidate and loading reports the inaccessible path instead of omitting the collection.

Medium severity Honor declared charset before the UTF-8 shortcut

src/​TermRest.Core/​Recording/​HarEntryWriter.cs:100

A text/plain; charset=Shift_JIS response containing bytes C2 A9 represents ツゥ, but this UTF-8 shortcut records © instead. The recording therefore disagrees with the displayed response, and known-secret matching receives the wrong text. After handling a byte order mark, honor the declared charset even when the bytes happen to be valid UTF-8.

3 resolved since last review

Review effort: Balanced

Comment thread src/TermRest.Core/IO/FileStamp.cs Resolved
Saving never overwrites a file whose content another program changed, also when the new content has the same length and the file kept its time (a copy made with cp -p or rsync -t, a file from an archive): the content's hash is compared whenever the length matches, not only when the time differs. An environment saved under another path is as private as the file it was read from also when the paths differ only in case, which on Linux is another file: there it was written with the default permissions (0644 with a 022 umask).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 14, 2026 21:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Workspace permission matching conflates case-distinct paths on case-sensitive macOS volumes, allowing upload and proxy permissions to apply to another workspace without consent.

No open issues 🎉

3 previously missed issues

In code that hasn't changed since last review

High severity Use case-sensitive workspace matching on case-sensitive macOS volumes

src/​TermRest.Core/​Workspace/​UserSettings.cs:195

On a case-sensitive macOS volume, SameFolder treats distinct workspaces such as /work/API and /work/api as identical, so allowing outside files for one also authorizes uploads from the other without consent. The proxy-consent lookup at UserSettings.cs:134 has the same issue. Use conservative ordinal matching on macOS (or filesystem-aware identity) consistently for granting, checking and revoking permissions, and add case-distinct workspace tests.

Medium severity Detect cmd.exe continuations when apostrophes appear in commands

src/​TermRest.Core/​Import/​ShellWords.cs:105

Apostrophes are ordinary characters in cmd.exe, so this scan hides the caret continuation in curl https://example.com --data foo'bar ^ followed by a newline and -H X-Test:ok. Detection falls back to POSIX parsing, which absorbs the header into the unterminated body string. Account for cmd.exe's quoting rules when detecting continuations and add this regression case to CurlImporterTests.

Medium severity Propagate unreadable nested-folder errors during collection discovery

src/​TermRest.Core/​Postman/​V3/​V3Names.cs:98

For a definition-less Native Git collection whose requests are all in an unreadable child folder, this catch turns the access failure into false, so workspace discovery silently omits the collection. Let these I/O and access errors propagate to MayBeCollection, which retains candidates whose contents could not be checked so loading can report the failure. Add a regression case for an unreadable nested folder.

2 resolved since last review

Review effort: Balanced

@ShikeChen-MS
ShikeChen-MS merged commit 76a2bf7 into main Nov 14, 2026
11 checks passed
@ShikeChen-MS
ShikeChen-MS deleted the code-review-fixes branch November 14, 2026 21:38
ShikeChen-MS added a commit that referenced this pull request Nov 15, 2026
MIT license, app icon, and fixes from the last Copilot review of #1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants