Skip to content

Conversation

@yann300
Copy link
Contributor

@yann300 yann300 commented Oct 3, 2025

  • use axios.
  • add more events.
  • some misc code changes

}

const startDate = new Date(2025, 0, 1)
console.log('API KEY', process.env.MATOMO_API_KEY)

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This logs sensitive data returned by
an access to MATOMO_API_KEY
as clear text.

Copilot Autofix

AI about 2 months ago

To fix this, we need to prevent logging the actual value of the sensitive environment variable. The best approach is to either remove the logging statement entirely or, if some logging is needed for debugging purposes, log only the fact that the variable is set or mask its value (e.g., show only the last 4 digits or asterisks). For maximum safety and to avoid future accidental logging, the direct use of process.env.MATOMO_API_KEY in logs should be removed or masked. Change only line 97, replacing the sensitive value with either nothing, a masked value, or a generic message.


Suggested changeset 1
extract-dashboard-data.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/extract-dashboard-data.js b/extract-dashboard-data.js
--- a/extract-dashboard-data.js
+++ b/extract-dashboard-data.js
@@ -94,7 +94,7 @@
     console.log('it', it)
 }
 
-console.log('API KEY', process.env.MATOMO_API_KEY)
+// console.log('API KEY', process.env.MATOMO_API_KEY) // REMOVED: avoid logging sensitive API key
 const startDate = new Date(2025, 8, 22)
 console.log(startDate)
 const endDate = new Date()
EOF
@@ -94,7 +94,7 @@
console.log('it', it)
}

console.log('API KEY', process.env.MATOMO_API_KEY)
// console.log('API KEY', process.env.MATOMO_API_KEY) // REMOVED: avoid logging sensitive API key
const startDate = new Date(2025, 8, 22)
console.log(startDate)
const endDate = new Date()
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants