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

API secret logging in Cortex analyzers #10

Closed
zpsaras7 opened this issue Jul 1, 2020 · 2 comments
Closed

API secret logging in Cortex analyzers #10

zpsaras7 opened this issue Jul 1, 2020 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@zpsaras7
Copy link

zpsaras7 commented Jul 1, 2020

While debugging an analyzer that uses an api key/secret pair for auth, I noticed that the logs aren't properly being scrubbed for secrets.

There's checks in cortexutils/worker.py for scrubbing the keys but not the secrets, which I don't think is by design since the key is the identifier for these creds with most typical vendor integrations.

At the very least, the secrets are fields that should be scrubbed in the logs, leaving the key available to trace back for debugging if necessary

  "errorMessage": "Unexpected Error: ('Connection aborted.', OSError(0, 'Error'))",
  "input": "{\"data\":\"mydomain.com\",\"dataType\":\"domain\",\"tlp\":2,\"message\":\"61600\",\"parameters\":{},\"config\":{\"proxy_https\":null,\"cacerts\":null,\"check_tlp\":true,\"max_tlp\":2,\"auto_extract_artifacts\":true,\"jobCache\":10,\"check_pap\":true,\"max_pap\":2,\"jobTimeout\":30,\"api_key\":\"REMOVED\",\"service\":\"get\",\"proxy_http\":null,\"organization_id\":\"12345678\",\"api_secret\":\"**PLAINTEXT_API_SECRET**\",\"query_limit\":null},\"pap\":2}",
  "success": false
}```
@zpsaras7
Copy link
Author

zpsaras7 commented Jul 1, 2020

Don't have access to push a PR but the fix would be L150-L153

if 'apisecret' in analyzer_input.get('config', {}):
    analyzer_input['config']['apisecret'] = 'REMOVED'
if 'api_secret' in analyzer_input.get('config', {}):
    analyzer_input['config']['api_secret'] = 'REMOVED'

@nadouani nadouani added this to the 2.1.0 milestone Jul 6, 2020
@nadouani nadouani added the enhancement New feature or request label Jul 6, 2020
@nadouani
Copy link
Contributor

This issue has been addressed by removing any config value of any config option including password, secret and key words

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants