humanmade/altis-cloud

Add final filtered query into X-Ray

Closed this issue · 4 comments

The query which is built from the application code is being tracked to X-Ray -

XRay\trace_wpdb_query( $query, $start, $end, $result === false ? $this->last_error : null, $host );

When this query is being executed in WPDB::query it is passed through the filter query which removes placeholders at the very least and it is also possible that queries can be modified altogether using this filter.

Since when sending the query to X-Ray does not take into account the filter we don't get the actual query that was executed.

Running filter query just before sending it to X-Ray should hopefully fix this.

This might be intentional as a means of making sure the query is redacted as it could potentially show email addresses and such. We already redact some data before sending it to XRay so we need to make the same consideration here, I'm not sure it's as simple as changing the hook.

I only noticed one of the PRs with redactions in X-Ray - humanmade/aws-xray#34

I did not find any query redactions atm, Can you point me to ones I am missing so that I can check if these are working as expected with this change?

If we run this filter, WordPress's functions to replace the placeholders gets executed and removes the placeholders.

These escapes aren't redactions, they're just placeholders for the % character so it survives any sprintf calls without being mangled. We can safely change those back.

This was completed