Skip to content

fix(connect): resolve the undo backup from the directory listing - #2028

Merged
Dumbris merged 2 commits into
mainfrom
fix/codeql-oauth-connect
Nov 24, 2026
Merged

Dumbris merged 2 commits into
mainfrom
fix/codeql-oauth-connect

Conversation

@Dumbris

@Dumbris Dumbris commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Follow-up to #2025 for the CodeQL alerts it left open.

  • go/path-injection (alerts 902, 903; internal/connect/undo_record.go): Undo built the backup path, and from it the undo record path, out of the backup name in the request. The name was already validated (bare filename, <config>.bak. prefix), which CodeQL cannot see. Undo now looks the name up in the config directory and builds the path from the name the directory lists. A name that is not listed gets the same not_found answer as before.
  • CodeQL on this PR no longer reports those two, nor the older alert 164 (internal/connect/connect.go), which had the same source.

Not changed: alert 904 (go/weak-sensitive-data-hashing). fileDigest is a change detector for the config file a connect wrote, not a credential hash; going through hash.Hash made no difference to CodeQL, so the body is the original direct call with a comment. A test pins the value to plain SHA-256. The alert needs a dismissal.

Also not changed: alert 900 (go/unvalidated-url-redirection, internal/server/oauth_login_http.go). That redirect goes to the client's registered redirect_uri, which is what OAuth requires; it was dismissed as a false positive.

Testing

  • go test -race ./internal/connect/ ./internal/httpapi/
  • golangci-lint run --config .github/.golangci.yml ./internal/connect/...: 0 issues
  • GOOS=windows go vet ./internal/connect/

Related #1971

Undo built the backup path, and from it the undo record path, out of the
name in the request. The name was already checked to be a bare filename
that belongs to the client's config, but CodeQL reported the resulting
paths as go/path-injection. Undo now looks the name up in the config
directory and uses the name the directory lists; a name that is not
listed gets the same not_found answer as before.

fileDigest keeps the same SHA-256 value but goes through hash.Hash, and
says in a comment that it is a change detector for a config file.

Related #1971
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: c030420
Status: ✅  Deploy successful!
Preview URL: https://3fa680e3.mcpproxy-docs.pages.dev
Branch Preview URL: https://fix-codeql-oauth-connect.mcpproxy-docs.pages.dev

View logs

Comment thread internal/connect/undo_record.go Fixed
Going through hash.Hash did not change what CodeQL reports, so the
function is back to its original body; the comment stays.

Related #1971
@Dumbris
Dumbris enabled auto-merge (squash) November 24, 2026 11:24
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: fix/codeql-oauth-connect

Available Artifacts

  • archive-darwin-amd64 (33 MB)
  • archive-darwin-arm64 (30 MB)
  • archive-linux-amd64 (21 MB)
  • archive-linux-arm64 (19 MB)
  • archive-windows-amd64 (33 MB)
  • archive-windows-arm64 (29 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (29 MB)
  • installer-dmg-darwin-arm64 (26 MB)
  • smart-mcp-proxymcpproxy-goODIA0T.dockerbuild (0 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 45380764276 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@codecov-commenter

codecov-commenter commented Nov 24, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 86.95652% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/connect/undo.go 86.95% 2 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@Dumbris
Dumbris merged commit 6de0e1f into main Nov 24, 2026
52 checks passed
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.

3 participants