Repository navigation
fix(paths): build room, engine and pipeline paths through checked helpers - #3390
Merged
Merged
Conversation
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. |
…ting - pathWithin resolves real paths, so a symlink in the folder cannot lead outside it - both helpers refuse a blank folder and log names the file system rejects - an invalid PIPELINE value refuses the engine instead of running it without guardrails - validateEngine and the temp smss check the engine id and name on their own - one external engine that cannot be written is skipped, the sync goes on - null checks for the PIPELINE value and the OneDrive download result
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
Follow-up to #3388 for the Snyk Code rows that are still open after the rescan. The values in these flows were already checked, but with boolean checks Snyk does not follow (
isSafePathSegmentbefore building the path). This builds the paths through helpers that normalize the path, confirm it stays in its folder and return the checked path, the same pattern that cleared the Teams and delegation rows in #3388.Changes
Utility.childPath(folder, name, what): one name under a folder. Refuses blank,.,..,/,\, NUL and NFKC forms that turn into those; the result must be a direct child of the folder. Returns the same string form asfolder + File.separator + name.Utility.pathWithin(folder, relative, what): a relative path, sub folders allowed. Refuses absolute paths, NFKC changes and anything that leaves the folder or equals it, compared on real paths, so a symlink in the folder (or the file itself being a link) cannot lead outside it.:on Windows) is logged and refused like any other bad value.Room.roomFolderPath(room folder for insights, cloud push, transcripts)UploadUtilities.getEngineTempSmssLoc(temp .smss)InternalUtility.getEngineDetails(engine folder and .owl file)ExternalAuthorizationHelper(engine folder for externally granted engines)EngineProxyFactory.pipelineFile(PIPELINE file in the engine assets folder)UploadUtilities.validateEngineandgetEngineTempSmssLoccheck the engine id and name on their own before anything is written, since the unique name normalizes away segments such as...ExternalAuthorizationHelper: one external engine that cannot be written is logged and skipped, the rest of the sync goes on.MicrosoftOneDriveHelper.download: only the temp file it named is moved or deleted; the path returned by the HTTP helper must be that same file.Snyk rows this targets (about 21)
Not changed here, to be ignored with reasons: SSRF on Graph pre-authenticated links (https checked, host is dynamic), AgentsMdLoader (project folder after the edit-permission check), SecretsUtility AES-CBC (needs a separate design), HttpHelperUtility and LinOTP (by design).
Behaviour changes
..path or a symlink out of it) is logged with the engine id and the engine is refused, the same as when its pipeline file cannot be read; it does not run without its guardrails. A leading slash is still ignored, as before, and a missing file is still an engine with no guardrails. The guardrail config reactors get an error for such a value./or..) now fails with "Not a valid engine name/id" when the engine is created, before any folder is made. Previously such a name produced a nested or escaping path.Testing
mvn compilepasses...,a/b, a full-width slash,/etc/passwd,../../,sub/.., a blank folder, a pipeline file that is a link out of the folder, a dangling link and a linked sub folder are refused.