Mitigation Strategy: Limit Query History Retention (Directly involves pghero
)
-
Description:
- Determine Business Needs: Assess the minimum time you need to retain query history for operational purposes (debugging, performance analysis).
- Configure
pghero
: Usepghero
's configuration options. This is typically done through:- Environment Variables: Set environment variables like
PGHERO_QUERY_STATS_RETENTION
(and potentially others related to different data types) to the desired retention period (e.g.,PGHERO_QUERY_STATS_RETENTION=7d
for 7 days). - Configuration File: If
pghero
uses a configuration file (e.g.,config/pghero.yml
), set the retention settings within that file (e.g.,query_stats_retention: 7d
). The exact setting names and file format will depend onpghero
's version and configuration options. Refer to the officialpghero
documentation. pghero
CLI (Less Common): In some cases,pghero
might offer command-line interface (CLI) options to configure retention, but this is less common for persistent settings.
- Environment Variables: Set environment variables like
- Verify Configuration: After making changes, restart
pghero
(or your application) and verify that the new retention settings are in effect. You might be able to do this through thepghero
web interface or by querying the underlying database tables wherepghero
stores its data (but be cautious about directly modifying these tables). - Automated Purging (If Necessary and
pghero
supports it): Some versions or configurations ofpghero
might require you to set up your own automated purging. Ifpghero
doesn't automatically delete old data, and you've configured a short retention period, you'll need a separate mechanism (like a cron job) to delete old data. However, ifpghero
does handle purging automatically based on your configuration, this step is unnecessary. Check thepghero
documentation.
-
Threats Mitigated:
- Data Exposure via Query History (Severity: High): Directly reduces the window of vulnerability by limiting the amount of historical query data stored.
-
Impact:
- Data Exposure: Risk reduction is directly proportional to the reduction in retention time. Shorter retention periods significantly reduce risk.
-
Currently Implemented:
- Example: "
PGHERO_QUERY_STATS_RETENTION
is set to3d
via an environment variable in our Kubernetes deployment."
- Example: "
-
Missing Implementation:
- Example: "We need to verify that
pghero
is actually purging data as expected. We haven't checked the underlying database tables to confirm this."
- Example: "We need to verify that
Mitigation Strategy: Disable Unnecessary Features (Directly involves pghero
)
-
Description:
- Review
pghero
Features: Consult thepghero
documentation to understand all the available features and their purposes (e.g., query stats, space analysis, index recommendations). - Identify Unused Features: Determine which features are not essential for your current needs.
- Disable via Configuration:
pghero
likely provides configuration options to disable specific features. This is usually done through:- Environment Variables: Look for environment variables that control feature toggles (e.g.,
PGHERO_DISABLE_SPACE_ANALYSIS=true
). - Configuration File: Check for settings in a
pghero
configuration file (e.g.,config/pghero.yml
) that allow you to disable features (e.g.,space_analysis: false
).
- Environment Variables: Look for environment variables that control feature toggles (e.g.,
- Verify Disabled Features: After making changes, restart
pghero
(or your application) and verify that the disabled features are no longer accessible or active in thepghero
web interface. - Document Disabled Features: Keep a record of which features have been disabled and why.
- Review
-
Threats Mitigated:
- Unauthorized Access to Database Insights (Severity: Medium): Reduces the attack surface by limiting the functionality available to an attacker, even if they gain some level of access.
- Vulnerabilities in
pghero
or its Dependencies (Severity: Variable): By disabling unused features, you reduce the likelihood of being affected by vulnerabilities within those specific features.
-
Impact:
- Unauthorized Access: Risk reduction depends on the number and sensitivity of the disabled features.
- Vulnerabilities: Risk reduction is moderate; it eliminates the risk from vulnerabilities in the disabled components.
-
Currently Implemented:
- Example: "We have disabled the 'Live Queries' feature by setting
PGHERO_DISABLE_LIVE_QUERIES=true
in our environment."
- Example: "We have disabled the 'Live Queries' feature by setting
-
Missing Implementation:
- Example: "We haven't fully reviewed all
pghero
features to determine if there are others we can safely disable. We need to consult the latestpghero
documentation."
- Example: "We haven't fully reviewed all