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

hide token from debug logs #1078

Merged
merged 2 commits into from
Jan 17, 2021
Merged

hide token from debug logs #1078

merged 2 commits into from
Jan 17, 2021

Conversation

ModischFabrications
Copy link
Contributor

Prevent leaks of the bot token by hiding it from the log, learned it the hard way during #1058.

prevent leaks of the bot token by hiding it from the log
@Badiboy
Copy link
Collaborator

Badiboy commented Jan 17, 2021

Seems too conservative: you may run several bots in one code, so you need to identify them.

I propose to remove the part of token after ":". So you will see bot ID and identify bot, bot not publish token. It's a bit more complex, but seems more convenient.

PS. Do not forget that bot id has not fixed length...

@ModischFabrications
Copy link
Contributor Author

several bots

good point, I wasn't aware of that. This will still leak bot ids, which might be unwanted for private bot users that rely on "security by obscurity", but I guess it's the lesser evil. Will be done in a moment...

@Badiboy Badiboy merged commit 9c2d279 into eternnoir:master Jan 17, 2021
@ModischFabrications ModischFabrications deleted the patch-1 branch January 17, 2021 13:39
@p1ner0
Copy link

p1ner0 commented Apr 27, 2022

.env solves the issue 👍

import environs

env = environs.Env()
env.read_env('.env')

BOT_TOKEN = env('API_KEY')

storing the API_KEY in a different file namely .env

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.

3 participants