Skip to content

Conversation

@kvnxiao
Copy link

@kvnxiao kvnxiao commented Jan 31, 2026

Description

A cross-platform extension to quickly switch between audio input and output devices.

Features:

  • List all available audio output (playback) and input (recording) devices
  • Switch default audio device with a single action
  • Supports both macOS (via switchaudio-osx) and Windows (via powershell-core AudioDeviceCmdlets)

Prerequisites:

  • macOS: brew install switchaudio-osx
  • Windows: Install-Module -Name AudioDeviceCmdlets -Force via Windows bundled powershell.exe (NOT pwsh.exe)

Screencast

NVIDIA_Overlay_2026-01-30_1769834660_8Wi9y.mp4

Checklist

@raycastbot
Copy link
Collaborator

Congratulations on your new Raycast extension! 🚀

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 10-15 business days.

Once the PR is approved and merged, the extension will be available on our Store.

@kvnxiao kvnxiao marked this pull request as ready for review January 31, 2026 06:21
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 31, 2026

Greptile Overview

Greptile Summary

This PR adds a cross-platform extension for switching audio input/output devices, supporting both macOS (via switchaudio-osx) and Windows (via PowerShell AudioDeviceCmdlets). The extension provides a clean UI for listing devices and switching defaults with proper caching and optimistic updates.

Critical Issues:

  • Command injection vulnerabilities in windows-provider.ts (lines 18, 45) - device IDs and type parameters are directly interpolated into PowerShell commands without sanitization, allowing arbitrary code execution
  • Missing metadata folder - extensions with view commands require a metadata/ folder with Raycast-styled screenshots

Minor Issues:

  • Platforms array has incorrect ordering (should be macOS, then Windows)
  • CHANGELOG uses hardcoded date instead of {PR_MERGE_DATE} placeholder

The macOS implementation correctly uses execFileAsync with parameterized arguments, preventing command injection. The Windows implementation must be updated to follow the same pattern.

Confidence Score: 1/5

  • This PR is NOT safe to merge due to critical command injection vulnerabilities
  • Score reflects two critical command injection vulnerabilities in windows-provider.ts that allow arbitrary PowerShell code execution when setting or listing audio devices. While the macOS implementation is secure and the overall architecture is sound, these security flaws must be resolved before merging.
  • Pay immediate attention to extensions/switch-audio-device/src/lib/windows-provider.ts - contains critical security vulnerabilities that must be fixed

Important Files Changed

Filename Overview
extensions/switch-audio-device/src/lib/windows-provider.ts implements Windows audio device management via PowerShell - contains critical command injection vulnerabilities in lines 18 and 45
extensions/switch-audio-device/src/switch-audio-device.tsx main UI component with device listing, switching, and error handling - well-structured with optimistic updates and proper caching
extensions/switch-audio-device/package.json extension configuration - platforms array has incorrect ordering (Windows before macOS)
extensions/switch-audio-device/CHANGELOG.md changelog for initial release - uses hardcoded date instead of {PR_MERGE_DATE} placeholder

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

@0xdhrv 0xdhrv self-assigned this Jan 31, 2026
@0xdhrv
Copy link
Contributor

0xdhrv commented Jan 31, 2026

Thanks for your contribution 🔥

We already have an extension in the Store that deals with Switching Audio. Could we consider enhancing the existing extension below instead of creating another one?

I see this has support for switching audio devices on windows as well, I suggest we can enhance the existing extension instead of creating a new one.

If there are unique features or workflows you’re aiming to add, we’d love to hear them and see if they can be integrated into this to avoid duplication and improve discoverability.

This would help avoid duplication and keep related functionality consolidated in one place.
As mentioned in our extension guidelines here ↗

@0xdhrv 0xdhrv marked this pull request as draft January 31, 2026 11:32
@kvnxiao
Copy link
Author

kvnxiao commented Jan 31, 2026

Thanks for the response @0xdhrv , what is usually the process or code of conduct for enhancing an existing solution from a different author? The reason why I put this up is I needed something that was cross-platform compatible on both Windows (personal PC) and MacOS (my work laptop). Is this something I need to work out with the extension author themselves or does Raycast have a notion of co-authors already? I will also reach out to @benvp!

@kvnxiao
Copy link
Author

kvnxiao commented Feb 2, 2026

@0xdhrv , I've reached out via email to Ben, the original extension author for the existing "Set Audio Device", and their response was that they currently don't have the time nor interest in the extension anymore so they wouldn't be able to test it. If I make a PR change on top of their extension, would you be able to approve it and get it merged in to the raycast extension store? Let me know your thoughts on how to move forward with this, because I am looking to want something like this that's cross-platform in the extension store.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants