Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

filter out WordPress config from environment data #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/trackers/php.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public function boot() {
$options = $this->get_options();
$this->client = new RaygunClient( $options['apiKey'], true, false, false );
$this->client->SetVersion( $options['setVersion'] );
if ( ! empty( $options['filteredParams'] ) && is_array( $options['filteredParams'] ) ) {
$this->client->setFilterParams( $options['filteredParams'] );
}

// Setup Exceptions and error handlers
set_exception_handler( [ $this, 'exception_handler' ] );
Expand Down Expand Up @@ -61,10 +64,16 @@ public function add_user_data() {
public function get_options() {

$default = [
'apiKey' => BEAPI_RAYGUN_API_KEY,
'setVersion' => get_bloginfo( 'version' ),
'withTags' => [ 'PHP' ],
'enablePulse' => false,
'apiKey' => BEAPI_RAYGUN_API_KEY,
'setVersion' => get_bloginfo( 'version' ),
'withTags' => [ 'PHP' ],
'enablePulse' => false,
'filteredParams' => [
'/DB_NAME/i' => true,
'/DB_USER/i' => true,
'/DB_PASSWORD/i' => true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peut-être juste le password ? :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Par défaut je préfère nettoyer toutes les config de base de donnée. Si des utilisateurs avancés ont besoin d'avoir plus d'informations qui remontent dans les logs ils pourront modifier ça via le filtre.

'/DB_HOST/i' => true,
],
];

if ( function_exists( 'wp_get_current_user' ) ) {
Expand Down