-
Notifications
You must be signed in to change notification settings - Fork 14
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(image): upload image endpoint #300
Conversation
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
|
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.
Use ipfs paths,
chceck just-ipfs-cid package
can't find any reference to that package, can I get a link ? |
cc @preschian as he coded 90% of the worker |
services/image/src/routes/image.ts
Outdated
app.post('/upload', vValidator('form', uploadImageRequestSchema), async (c) => { | ||
const { file } = await c.req.parseBody<UploadImage>() | ||
|
||
const path = await Hash.of(new Uint8Array(await file.arrayBuffer())) |
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.
nit: actually I'm good with crypto.randomUUID()
. this package seems old
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.
Wont it break the schema of cfi?
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.
Since this endpoint is for general images to put on Cloudflare Images, and we store the URL on the profile database, it would not conflict
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.
so isn't it easier to use user's address?
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.
This means it always overrides the image after every upload. I'm worried about the security side. Is it possible that another user changed our profile image?
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.
So let's make this PR ${address}_image
and ${adress}_banner
then let's do opsec in followup
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.
done
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.
How about this one? I prefer to put the endpoint to profile-worker
Anyway, using the address format is closely coupled with the profile. I think putting the endpoint in the profile-worker is better
And the address is not verified by this worker. I can hijack it, tho. I can show it to you guys if you want
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.
And the address is not verified by this worker. I can hijack it, tho. I can show it to you guys if you want
yep , you can change the image of other users without updating their profile
maybe I misunderstood it but didn't do this bcz of @vikiival comment
How about this one? I prefer to put the endpoint to profile-worker
+1 , will wait for https://github.com/kodadot/private-workers/pull/182 if we want to have the verifier
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.
Let's close this one and create a new endpoint for the profile worker instead. If we go with this one, the attacker can update some user profiles without verifying the signature
@preschian pls merge if its ok |
@preschian any idea why that test is failing ? shouldn't affect that endpoint. |
yes, safe to ignore. because there's some change in this PR #308. the test file is hit real endpoint instead of local |
Cc @preschian |
@hassnian pls resolve conflicts |
I close this one. Let's create the endpoint on the profile-worker instead. If we merge this, the attacker can change the other profile by hitting this endpoint directly |
Context
Add
/image/upload
endpointRef
PR Type