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

EXPLAIN Security Considerations #438

Closed
ankane opened this issue Jan 5, 2023 · 0 comments
Closed

EXPLAIN Security Considerations #438

ankane opened this issue Jan 5, 2023 · 0 comments

Comments

@ankane
Copy link
Owner

ankane commented Jan 5, 2023

The EXPLAIN feature (unavoidably) exposes data to PgHero users to varying degrees.

EXPLAIN

EXPLAIN exposes statistical data through its output, since Postgres uses statistics about data in the database to generate the execution plan. A malicious user could learn these statistics in certain cases, as estimations will be different for similar queries.

You can view this data by querying the pg_stats view.

SELECT * FROM pg_stats;

EXPLAIN ANALYZE

EXPLAIN ANALYZE exposes data through timing. For instance, this query will take extra time if the given email exists.

EXPLAIN ANALYZE SELECT CASE WHEN email = '[email protected]' THEN pg_sleep(1) ELSE NULL END FROM users;

See this great write-up by Adam Derewecki.

Changes in 3.1

Starting with PgHero 3.1, teams now have control over this feature. There's a new explain option that allows the Explain page to be disabled.

explain: false

Also, EXPLAIN ANALYZE is now opt-in. You can enable it with:

explain: analyze

Please create a new issue if you have any questions, concerns, or feedback.

Repository owner locked and limited conversation to collaborators Jan 5, 2023
@ankane ankane closed this as completed Jan 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant