Repository navigation
fix(connectors): keep Graph links, ids and remote file names in bounds - #3385
Merged
Merged
Conversation
…the service host Add ConnectorGuards: a nextLink that is sent with the user's token must stay on graph.microsoft.com, a pre-authenticated download or upload link must be https, and ids placed in url paths are encoded only where they could change the path. Applied at the Graph request choke points (storage engine graphGet, drive client, OneDrive, Teams, Calendar, Outlook, Brain Graph sources, user search) and the VirusTotal analysis id.
Resolve names that Graph listings return against the real destination folder and refuse anything that leaves it (storage engine downloads, sync down, version download), and reduce the Teams helper's target name to a base name as the OneDrive helper already does.
Collapse CR, LF and NUL in the subject, In-Reply-To, References and carried attachment content type before they are written as headers of the outgoing draft.
…host and scheme case-insensitively
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This was referenced Nov 24, 2026
Merged
kunal0137
marked this pull request as ready for review
November 24, 2026 21:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Snyk Code SSRF, path traversal and CRLF findings in the Microsoft Graph, Gmail and related connector code.
prerna.io.connector.ConnectorGuards:requireUnder(link, base): a link sent with the user's bearer token (for example an@odata.nextLink) must stay on the service's own scheme, host, port and base path, with no userinfo. Applied to the Graph storage engines, drive client, OneDrive, Teams, Calendar and Outlook helpers (Outlook keeps its configurable Graph base URL), and the Collaboration Graph header/message sources.requirePreAuthenticated(link): pre-authenticated download/upload links must be https with a host.segment(id): ids placed in URL paths are encoded only where they could change the path (ids like19:abc@thread.v2andb!01ABCpass through unchanged).resolveWithin(root, relative): remote file names must resolve inside the real destination folder, symlinks included.Behaviour changes
https://graph.microsoft.com(or the configured Outlook Graph base) now fails withIllegalArgumentExceptioninstead of being followed with the token.Testing
file:, dot segments,../, absolute paths, backslashes and symlinked folders.Notes
Files in #3016 are left alone. The remaining Snyk rows in these files are false positives (host is a constant or admin config, cookies sent to a Selenium-driven browser, etc.) and will be handled as Snyk ignores.
Related Snyk PRs
Independent of each other unless noted; none are stacked.