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

FEATURE: notify admins about old credentials #9854

Merged
merged 3 commits into from May 26, 2020

Conversation

lis2
Copy link
Contributor

@lis2 lis2 commented May 22, 2020

Security and API keys should be renewed periodically.
This additional notification should help admins keep their Discourse safe and secure.

Security and API keys should be renewed periodically.
This additional notification should help admins keep their Discourse safe and secure.
@lis2 lis2 force-pushed the reminder-about-old-keys branch 2 times, most recently from 4d3c853 to c148b3b Compare May 22, 2020 03:10
app/jobs/scheduled/old_keys_reminder.rb Outdated Show resolved Hide resolved
app/jobs/scheduled/old_keys_reminder.rb Outdated Show resolved Hide resolved
app/jobs/scheduled/old_keys_reminder.rb Outdated Show resolved Hide resolved
spec/jobs/old_keys_reminder_spec.rb Outdated Show resolved Hide resolved
@lis2 lis2 force-pushed the reminder-about-old-keys branch from 15037b4 to ef4ab18 Compare May 24, 2020 22:24
@lis2 lis2 force-pushed the reminder-about-old-keys branch from ef4ab18 to c2b6585 Compare May 24, 2020 22:27
@lis2
Copy link
Contributor Author

lis2 commented May 24, 2020

@eviltrout thank you for the feedback. I fixed it. I think that old keys setting is very specific to this problem, so I didn't want to move that to SiteSettings model. Instead, I extended the test for "execute" method so there is no more need to test private methods.

@lis2 lis2 requested a review from eviltrout May 24, 2020 22:30
Comment on lines 57 to 59
setting_key_messages = old_site_settings_keys.map { |key| "#{key.name} - #{key.updated_at}" }
api_key_messages = old_api_keys.map { |key| "#{[key.description, key.user&.username, key.created_at].compact.join(" - ")}" }
[setting_key_messages | api_key_messages].join("\n")
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor but instead of two intermediate arrays, because we can just push into an existing array?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you! nice catch, fixed and I will merge that stuff tomorrow in the morning :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Btw I left a small comment in dev about the design of this feature in https://dev.discourse.org/t/automatic-reminder-to-reset-old-machine-generated-secrets/16311/9

@lis2 lis2 merged commit 349a67b into discourse:master May 26, 2020
@lis2 lis2 deleted the reminder-about-old-keys branch May 26, 2020 22:13
lis2 added a commit that referenced this pull request May 26, 2020
lis2 added a commit that referenced this pull request May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants