Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/platforms/slack/ensure-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export async function ensureSlackAuth(): Promise<void> {
await credManager.setCurrentWorkspace(validWorkspaces[0].workspace_id)
}
} catch (error) {
if ((error as NodeJS.ErrnoException).code === 'EBUSY' || (error as Error).message.includes('locking the cookie')) {
const code = typeof error === 'object' && error !== null ? (error as NodeJS.ErrnoException).code : undefined
const message = error instanceof Error ? error.message : String(error)
if (code === 'EBUSY' || message.includes('locking the cookie')) {
throw error
}
// Silently ignore other extraction errors (e.g. Slack not installed)
Expand Down
10 changes: 6 additions & 4 deletions src/platforms/slack/token-extractor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,12 @@ describe('TokenExtractor Windows DPAPI', () => {
})

// when — then
const extractor = new TokenExtractor('darwin', slackDir)
await expect(extractor.extract()).rejects.toThrow('Quit the Slack app completely and try again')

copyFileSyncSpy.mockRestore()
try {
const extractor = new TokenExtractor('darwin', slackDir)
await expect(extractor.extract()).rejects.toThrow('Quit the Slack app completely and try again')
} finally {
copyFileSyncSpy.mockRestore()
}
})

test('extract decrypts Windows v10 cookies end-to-end with mocked DPAPI', async () => {
Expand Down