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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

executeTakeFirstOrThrow includes the query node in the error by default #954

Open
woltsu opened this issue Apr 17, 2024 · 1 comment
Open
Labels
api Related to library's API enhancement New feature or request

Comments

@woltsu
Copy link

woltsu commented Apr 17, 2024

Hello, and thanks for the amazing library! 馃憢

I noticed that when using the executeTakeFirstOrThrow, the resulting error will contain the query node by default if the query fails to find any results. In many cases that might not be a big issue, but for some applications that handle personally identifiable information, this can cause some problems.

Now, one can pass the errorConstructor to the function, but it can be a bit annoying and error-prone to copy-paste it in many places. Thus, I'm wondering if it would make sense to add the possibility to globally configure it somehow, so that the compiled query would not be logged by default? Or at least an option to filter out the nodes that contain the actual values.

@woltsu woltsu changed the title executeTakeFirstOrThrow includes the compiled query in the error by default executeTakeFirstOrThrow includes the query node in the error by default Apr 17, 2024
@igalklebanov igalklebanov added enhancement New feature or request api Related to library's API labels Apr 17, 2024
@igalklebanov
Copy link
Member

Hey 馃憢

Interesting. 馃

@koskimas maybe:

eb.valSensitive(value)
eb.litSensitive(value)
sql.valSensitive(value)
sql.litSensitive(value)

or

eb.val(value, { sensitive: true })
eb.lit(value, { sensitive: true })
sql.val(value, { sensitive: true })
sql.lit(value, { sensitive:  true })

or

eb.val(value).sensitive()
eb.lit(value).sensitive()
sql.val(value).sensitive()
sq.lit(value).sensitive()

wdyt?

It's the same underlying nodes, just with some extra metadata.
We could then transform the tree before throwing. Produce a redacted sql string on-demand.. etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Related to library's API enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants