Skip to content

fix(security): keep room, Teams and external engine paths in bounds (Snyk) - #3388

Merged
kunal0137 merged 5 commits into
devfrom
fix-snyk-open-pr-paths
Nov 25, 2026
Merged

kunal0137 merged 5 commits into
devfrom
fix-snyk-open-pr-paths

Conversation

@kunal0137

Copy link
Copy Markdown
Collaborator

Summary

Closes the Snyk Code rows in Semoss that were waiting on #3016. This branch starts fresh from current dev instead of reviving that branch; #3016 was read as reference only.

  • Agent runtime (20 path traversal rows): Room.roomFolderPath is now the single room-folder builder, and it rejects an unsafe room id (blank, ., .., /, \\, NUL). Six places that built the path by hand now call it: the CentralCloudStorage room pull/push, ClaudeCodeManager, GitHubCopilotPyManager and the two transcript locators. HumanDelegationService checks the run id and refuses a copy target outside the room folder. CentralCloudStorage.pullEngine requires a safe engine id.
  • MicrosoftTeamsHelper (12 rows): Graph ids go into URLs through ConnectorGuards.segment. Downloaded file names are reduced to a base name and resolved inside the target folder, the same as the OneDrive helper in fix(connectors): keep Graph links, ids and remote file names in bounds #3385.
  • ExternalAuthorizationHelper (5 rows): engines from the external permission API whose id or name is not a safe file name are skipped, with a log line.
  • AwsS3VectorDatabaseEngine (1 row): uses storedDocument / storedDocumentToRemove, like the other nine vector engines since fix(vector): keep embedding inputs, zip entries and stored documents inside their folders #3386.
  • New shared helper: Utility.isSafePathSegment / requireSafePathSegment.

Behaviour changes (each refusal is logged)

  • An unsafe room id now throws from Room.roomFolderPath. Room ids are server-generated UUIDs, so real rooms are not affected.
  • External permission sync skips engines with an unsafe id or name.
  • A Teams file name containing / is saved under its base name.

Testing

  • mvn compile is clean.
  • Local lane: 1+1, CreateRoom then BrowseRoomAssets both work. A room row with id ../x is refused with "Not a valid room id" and no folder is created.
  • Not run live (no accounts or cluster locally): Teams, external permission sync, S3 vectors, cluster engine pull.

@snyk-io

snyk-io Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

…sses

- isSafePathSegment also checks the NFKC form, since normalizePath applies it
- pullEngine and pushEngineSmss check the final engine paths stay in the engine folder
- delegation copies and listings resolve real paths inside the room, never the room folder itself
- room ids are checked before the room row is inserted
- AWS S3 vector remove and list only use this engine's own index classes
- Teams download returns the file name in the destination; listing returns the raw drive id; . and .. folder segments are refused
@kunal0137
kunal0137 marked this pull request as ready for review November 25, 2026 19:13
@kunal0137
kunal0137 requested a review from a team as a code owner November 25, 2026 19:13
@kunal0137
kunal0137 merged commit d6f9ae6 into dev Nov 25, 2026
5 checks passed
@kunal0137
kunal0137 deleted the fix-snyk-open-pr-paths branch November 25, 2026 19:14
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.

1 participant