-
-
Notifications
You must be signed in to change notification settings - Fork 138
fix: catch invalid url early #932
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
Conversation
const encryptedHeader = request.headers['x-connection-encrypted']?.toString() | ||
if (encryptedHeader) { | ||
try { | ||
request.headers.pg = CryptoJS.AES.decrypt(encryptedHeader, CRYPTO_KEY) | ||
.toString(CryptoJS.enc.Utf8) | ||
.trim() | ||
} catch (e: any) { | ||
request.log.warn({ | ||
message: 'failed to parse encrypted connstring', | ||
error: e.toString(), | ||
}) | ||
throw new Error('failed to process upstream connection details') | ||
} | ||
} else { | ||
request.headers.pg = PG_CONNECTION | ||
} |
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.
note
To identify why and how this happen, would it be okay to console.error the x-connection-encrypted
?
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.
I think no, safer not to log any potentially sensitive information
Pull Request Test Coverage Report for Build 14401988114Details
💛 - Coveralls |
What kind of change does this PR introduce?
Related: PGMETA-53