Skip to content

Commit

Permalink
fix: uniform response for malicious content (#110)
Browse files Browse the repository at this point in the history
This PR uniforms response for malicious content to become like other
IPFS Gateways
  • Loading branch information
vasco-santos authored Mar 8, 2023
1 parent b5bb88e commit 762982a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/cid-verifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ jobs:
with:
node-version: 16
cache: 'pnpm'
with:
cache: 'pnpm'
- run: pnpm install
- name: Publish app
uses: cloudflare/wrangler-action@2.0.0
Expand Down Expand Up @@ -100,9 +98,8 @@ jobs:
version: 7
- uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: 16
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
- run: pnpm install
- name: Deploy
uses: cloudflare/wrangler-action@2.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/cid-verifier/src/verification.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const verificationGet = withCidPathParam(
async function (cid, request, env) {
const threats = await getStoredThreats(cid, env)
if (threats?.length) {
return new Response(threats.join(', '), { status: 403 })
return new Response(null, { status: 403 })
}

return new Response('', { status: 204 })
Expand Down
1 change: 0 additions & 1 deletion packages/cid-verifier/test/verification.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ test('GET /:cid handles successful results', async (t) => {
test('GET /:cid handles malware cid', async (t) => {
const { mf } = t.context
const response = await mf.dispatchFetch(`http://localhost:8787/${malwareCid}`, { headers })
t.is(await response.text(), 'MALWARE')
t.is(response.status, 403)
})

Expand Down

0 comments on commit 762982a

Please sign in to comment.