Skip to content
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

check for frame ip safety #1036

Conversation

JFrankfurt
Copy link
Contributor

@JFrankfurt JFrankfurt commented Oct 3, 2024

https://linear.app/coinbase/issue/BAPP-653/create-blocklist-of-ips-we-should-not-resolve-dns-for-in-basenames

logic: apps/web/src/middleware/ipSafe.ts
called via a wrapper on frames.js's default route handlers: apps/web/app/frames/route.tsx

before after
500 error 403 error
image image
// before
{
    "message": {
        "cause": {
            "errno": -65,
            "code": "EHOSTUNREACH",
            "syscall": "connect",
            "address": "169.254.169.254",
            "port": 443
        }
    }
}

// after
{"message":"Forbidden: Unsafe IP"}

Copy link

linear bot commented Oct 3, 2024

Copy link

vercel bot commented Oct 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
base-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 4, 2024 6:25pm
web-base-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 4, 2024 6:25pm

@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Oct 3, 2024

✅ Heimdall Review Status

Requirement Status More Info
Reviews 2/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

Copy link
Collaborator

@dneilroth dneilroth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really nice 👏

}

if (!allSafe) {
return NextResponse.json({ message: 'Forbidden: Unsafe IP' }, { status: 403 });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: not 100% sure we want to expose this error msg to the client since it could reveal part of our mitigation strategy to a malicious actor, maybe some more generic "bad request" response is better?

@JFrankfurt JFrankfurt merged commit d5b4050 into master Oct 4, 2024
8 checks passed
@JFrankfurt JFrankfurt deleted the feature/bapp-653-create-blocklist-of-ips-we-should-not-resolve-dns-for-in branch October 4, 2024 19:46
kirkas pushed a commit that referenced this pull request Oct 21, 2024
* check for ip safety

* add jest

* add gh workflow

* middleware->frame calls with dns lookup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants