-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/reddit #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/reddit #86
Conversation
- Introduced a new `reddit` module, including package.json, README, and TypeScript configuration. - Implemented tools for fetching posts from subreddits and searching Reddit content. - Updated bun.lock and package.json to include new dependencies for the Reddit module. - Created server structure and types for handling API requests and responses. - Added comprehensive documentation in README for usage and development instructions.
…t and search requests
🚀 Preview Deployments Ready!Your changes have been deployed to preview environments: 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues found across 13 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="reddit/server/tools/utils/reddit.ts">
<violation number="1" location="reddit/server/tools/utils/reddit.ts:88">
P2: The `subreddit` parameter is directly interpolated into the URL path without encoding. If it contains URL-special characters (`?`, `#`, `/`), the URL will be malformed. Consider using `encodeURIComponent(subreddit)` to ensure URL safety, or validate the subreddit name format (alphanumeric and underscores only).</violation>
<violation number="2" location="reddit/server/tools/utils/reddit.ts:132">
P2: Same URL path injection issue as `getSubredditPosts`. The `subreddit` parameter should be encoded with `encodeURIComponent()` to prevent URL malformation from special characters.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| } = params; | ||
|
|
||
| // If subreddit is specified, search within it, otherwise search all Reddit | ||
| const path = subreddit ? `/r/${subreddit}/search` : "/search"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Same URL path injection issue as getSubredditPosts. The subreddit parameter should be encoded with encodeURIComponent() to prevent URL malformation from special characters.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At reddit/server/tools/utils/reddit.ts, line 132:
<comment>Same URL path injection issue as `getSubredditPosts`. The `subreddit` parameter should be encoded with `encodeURIComponent()` to prevent URL malformation from special characters.</comment>
<file context>
@@ -0,0 +1,169 @@
+ } = params;
+
+ // If subreddit is specified, search within it, otherwise search all Reddit
+ const path = subreddit ? `/r/${subreddit}/search` : "/search";
+
+ const queryParams: Record<string, string | number | undefined> = {
</file context>
| }) { | ||
| const { subreddit, sort = "hot", time, limit = 25, after } = params; | ||
|
|
||
| const path = `/r/${subreddit}/${sort}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: The subreddit parameter is directly interpolated into the URL path without encoding. If it contains URL-special characters (?, #, /), the URL will be malformed. Consider using encodeURIComponent(subreddit) to ensure URL safety, or validate the subreddit name format (alphanumeric and underscores only).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At reddit/server/tools/utils/reddit.ts, line 88:
<comment>The `subreddit` parameter is directly interpolated into the URL path without encoding. If it contains URL-special characters (`?`, `#`, `/`), the URL will be malformed. Consider using `encodeURIComponent(subreddit)` to ensure URL safety, or validate the subreddit name format (alphanumeric and underscores only).</comment>
<file context>
@@ -0,0 +1,169 @@
+}) {
+ const { subreddit, sort = "hot", time, limit = 25, after } = params;
+
+ const path = `/r/${subreddit}/${sort}`;
+ const queryParams: Record<string, string | number | undefined> = {
+ limit,
</file context>
Summary by cubic
Added a Reddit MCP server to fetch subreddit posts and search Reddit. Runs on Cloudflare Workers and uses Reddit’s public JSON API (no auth).
New Features
Dependencies
Written for commit 9bcc301. Summary will update on new commits.