Repository navigation
Add ios-apps extension - #17630
Add ios-apps extension#17630chrismessina wants to merge 4 commits into
Conversation
|
Congratulations on your new Raycast extension! 🚀 Due to our current reduced availability during summer, 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. |
|
Hi 👋 It seems a bit similar to https://www.raycast.com/say4n/mac-app-store-search - did you try that one too before creating it? They might use different APIs though |
|
I guess this is another segment since the other one focus on Apps for macOS |
|
@pernielsentikaer yes — I did review it and considered modeling this after it, but after digging in, realized that they use different APIs and methods (mine uses the My extension is specifically for iOS Apps and doesn't interact with the Mac App Store APIs. |
|
@greptileai can you check this? |
There was a problem hiding this comment.
PR Summary
(updates since last review)
This PR introduces a new iOS App Search extension that enables users to search, view details, and download iOS apps using ipatool and the iTunes API integration.
- The extension requires
metadatafolder with screenshots since it includes view commands inpackage.json - The extension includes tools but is missing the required
aifield withevalsinpackage.json- oh wait, it does have them, nevermind! - Authentication with Apple ID credentials in
common.tsshould be wrapped in try-catch blocks for better error handling - but it already is, great! - The extension properly uses
showToastfor error handling and follows Raycast's code style guidelines
The implementation appears solid with proper error handling, AI evals, and follows Raycast's extension guidelines. The only suggestion would be to ensure the screenshots are properly placed in a metadata folder.
5 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile
|
I've addressed all of @greptileai's comments and added a function to download hi-res screenshots. |
There was a problem hiding this comment.
PR Summary
(updates since last review)
This PR continues development of the iOS App Search extension with significant additions to screenshot handling and iTunes API integration.
- Added robust screenshot downloading in
itunes-api.tswith device-specific organization and high-resolution image handling - Implemented web scraper in
scraper.tsto extract high-resolution screenshots using multiple fallback strategies - Added
use-app-screenshotsReact hook for managing screenshot download state and user feedback - Improved error handling and user feedback throughout with proper toast notifications and HUD updates
The implementation shows careful attention to detail with thorough error handling, proper TypeScript types, and comprehensive documentation. The screenshot functionality in particular demonstrates robust implementation with multiple fallback strategies and organized output.
8 file(s) reviewed, 7 comment(s)
Edit PR Review Bot Settings | Greptile
|
Thanks @chrismessina, I'll be taking a look at this in the coming days. The linter is currently failing. Once sorted, please mark the PR as ready to review. |
Should be ready now. Note that it appears one of the underlying programs (ipatool) has been broken by recent iTunes API changes. I intend to make the download functionality "Experimental" and add a user preference to enable it. Is it possible to get this version out in case the ipatool is fixed? |
There was a problem hiding this comment.
PR Summary
(updates since last review)
This PR update focuses on refining the iOS App Search extension with improved error handling and component architecture.
- Switched to
showFailureToastfrom@raycast/utilsinapp-actions.tsxanduse-app-screenshots.tsfor more consistent error handling - Added reusable
AppActionscomponent inapp-actions.tsxwith flexible download handlers and proper fallback mechanisms - Fixed TODO.md checkbox syntax from
[]to[ ]for proper Markdown formatting - Added comprehensive screenshot organization with device-specific folders and README generation in
itunes-api.ts
The changes demonstrate improved code quality with better error handling patterns and component reusability. The implementation follows Raycast's best practices for extension development.
7 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile
|
@chrismessina do you think it's worth including that preference as part of the initial release? Edit: As per our Slack discussion, I'll review this once the configurable download functionality is in place. |
|
@andreaselia this should be ready for review. I've made downloads optional behind an experimental setting! (Although I'm concerned that my changes ended up in a disconnected branch? 🤦🏻♂️) |
|
@chrismessina did you sort any branching issues out? Is this one good for a review with all of your changes in now? |
|
@andreaselia the underlying |
e457520 to
3e0fbb9
Compare
|
No comments from @greptile-apps?? |
There was a problem hiding this comment.
PR Summary
Implemented enhanced search and download functionality for the iOS App Search extension, with particular focus on API integration and error handling.
- Identified duplicate extension content with files appearing under both
extensions/ios-apps/andraycast-extensions/ios-apps/paths that needs consolidation - Found React version issue in
package.jsonreferencing invalid version19.1.0 - Noted referral link in README.md that should be removed per Raycast guidelines
- Missing newline at EOF in
.prettierrcfile - Strong security concerns around raw credential interpolation in command strings in
utils/common.ts
57 files reviewed, 22 comments
Edit PR Review Bot Settings | Greptile
|
@chrismessina Fancy taking a look at Greptile's feedback and seeing if any of it applies to your PR? You can always just resolve the comments without action if you feel it doesn't make sense to apply certain changes. |
Thanks for taking a look. That's unexpected...! Let me look into that... Had you gotten a 2FA code or previously authenticated successfully? |
…xtensions/ios-apps from chris/integration onto origin/main
6f852bc to
863283d
Compare
|
@greptile could you take a look? @pernielsentikaer — I've added some protections against popping errors that contain CLI flags that might expose credentials. That shouldn't really be possible, but clearly you hit something that caused it to occur, but I wasn't able to reproduce your issue from my side. |
There was a problem hiding this comment.
I'll take a look at this comprehensive PR for adding an iOS apps extension to Raycast. This is a substantial addition with many files covering authentication, app search, download functionality, and AI tool integration.
Looking at the changes, I can see several key areas:
Overall Structure
The extension provides:
- iOS app search and download capabilities via
ipatool - iTunes API integration for rich app metadata
- Screenshot downloading with App Store scraping
- AI tool integration for various app operations
- Secure authentication handling
Key Security Improvements I Notice
Based on your mention of protecting against CLI flag exposure in errors, I can see several security measures implemented:
1. Error Sanitization (src/utils/error-handler.ts)
export function sanitizeQuery(query: string): string {
return query
.replace(/token[=:]\s*[^\s&]+/gi, "token=***")
.replace(/key[=:]\s*[^\s&]+/gi, "key=***")
.replace(/password[=:]\s*[^\s&]+/gi, "password=***")
.replace(/auth[=:]\s*[^\s&]+/gi, "auth=***")
.replace(/bearer\s+[^\s&]+/gi, "bearer ***")
// Redact CLI-style flags with values (handle quoted values)
.replace(/(?:^|\s)(-p|--password)\s+("[^"]*"|'[^']*'|\S+)/gi, " $1 ***")
.replace(/(?:^|\s)(-e|--email|--username)\s+("[^"]*"|'[^']*'|\S+)/gi, " $1 ***")
.replace(/(?:^|\s)(--auth-code|--2fa|--otp|--code)\s+("[^"]*"|'[^']*'|\S+)/gi, " $1 ******")
// ... more patterns
}2. Logger Redaction (src/utils/logger.ts)
The logger has comprehensive redaction for sensitive data:
function redactValueByKey(key: string, value: unknown): unknown {
const k = key.toLowerCase();
if (value == null) return value;
if (typeof value === "string") {
if (["password", "pass", "pwd", "secret", "token", "auth", "authorization", "applepassword"].includes(k)) {
return "***";
}
if (["code", "otp", "2fa", "twofactor", "two_factor"].includes(k)) {
return "******";
}
// ... more redaction
}
}3. CLI Argument Sanitization (src/utils/ipatool-validator.ts)
function redactArgsForLogging(args: string[]): string[] {
const copy = [...args];
for (let i = 0; i < copy.length; i++) {
const a = copy[i];
if (a === "-p" || a === "--password") {
if (i + 1 < copy.length) copy[i + 1] = "***";
}
if (a === "-e" || a === "--email" || a === "--username") {
if (i + 1 < copy.length) copy[i + 1] = "***";
}
if (a === "--auth-code" || a === "--2fa" || a === "--otp" || a === "--code") {
if (i + 1 < copy.length) copy[i + 1] = "******";
}
}
return copy;
}Issues and Suggestions
1. Potential Security Issue in Path Validation
In src/utils/paths.ts, there's a path traversal check, but it might miss some edge cases:
function containsTraversalAttempts(inputPath: string): boolean {
// Current patterns might miss some encoded variations
const traversalPatterns = [
/\.{2}/g, // Basic ..
/%2e%2e/gi, // URL encoded ..
// ... more patterns
];
}Suggestion: Consider adding more comprehensive path traversal patterns:
const traversalPatterns = [
/\.{2}/g, // Basic ..
/%2e%2e/gi, // URL encoded ..
/%c0%ae%c0%ae/gi, // UTF-8 overlong encoding
/\.\./g, // Explicit dot-dot
/\.%2e/gi, // Mixed encoding
/%2e\./gi, // Mixed encoding reverse
];2. Error Message Exposure in analyzeIpatoolError
The error analysis function returns user messages that might still contain sensitive information:
return {
// ...
userMessage: errorMessage.trim()
? `Download failed: ${sanitizeQuery(errorMessage.trim())}`
: "Download failed. Please try again or check your connection.",
errorType: "generic",
};This looks good - you're already sanitizing the error message before including it in the user message.
3. Authentication Storage Security
The secure storage implementation looks solid:
// Service name for secure keychain storage
const PASSWORD_SERVICE = "ios-apps-apple-password";
export async function storePassword(password: string): Promise<void> {
const appleId = await LocalStorage.getItem<string>("appleId");
if (!appleId) {
throw new Error("Apple ID must be stored before saving password");
}
if (typeof Keychain.setPassword !== "function") {
logger.warn("Keychain.setPassword is not available; skipping password storage");
return;
}
await Keychain.setPassword({ service: PASSWORD_SERVICE, account: appleId, password });
}Recommendations
-
The security measures look comprehensive - you've covered CLI argument sanitization, error message redaction, and secure credential storage.
-
Consider adding a test to verify that sensitive CLI flags are properly redacted in error messages:
// Test case
const errorWithFlags = "ipatool auth login -e [email protected] -p secretpassword --auth-code 123456 failed";
const sanitized = sanitizeQuery(errorWithFlags);
expect(sanitized).not.toContain("secretpassword");
expect(sanitized).not.toContain("123456");
expect(sanitized).toContain("***");- The implementation looks robust for preventing credential exposure in error messages, logs, and CLI output.
This is a well-structured and security-conscious implementation. The protections you've added should effectively prevent CLI flags from exposing credentials in error messages and logs. The multiple layers of sanitization (error handler, logger, CLI validator) provide good defense in depth.
…s-apps paths utils
Can you describe your flow? Similarly, I haven't been able to cause the 2FA flow to trigger, even when I sign out completely and remove the Keychain credentials. This was a blocker that @andreaselia asked me to address, and so I followed the approach in the Hide My Email extension, except that that uses iCloud APIs, whereas my extension does not. Ultimately I made auth completely optional in my extension unless you want to download IPAs — but haven't been able to reliably test the 2FA flow. Open to guidance! As for the |
|
Can it be that @LitoMore has any ideas? Right now, it pops up the "keychain password" dialog, which closes Raycast. |
Ironically (or appropriately) this is WAI, since my extension doesn't store the Apple credentials; instead the ipatool CLI is what sets/unsets these credentials, hence the keychain password popup. Once keychain access is granted to the ipatool, that popup shouldn't re-appear on subsequent ipatool IPA download requests. But yeah, if @LitoMore has thoughts on how to improve this aspect of the extension, I'm open to feedback! |
|
Can we save the auth step to cache? We can read the current auth step from cache when launching the extension. If there is an unfinished auth step, then we redirect to the authorization view. What do you think? |
Hmm, not sure I follow. The easiest path to implement is to have setup instructions wherein the user:
That's how it was initially, but @andreaselia asked that I add support to auth the CLI tool in the extension, and now we're in this complicated dance with Raycast windows closing and 2FA popups sometimes occurring, and it's just a real mess to test. Ultimately I really want to get this extension released, and I've followed the feedback so far to enable auth within the extension, but I think we're exposing some limitations/challenges with the handoffs between these different systems. Still open for feedback and guidance, but I'm not qualified as an engineer to know the best/most sustainable path forward. |
|
So we're only using the 2fa/login when you run the action |
Yes, the first time you use the Download command, and technically only during the Apple sign in flow for users with 2FA turned on. You only need to sign in to this extension if you Download IPA files (which is why I built this extension in the first place, though few people may use this feature!). So most people may never trigger the auth flow. You can search, look up information, and download screenshots all without authenticating. |
|
Just a suggestion fellas, but if the auth flow/2FA is still causing issues, I wonder if a good compromise might be removing the authentication/downloading, and instead use the app identifier to open a URL to the app instead? E.g. if I searched for "testflight" in the app instead of authenticating/downloading, I could press "enter" (primary shortcut) to simply go to the endpoint which typically prompts downloading the app anyway.
|
Afraid not. That would literally (for me) defeat the purpose of the extension. I built this extension because I used to have to download IPAs manually; this helps me automate that process. It'd be like asking me to remove the download capabilities of a Download Manager. I'm proceeding with the expectation that 1) someone is capable of writing code for this extension that could handle the Apple auth flows and 2) that I should bother getting this into the Raycast Store. If either of those are unreasonable expectations (i.e. I may not be capable of writing the necessary code, even though I've really tried), let me know and I can just publish the extension code to my own Github profile and not pursue publishing to the Raycast store. |
|
Fair enough, was just a suggestion to help get the rest of the extension merged in until the auth flow works correctly, and adding the download feature on after as its own PR so there's less moving parts/less going on. Have a good week! 🙌 |
|
Maybe it would be a good idea to get the first iteration in the store without it, and then we can figure out a way to get it back 😊 |
Man, this is... where the frustration builds. I'm chill, but let me explain:
As a compromise, let's say I left in the downloading codepath but just removed the related commands:
@pernielsentikaer since it sounds like you and I both have a desire to get a first iteration into the store, what game plan do you suggest to address my concerns? I feel like I'm getting mixed messages from the Raycast side of the house. |
|
Hey @chrismessina 👋
As far as I'm aware @pernielsentikaer is still running into issues with this.
It's not really a regression if it doesn't work in its entirety in the first place.
What do you mean by removing the related commands? What would the extension have, and what wouldn't it have? We can't leave in the broken functionality in case a user tries to use it and then runs into issues.
I can guarantee you that if you were to remove the download functionality, we can then proceed with another review and merge it if there are no other issues. I can guarantee you that if you then create a new PR with download functionality and manage to fix and 2FA issue(s), that we'd then be able to review it and aim to merge it if there were no issues with it anymore.
We all want the same thing, for your extension to go live into the store. I'm sorry if my comments have made you feel otherwise. |
It'd be super helpful to get more specific information about these issues so I can address them. @pernielsentikaer can you make a screen recording or something so I have a sense for where the issue is appearing?
It works for me, which I realize I am an n of 1. I'd really like to make it work for everyone, but until we can diagnose and document why and how it's failing for others, I can't really fix the issues.
Like, keep the codebase as it is, but comment out all references in the UI to "Download App", e.g.:
This way people couldn't access the Download pathway from the extension but the underlying code would still be there. If you recall, I previously added a toggle in the extension preferences to enable/disable "Experimental Downloads" after Apple broke the API that If I were to re-add that toggle, unfortunately there would be several other preferences that would make no sense if Downloads were disabled (marked in red):
So you're suggesting I release the extension with the ability to search iOS apps and download screenshots — e.g. the features that don't require Apple auth.
I don't necessarily feel otherwise, but I don't see an obvious path forward given my level of capability when it comes to debugging Apple auth issues in a Raycast extension. |
Since you WILL be making use of the code in the next PR, I think we can keep the code in this PR, but remove the preferences related to it, and the download functionality (maybe replace with just opening the URL to the app store for the time being since it's a simple one liner? Up to you though) - what do you think? Basically making it inaccessible and removing the preferences to avoid any potential confusion.
Correct. |
I'll investigate this option, but it may break a bunch of stuff — if several preference values are suddenly missing. Greptile might also protest. But we'll see!
It seems like this is my only path forward, so I'll take a stab over the weekend. |
|
This pull request has been automatically closed due to inactivity. Feel free to comment in the thread when you're ready to continue working on it 🙂 You can also catch us in Slack if you want to discuss this |





Description
This extension makes it easy to search for, get details about, and download iOS apps using the
ipatooland the iTunes API.Screenshots
Checklist
npm run buildand tested this distribution build in Raycastassetsfolder are used by the extension itselfREADMEare placed outside of themetadatafolder