File tree Expand file tree Collapse file tree
Plugins/BrowserStackAccessibilityLint Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -560,8 +560,13 @@ private func hardwareIdentifier() throws -> String {
560560private func extractVersion( from url: URL ) -> String ? {
561561 let filename = url. deletingPathExtension ( ) . lastPathComponent
562562 if let range = filename. range ( of: " - " , options: . backwards) {
563- let version = filename [ range. upperBound... ]
564- return version. isEmpty ? nil : String ( version)
563+ let version = String ( filename [ range. upperBound... ] )
564+ if version. isEmpty { return nil }
565+ // Reject path traversal and non-semver characters
566+ let allowed = CharacterSet . alphanumerics. union ( CharacterSet ( charactersIn: " .-+ " ) )
567+ guard version. unicodeScalars. allSatisfy ( { allowed. contains ( $0) } ) else { return nil }
568+ guard !version. contains ( " .. " ) else { return nil }
569+ return version
565570 }
566571 return nil
567572}
You can’t perform that action at this time.
0 commit comments