-
Notifications
You must be signed in to change notification settings - Fork 0
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
Common Client - DO NOT MERGE #1
base: main
Are you sure you want to change the base?
Conversation
# Conflicts: # agent/package.json # pnpm-lock.yaml
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.
Hi @timolegros! Welcome to the ai16z community. Thanks for submitting your first pull request; your efforts are helping us accelerate towards AGI. We'll review it shortly. You are now a ai16z contributor!
// Fetch full content from R2 if not all content fit in `object_summary` | ||
let content = req.body.object_summary; | ||
if (req.body.content_url) { | ||
const contentResponse = await fetch(req.body.content_url); |
Check failure
Code scanning / CodeQL
Server-side request forgery Critical
URL
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 14 days ago
To fix the problem, we need to validate and sanitize the user-provided URL before using it in the fetch
request. The best way to do this is to use an allow-list of trusted domains and ensure that the URL belongs to one of these domains. Additionally, we should validate the URL structure to prevent path traversal and other malicious manipulations.
- Create an allow-list of trusted domains.
- Parse the user-provided URL and check if its hostname is in the allow-list.
- If the URL is valid, proceed with the
fetch
request; otherwise, return an error response.
-
Copy modified lines R200-R213
@@ -199,3 +199,16 @@ | ||
if (req.body.content_url) { | ||
const contentResponse = await fetch(req.body.content_url); | ||
const allowedDomains = ["trusted.com", "another-trusted.com"]; | ||
const url = new URL(req.body.content_url); | ||
|
||
if (!allowedDomains.includes(url.hostname)) { | ||
elizaLogger.error( | ||
"❌ [ERROR] Invalid content URL:", | ||
req.body.content_url | ||
); | ||
return res.status(400).send({ | ||
error: "Invalid content URL", | ||
}); | ||
} | ||
|
||
const contentResponse = await fetch(url.toString()); | ||
|
Introduce sentient AI to DePIN plugin
Orchestrator architecture V1
This PR exists only to demonstrate the changelist in anticipation of a PR against the elizaOS repo.
TODO
COMMON_USER_ID
env var when new Common Api Client is published with GetUser route