feat: support Mac App Store version of Slack#1
feat: support Mac App Store version of Slack#1brandon-dacrib wants to merge 1 commit intotherohitdas:mainfrom
Conversation
The Mac App Store version of Slack uses a different keychain account name
('Slack App Store Key') compared to the direct-download version ('Slack').
Both use the same service name 'Slack Safe Storage'.
This change tries the App Store account first, then falls back to the
direct-download account, making slk work with both installation methods.
Also updated README to document both versions and the symlink workaround
for App Store users (data lives in a sandboxed container path).
|
Thanks, I will look into this! |
|
@claude Check this pr for me |
|
Claude finished @therohitdas's task in 1m 43s —— View job Code ReviewReviewing PR #1: feat: support Mac App Store version of Slack SummaryThis PR adds support for the Mac App Store version of Slack by handling the different keychain account name. The approach is solid and the problem is well-documented. However, there are several issues that need to be addressed before merging. 🔴 Critical Issues1. Silent Error Swallowing in Try-Catch (src/auth.js:25-31)The proposed try-catch pattern silently swallows errors, which will make debugging extremely difficult: try {
execSync('security find-generic-password -s "Slack Safe Storage" -a "Slack App Store Key" -w', ...)
} catch {
execSync('security find-generic-password -s "Slack Safe Storage" -a "Slack" -w', ...)
}Problems:
Recommendation: function getKeychainKey() {
// Try Mac App Store version first
try {
return Buffer.from(
execSync('security find-generic-password -s "Slack Safe Storage" -a "Slack App Store Key" -w', {
encoding: "utf-8",
stdio: ['pipe', 'pipe', 'pipe']
}).trim()
);
} catch (err) {
// Only fallback if the key wasn't found (not for permission errors, etc.)
if (!err.message.includes('could not be found')) {
throw new Error(`Keychain access failed: ${err.message}`);
}
}
// Fall back to direct-download version
try {
return Buffer.from(
execSync('security find-generic-password -s "Slack Safe Storage" -a "Slack" -w', {
encoding: "utf-8",
stdio: ['pipe', 'pipe', 'pipe']
}).trim()
);
} catch (err) {
throw new Error(
'Could not find Slack keychain entry. Make sure Slack desktop app is installed and logged in.\n' +
'Tried both Mac App Store ("Slack App Store Key") and direct download ("Slack") versions.'
);
}
}2. Incomplete Documentation - Symlink Required (README.md)The PR description mentions that App Store users need to create a symlink, but I don't see this critical information in the README changes. This is a blocking requirement for App Store users. Missing from README: # Required for Mac App Store version:
ln -s ~/Library/Containers/com.tinyspeck.slackmacgap/Data/Library/Application\ Support/Slack \
~/Library/Application\ Support/SlackRecommendation: Add a dedicated subsection under "Authentication" that explains:
|
Instead of requiring App Store users to manually create a symlink,
auto-detect the Slack data directory at runtime by checking both the
direct-download and App Store sandbox paths. Also handle both keychain
account names ("Slack" vs "Slack App Store Key") with smart ordering
based on which variant was detected.
Addresses PR #1 feedback.
https://claude.ai/code/session_01TPCTdT8Q7mKBW499t4DPJY
Instead of requiring App Store users to manually create a symlink,
auto-detect the Slack data directory at runtime by checking both the
direct-download and App Store sandbox paths. Also handle both keychain
account names ("Slack" vs "Slack App Store Key") with smart ordering
based on which variant was detected.
Addresses PR #1 feedback.
Co-authored-by: Brandon P. <313913+brandon-dacrib@users.noreply.github.com>
https://claude.ai/code/session_01TPCTdT8Q7mKBW499t4DPJY
Problem
slk doesn't work with the Mac App Store version of Slack.
When running
slk authwith the App Store version installed, the command hangs indefinitely or fails silently. This happens because the keychain query is ambiguous.Root cause
The Mac App Store version stores its encryption key under a different keychain account name:
Slack Safe StorageSlackSlack Safe StorageSlack App Store KeyThe current code runs:
security find-generic-password -s "Slack Safe Storage" -wWithout the
-a(account) flag, this query is ambiguous when both keychain entries exist, or returns the wrong key when only the App Store entry exists. Thesecuritycommand may:Additional issue: sandboxed data path
The App Store version also stores its data in a sandboxed container:
Instead of the expected:
Users need to create a symlink for slk to find the cookies and LevelDB files.
Solution
Updated
getKeychainKey()to explicitly specify the account name:This makes the keychain query unambiguous and works with both Slack versions.
Changes
getKeychainKey()to try App Store account first, fall back to direct-downloadTesting
Tested on macOS Sequoia with the Mac App Store version of Slack:
ln -s ~/Library/Containers/com.tinyspeck.slackmacgap/.../Slack ~/Library/Application\ Support/Slackslk auth— successfully authenticatedAlso verified the fallback works by testing with the direct-download version's keychain entry.