-
Notifications
You must be signed in to change notification settings - Fork 33
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
api/cannon: Re-fix local IP check with better error handling #2124
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
dc7a010
to
8233592
Compare
8233592
to
e3c8b68
Compare
e3c8b68
to
1e15d91
Compare
Can't parametrize table name
This reverts commit 39e9b14.
LGTM but see discord thread on internal discussion. |
} SET data = jsonb_set(data, '{status}', case when data->'status' is null then '{}' else data->'status' end || '${JSON.stringify( | ||
status | ||
)}') WHERE id = '${id}'` | ||
sql`` |
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.
Is this change related to the local IP change? Or is it just refactor? Both are fine, I'm just trying to connect the dots.
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.
It is not related, it is a fix to use proper SQL parameters in the query instead of raw string interpolation. As I was testing this there were some errors that contained '
and the query failed, so we need to use proper sql
strings here. I can move this to a separate PR if you think it's necessary.
What does this pull request do? Explain your changes. (required)
This brings back the fix from #2118, reverted by #2123, adding proper error checking
when a given domain has no IPs configured (likely for v4 or v6 only).
This also makes the resolution errors non-fatal, so we default to trust the domains
in case we have a problem with the local IP check. This is less secure but avoids
surprises in case this breaks again. We should also add an alert when there are failures
in resolving the domain (from that log inside the
catch
).Specific updates (required)
How did you test each of these updates (required)
yarn test
Does this pull request close any open issues?
Informal on discord.
Checklist