neetob 0.5.68 → 0.5.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.env +2 -1
  3. data/.neetoci/default.yml +1 -1
  4. data/.ruby-version +1 -1
  5. data/Gemfile.lock +44 -21
  6. data/README.md +11 -0
  7. data/bookmarks.md +113 -113
  8. data/data/github-labels.json +80 -45
  9. data/data/repo-team-leads.json +82 -0
  10. data/exe/neetob +1 -1
  11. data/lib/neetob/cli/base.rb +67 -5
  12. data/lib/neetob/cli/cloudflare/automatic_https_rewrites.rb +34 -0
  13. data/lib/neetob/cli/cloudflare/base.rb +2 -2
  14. data/lib/neetob/cli/cloudflare/commands.rb +7 -0
  15. data/lib/neetob/cli/github/active_record_doctor.rb +1 -1
  16. data/lib/neetob/cli/github/brakeman.rb +1 -1
  17. data/lib/neetob/cli/github/bundle_audit.rb +1 -1
  18. data/lib/neetob/cli/github/issues/helpers.rb +40 -0
  19. data/lib/neetob/cli/github/make_pr/base.rb +1 -1
  20. data/lib/neetob/cli/github/repositories/pull_requests.rb +19 -0
  21. data/lib/neetob/cli/github/repositories/team_leads.rb +34 -0
  22. data/lib/neetob/cli/github/unused_assets_audit.rb +5 -1
  23. data/lib/neetob/cli/monthly_audit/commands.rb +2 -1
  24. data/lib/neetob/cli/monthly_audit/databases/users_unique_email_index.rb +6 -1
  25. data/lib/neetob/cli/monthly_audit/databases/uuid_primary_key.rb +8 -0
  26. data/lib/neetob/cli/monthly_audit/github_issue_creation.rb +75 -0
  27. data/lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/always_use_https_is_enabled.rb +11 -0
  28. data/lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/automatic_https_rewrites_is_enabled.rb +43 -0
  29. data/lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/dns_entry_has_proxy_status.rb +9 -0
  30. data/lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/main.rb +2 -2
  31. data/lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/minimum_tls_version_is_one_point_two.rb +11 -0
  32. data/lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/spf_records_are_valid.rb +9 -0
  33. data/lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/ssl_tls_encryption_mode_set_to_full.rb +9 -0
  34. data/lib/neetob/cli/monthly_audit/instances_and_addons/cronitor/setup_correctly_for_apps.rb +10 -0
  35. data/lib/neetob/cli/monthly_audit/instances_and_addons/cronitor/setup_correctly_for_help_center.rb +12 -0
  36. data/lib/neetob/cli/monthly_audit/instances_and_addons/cronitor/setup_correctly_for_landing_pages.rb +15 -2
  37. data/lib/neetob/cli/monthly_audit/instances_and_addons/honeybadger/setup_correctly_for_apps.rb +28 -29
  38. data/lib/neetob/cli/monthly_audit/instances_and_addons/main.rb +5 -5
  39. data/lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy_or_heroku/cloudfront_cdn_enabled.rb +11 -17
  40. data/lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy_or_heroku/essential_environment_variables_set.rb +7 -10
  41. data/lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy_or_heroku/main.rb +0 -3
  42. data/lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy_or_heroku/scheduled_exports_enabled.rb +8 -4
  43. data/lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy_or_heroku/ssl_certificates_over_thirty_days_from_expiry.rb +69 -24
  44. data/lib/neetob/cli/monthly_audit/misc/main.rb +1 -1
  45. data/lib/neetob/cli/monthly_audit/misc/redirections_working_correctly.rb +14 -1
  46. data/lib/neetob/cli/monthly_audit/misc/sparkpost_sub_account_used_for_all_apps.rb +24 -18
  47. data/lib/neetob/cli/monthly_audit/perform.rb +7 -2
  48. data/lib/neetob/cli/monthly_audit/security/code/active_record_doctor.rb +10 -5
  49. data/lib/neetob/cli/monthly_audit/security/code/brakeman.rb +10 -2
  50. data/lib/neetob/cli/monthly_audit/security/code/bundle_audit.rb +19 -6
  51. data/lib/neetob/cli/monthly_audit/security/code/checks_for_unused_assets.rb +5 -0
  52. data/lib/neetob/cli/monthly_audit/security/code/fasterer.rb +10 -2
  53. data/lib/neetob/cli/monthly_audit/security/code/yarn_audit.rb +6 -1
  54. data/lib/neetob/cli/monthly_audit/security/github/dependabot_prs_merged.rb +20 -0
  55. data/lib/neetob/cli/monthly_audit/security/github/dependabot_turned_on.rb +25 -21
  56. data/lib/neetob/cli/neeto_deploy/autoscaling_config.rb +1 -1
  57. data/lib/neetob/cli/neeto_deploy/certificates.rb +1 -1
  58. data/lib/neetob/cli/neeto_deploy/commands.rb +7 -0
  59. data/lib/neetob/cli/neeto_deploy/config_vars/list.rb +1 -1
  60. data/lib/neetob/cli/neeto_deploy/config_vars/remove.rb +1 -1
  61. data/lib/neetob/cli/neeto_deploy/config_vars/upsert.rb +1 -1
  62. data/lib/neetob/cli/neeto_deploy/scheduled_exports.rb +1 -1
  63. data/lib/neetob/cli/neeto_deploy/unique_email_domains.rb +165 -0
  64. data/lib/neetob/cli/sre/base.rb +13 -13
  65. data/lib/neetob/cli/sre/check_essential_env.rb +7 -2
  66. data/lib/neetob/cli/sre/checklist.rb +2 -2
  67. data/lib/neetob/version.rb +1 -1
  68. data/neetob.gemspec +1 -1
  69. data/package.json +30 -0
  70. data/playwright.config.ts +39 -0
  71. data/scripts/config/.env.local +17 -0
  72. data/scripts/constants/auditData.ts +402 -0
  73. data/scripts/constants/routes.ts +30 -0
  74. data/scripts/constants/selectors.ts +4 -0
  75. data/scripts/constants/table.ts +30 -0
  76. data/scripts/constants/texts.ts +46 -0
  77. data/scripts/constants/userAgents.ts +14 -0
  78. data/scripts/utils/markdown.ts +23 -0
  79. data/scripts/workflows/dependabot.ts +104 -0
  80. data/scripts/workflows/honeybadger.ts +169 -0
  81. data/scripts/workflows/sparkpost.ts +204 -0
  82. data/tsconfig.json +35 -0
  83. data/yarn.lock +2216 -0
  84. metadata +26 -6
  85. data/lib/neetob/cli/monthly_audit/instances_and_addons/cloudflare/bot_protection_enabled.rb +0 -32
  86. data/lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy_or_heroku/auto_scaling_enabled.rb +0 -60
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../github/base"
4
+ require_relative "../github/issues/helpers"
5
+ require_relative "../github/repositories/team_leads"
6
+
7
+ class GithubIssueCreation < Neetob::CLI::Github::Base
8
+ def initialize
9
+ super()
10
+ @helpers = Neetob::CLI::Github::Issues::Helpers.new
11
+ end
12
+
13
+ def create_issue(repo:, title:, description:, labels: "")
14
+ return if Thread.current[:skip_issue]
15
+ return if repo.include?("bigbinary-website")
16
+
17
+ full_title = build_full_title(title)
18
+ repo_path = "neetozone/#{repo}"
19
+
20
+ # Check for existing issue with exact title match
21
+ existing_issue = find_existing_issue_by_title(repo_path, full_title)
22
+ return existing_issue.html_url if existing_issue
23
+
24
+ # Close any existing issues of the same type
25
+ close_existing_issues_of_same_type(repo_path, title)
26
+
27
+ create_new_issue(repo_path, full_title, description, labels)
28
+ end
29
+
30
+ private
31
+
32
+ def build_full_title(title)
33
+ month = Thread.current[:month].capitalize.gsub("-", " ")
34
+ "#{month} Audit - #{title}"
35
+ end
36
+
37
+ def find_existing_issue_by_title(repo_path, full_title)
38
+ title_regex = Regexp.new("^#{Regexp.escape(full_title)}$", Regexp::IGNORECASE)
39
+ @helpers.get_issue_with_title(repo_path, title_regex)
40
+ end
41
+
42
+ def close_existing_issues_of_same_type(repo_path, title)
43
+ type_regex = Regexp.new(Regexp.escape(title), Regexp::IGNORECASE)
44
+ existing_issue = @helpers.get_issue_with_title(repo_path, type_regex)
45
+
46
+ if existing_issue
47
+ @helpers.close_issue(repo_path, existing_issue.number)
48
+ end
49
+ end
50
+
51
+ def create_new_issue(repo_path, full_title, description, labels)
52
+ issue_body = build_issue_body(full_title, description)
53
+ repo_name = repo_path.split("/").last
54
+ assignee = Neetob::CLI::Github::Repositories::TeamLeads.team_lead_for(repo_name)
55
+
56
+ issue_options = { labels: }
57
+ issue_options[:assignee] = assignee if assignee && assignee != "NO TL FOUND"
58
+
59
+ begin
60
+ issue = client.create_issue(
61
+ repo_path,
62
+ full_title,
63
+ issue_body,
64
+ issue_options
65
+ )
66
+ issue.html_url
67
+ rescue StandardError => e
68
+ ExceptionHandler.new(e).process
69
+ end
70
+ end
71
+
72
+ def build_issue_body(full_title, description)
73
+ "## #{full_title}\n\n#{description}"
74
+ end
75
+ end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "../../github_issue_creation"
4
+
3
5
  module Neetob
4
6
  class CLI
5
7
  module MonthlyAudit
@@ -20,6 +22,15 @@ module Neetob
20
22
  ui.info("Checking Always use HTTPS value for #{domain}", print_to_audit_log: false)
21
23
  always_use_https_value = Neetob::CLI::Cloudflare::AlwaysUseHttps.new(domain).run
22
24
  audit_passed = always_use_https_value.to_s == "on" ? "Yes" : "No"
25
+
26
+ if audit_passed == "No"
27
+ repo = domain_to_repo(domain.to_s)
28
+ issue_url = GithubIssueCreation.new.create_issue(
29
+ repo:, title: "Enable HTTPS for domain",
30
+ description: "HTTPs is not enabled for #{domain}.")
31
+ audit_passed += " #{issue_url}"
32
+ end
33
+
23
34
  domains_data << [domain, always_use_https_value, audit_passed]
24
35
  end
25
36
  ui.print_table(domains_data)
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../github_issue_creation"
4
+
5
+ module Neetob
6
+ class CLI
7
+ module MonthlyAudit
8
+ module InstancesAndAddons
9
+ module Cloudflare
10
+ class AutomaticHttpsRewritesIsEnabled < CLI::Base
11
+ def initialize
12
+ super()
13
+ end
14
+
15
+ def run
16
+ ui.success "### 3.2.7. Checking whether Automatic HTTPS rewrites is enabled"
17
+
18
+ domains_data = [["Domain", "Automatic HTTPS rewrites", "Audit Passed"]]
19
+ ui.info("\n", print_to_audit_log: false)
20
+ Neetob::CLI::Cloudflare::Base::ZONE_IDS.keys.select { |domain|
21
+ domain.to_s.include?(".com") }.map do |domain|
22
+ ui.info("Checking automatic HTTPS rewrites value for #{domain}", print_to_audit_log: false)
23
+ automatic_https_rewrites_value = Neetob::CLI::Cloudflare::AutomaticHttpsRewrites.new(domain).run
24
+ audit_passed = automatic_https_rewrites_value.to_s == "on" ? "Yes" : "No"
25
+
26
+ if audit_passed == "No"
27
+ repo = domain_to_repo(domain.to_s)
28
+ issue_url = GithubIssueCreation.new.create_issue(
29
+ repo:, title: "Enable automatic HTTPS rewrites for domain",
30
+ description: "Automatic HTTPS rewrites is not enabled for #{domain}.")
31
+ audit_passed += " #{issue_url}"
32
+ end
33
+
34
+ domains_data << [domain, automatic_https_rewrites_value, audit_passed]
35
+ end
36
+ ui.print_table(domains_data)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "../../github_issue_creation"
4
+
3
5
  module Neetob
4
6
  class CLI
5
7
  module MonthlyAudit
@@ -39,6 +41,13 @@ module Neetob
39
41
  dns_proxy_status = "* record has proxying turned #{proxy_status}"
40
42
  same_as_last_dns_proxy_status = dns_proxy_status == last_dns_proxy_status
41
43
  last_dns_proxy_status = dns_proxy_status
44
+ if audit_passed == "No"
45
+ repo = domain_to_repo(domain.to_s)
46
+ issue_url = GithubIssueCreation.new.create_issue(
47
+ repo:, title: "Enable proxying for wildcard DNS on #{domain}",
48
+ description: dns_proxy_status)
49
+ audit_passed += " #{issue_url}"
50
+ end
42
51
  if same_as_last_dns_proxy_status
43
52
  dns_proxy_status = "''"
44
53
  end
@@ -5,7 +5,7 @@ require_relative "dns_entry_has_proxy_status"
5
5
  require_relative "minimum_tls_version_is_one_point_two"
6
6
  require_relative "always_use_https_is_enabled"
7
7
  require_relative "spf_records_are_valid"
8
- require_relative "bot_protection_enabled"
8
+ require_relative "automatic_https_rewrites_is_enabled"
9
9
 
10
10
  module Neetob
11
11
  class CLI
@@ -28,7 +28,7 @@ module Neetob
28
28
  ui.info "\n"
29
29
  SpfRecordsAreValid.new.run
30
30
  ui.info "\n"
31
- BotProtectionEnabled.new.run
31
+ AutomaticHttpsRewritesIsEnabled.new.run
32
32
  end
33
33
  end
34
34
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "../../../cloudflare/min_tls_version"
4
+ require_relative "../../github_issue_creation"
4
5
 
5
6
  module Neetob
6
7
  class CLI
@@ -22,6 +23,16 @@ module Neetob
22
23
  ui.info("Checking Minimum TLS version for #{domain}", print_to_audit_log: false)
23
24
  min_tls_version = Neetob::CLI::Cloudflare::MinTlsVersion.new(domain).run
24
25
  audit_passed = min_tls_version.to_s == "1.2" ? "Yes" : "No"
26
+
27
+ if audit_passed == "No"
28
+ repo = domain_to_repo(domain.to_s)
29
+ issue_url = GithubIssueCreation.new.create_issue(
30
+ repo:, title: "Set minimum TLS version to 1.2 for #{domain}",
31
+ description: "Minimum TLS version for #{domain} is set to #{min_tls_version}. It should be set to '1.2'."
32
+ )
33
+ audit_passed += " #{issue_url}"
34
+ end
35
+
25
36
  domains_data << [domain, min_tls_version, audit_passed]
26
37
  end
27
38
  ui.print_table(domains_data)
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "../../github_issue_creation"
3
4
  module Neetob
4
5
  class CLI
5
6
  module MonthlyAudit
@@ -29,6 +30,14 @@ module Neetob
29
30
  data = spf_records_verification_data[:spf_txt_records].map { |record|
30
31
  "#{record[:name]} => #{record[:content]}"
31
32
  }.join(", ")
33
+
34
+ if audit_passed == "No"
35
+ repo = domain_to_repo(domain.to_s)
36
+ issue_url = GithubIssueCreation.new.create_issue(
37
+ repo:, title: "Fix invalid SPF records for #{domain}",
38
+ description: "#{comments} \n\n SPF records data: #{data}")
39
+ audit_passed += " #{issue_url}"
40
+ end
32
41
  domains_data << [domain, data, comments, audit_passed]
33
42
  end
34
43
  ui.print_table(domains_data)
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "../../../cloudflare/ssl_mode"
4
+ require_relative "../../github_issue_creation"
4
5
 
5
6
  module Neetob
6
7
  class CLI
@@ -22,6 +23,14 @@ module Neetob
22
23
  ui.info("Checking SSL/TLS encryption mode for #{domain}", print_to_audit_log: false)
23
24
  ssl_mode = Neetob::CLI::Cloudflare::SSLMode.new(domain).run
24
25
  audit_passed = ssl_mode.to_s == "full" ? "Yes" : "No"
26
+ repo = domain_to_repo(domain.to_s)
27
+ if audit_passed == "No"
28
+ comments = "SSL/TLS encryption mode is set to #{ssl_mode}. It should be set to 'Full'."
29
+ issue_url = GithubIssueCreation.new.create_issue(
30
+ repo:, title: "Set SSL TLS mode to Full for #{domain}",
31
+ description: comments)
32
+ audit_passed += " #{issue_url}"
33
+ end
25
34
  domains_data << [domain, ssl_mode, audit_passed]
26
35
  end
27
36
  ui.print_table(domains_data)
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "../../../cronitor/get_all_monitors"
4
+ require_relative "../../github_issue_creation"
4
5
 
5
6
  module Neetob
6
7
  class CLI
@@ -42,6 +43,15 @@ module Neetob
42
43
  end
43
44
  end
44
45
 
46
+ if audit_passed == "No"
47
+ repo = app_to_repo(app.to_s)
48
+ issue_url = GithubIssueCreation.new.create_issue(
49
+ repo:, title: "Fix missing or paused Cronitor monitor for #{app}",
50
+ description: " Monitor for Application present:#{monitor_for_app_present}
51
+ \n Monitor for Application enabled:#{monitor_for_app_enabled} \n #{comments}")
52
+ audit_passed += " #{issue_url}"
53
+ end
54
+
45
55
  apps_data << [app, monitor_for_app_present, monitor_for_app_enabled, comments, audit_passed]
46
56
  end
47
57
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "../../github_issue_creation"
4
+
3
5
  module Neetob
4
6
  class CLI
5
7
  module MonthlyAudit
@@ -47,6 +49,16 @@ module Neetob
47
49
  audit_passed = "Ignored"
48
50
  end
49
51
 
52
+ if audit_passed == "No"
53
+ repo = app_to_repo(app.to_s)
54
+ issue_url = GithubIssueCreation.new.create_issue(
55
+ repo:, title: "Fix missing or paused Cronitor monitor for #{app} help center",
56
+ description: " Monitor for Application help center present:#{monitor_for_app_help_center_present}
57
+ \n Monitor for Application help center enabled:#{monitor_for_app_help_center_enabled} \n #{comments}"
58
+ )
59
+ audit_passed += " #{issue_url}"
60
+ end
61
+
50
62
  apps_data << [app, monitor_for_app_help_center_present, monitor_for_app_help_center_enabled, comments,
51
63
  audit_passed]
52
64
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "../../github_issue_creation"
4
+
3
5
  module Neetob
4
6
  class CLI
5
7
  module MonthlyAudit
@@ -8,8 +10,9 @@ module Neetob
8
10
  class SetupCorrectlyForLandingPages < CLI::Base
9
11
  APPS_TO_IGNORE = [
10
12
  "NeetoAuth",
11
- "NeetoTower"
12
- ]
13
+ "NeetoTower",
14
+ "NeetoCode"
15
+ ].freeze
13
16
 
14
17
  attr_reader :all_monitors
15
18
 
@@ -49,6 +52,16 @@ module Neetob
49
52
  audit_passed = "Ignored"
50
53
  end
51
54
 
55
+ if audit_passed == "No"
56
+ repo = app_to_repo(app.to_s)
57
+ issue_url = GithubIssueCreation.new.create_issue(
58
+ repo:, title: "Fix missing or paused Cronitor monitor for #{app} landing page",
59
+ description: " Monitor for Application landing page present:#{monitor_for_app_landing_page_present}
60
+ \n Monitor for Application landing page enabled:#{monitor_for_app_landing_page_enabled} \n #{comments}"
61
+ )
62
+ audit_passed += " #{issue_url}"
63
+ end
64
+
52
65
  apps_data << [app, monitor_for_app_landing_page_present, monitor_for_app_landing_page_enabled,
53
66
  comments, audit_passed]
54
67
  end
@@ -11,36 +11,35 @@ module Neetob
11
11
  end
12
12
 
13
13
  def run
14
- ui.success "### 3.4.1. [Manual] Checking whether Honeybadger is correctly set up for apps"
15
- ui.info "#### Please manually check and add Yes/No for all the following checks on the Honeybadger dashboard for the apps listed in the table below:"
16
- ui.info "- Settings > General > Project Settings > Enable notifications for production is turned on"
17
- ui.info "- Settings > Alerts & integrations > This project's integrations > GitHub is integrated to the correct project repo."
18
- ui.info "- Settings > Alerts & integrations > This project's integrations > GitHub > Edit > Error Events > Automatically create an issue when an error occurs and Automatically re-open issues are turned on"
19
- ui.info "- Settings > Alerts & integrations > This project's integrations > Slack is integrated to the correct project channel in #neeto-health workspace"
20
- ui.info "- Please add comments if any for the checks below in the Comments column in the table"
21
- ui.info "- Finally, set Audit Passed as Yes only if all the checks are passed for the app, otherwise set it as No, and add a comment in the Comments column"
22
-
23
- apps_data = [
24
- [
25
- "App",
26
- "Enable Notifications for production is turned on",
27
- "GitHub is integrated to the correct project repo",
28
- "Automatically create GitHub issue and automatically re-open issue is turned on",
29
- "Slack is integrated to the correct project channel in #neeto-health workspace",
30
- "Comments",
31
- "Audit Passed"
32
- ]
33
- ]
34
- ui.info("\n")
35
- (
36
- Neetob::CLI::Sre::Base::APPS_LIST[:neetodeploy] +
37
- Neetob::CLI::Sre::Base::APPS_LIST[:heroku]
38
- ).select { |app| app.include?("production") }.each do |app|
39
-
40
- apps_data << [app, nil, nil, nil, nil, nil, nil]
41
- end
42
- ui.print_table(apps_data)
14
+ ui.success "### 3.4.1. Checking whether Honeybadger is correctly set up for apps"
15
+
16
+ result = run_honeybadger_check
17
+ formatted_result = extract_json_array_from_output(result)
18
+
19
+ create_issue(formatted_result)
20
+
21
+ ui.print_table(formatted_result)
43
22
  end
23
+
24
+ private
25
+
26
+ def run_honeybadger_check
27
+ `yarn audit:honeybadger`
28
+ end
29
+
30
+ def create_issue(formatted_result)
31
+ formatted_result.drop(1).each do |result|
32
+ repo = result[0].gsub("-production", "")
33
+ audit_passed = result.last == "Yes"
34
+ if !audit_passed
35
+ comment = result[5]
36
+ issue_url = GithubIssueCreation.new.create_issue(
37
+ repo:, title: "Fix Honeybadger settings",
38
+ description: comment)
39
+ result[-1] += " #{issue_url}" if issue_url
40
+ end
41
+ end
42
+ end
44
43
  end
45
44
  end
46
45
  end
@@ -24,12 +24,12 @@ module Neetob
24
24
  ui.success("## 3.2. Checking Cloudflare related configurations")
25
25
  ui.info "\n"
26
26
  Cloudflare::Main.new.run
27
+ # ui.info "\n"
28
+ # ui.success("## 3.3. Checking Cronitor related configurations")
29
+ # ui.info "\n"
30
+ # Cronitor::Main.new.run
27
31
  ui.info "\n"
28
- ui.success("## 3.3. Checking Cronitor related configurations")
29
- ui.info "\n"
30
- Cronitor::Main.new.run
31
- ui.info "\n"
32
- ui.success("## 3.4. Checking Honeybadger related configurations")
32
+ ui.success("## 3.3. Checking Honeybadger related configurations")
33
33
  ui.info "\n"
34
34
  Honeybadger::Main.new.run
35
35
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "../../github_issue_creation"
3
4
  module Neetob
4
5
  class CLI
5
6
  module MonthlyAudit
@@ -26,6 +27,7 @@ module Neetob
26
27
  audit_passed = nil
27
28
  comments = nil
28
29
  asset_host_value = nil
30
+ repo = app.gsub("-production", "")
29
31
  if config_vars.is_a?(Hash) && config_vars["error"] == "Forbidden"
30
32
  audit_passed = "No"
31
33
  comments = "You do not have permission to access the config vars for this app."
@@ -34,6 +36,10 @@ module Neetob
34
36
  if asset_host_line.nil?
35
37
  audit_passed = "No"
36
38
  comments = "ASSET_HOST value not found."
39
+ issue_url = GithubIssueCreation.new.create_issue(
40
+ repo:, title: "Cloudfront CDN audit failed",
41
+ description: comments)
42
+ audit_passed += " #{issue_url}"
37
43
  else
38
44
  asset_host_value = asset_host_line.split("|")[2].strip
39
45
  is_direct_cloudfront_asset_host = asset_host_value.include?("cloudfront.net")
@@ -41,26 +47,14 @@ module Neetob
41
47
  audit_passed = is_direct_cloudfront_asset_host || is_cdn_subdomain_asset_host ? "Yes" : "No"
42
48
  if audit_passed == "No"
43
49
  comments = "ASSET_HOST value is not a Cloudfront CDN URL or a CDN subdomain URL."
50
+ issue_url = GithubIssueCreation.new.create_issue(
51
+ repo:, title: "Set ASSET_HOST to a valid Cloudfront CDN URL",
52
+ description: comments)
53
+ audit_passed += " #{issue_url}"
44
54
  end
45
55
  end
46
56
  end
47
- apps_data << [app, asset_host_value, comments, audit_passed]
48
- end
49
- Neetob::CLI::Sre::Base::APPS_LIST[:heroku].select { |app| app.include?("production") }.each do |app|
50
- ui.info("Checking ASSET_HOST value for #{app}", print_to_audit_log: false)
51
- config_vars_result = Neetob::CLI::Heroku::ConfigVars::List.new([app]).run[0]
52
- asset_host_value = config_vars_result["ASSET_HOST"]
53
- if asset_host_value.nil?
54
- audit_passed = "No"
55
- comments = "ASSET_HOST value not found."
56
- else
57
- is_direct_cloudfront_asset_host = asset_host_value.include?("cloudfront.net")
58
- is_cdn_subdomain_asset_host = asset_host_value == "cdn.#{app.gsub("-web-production", "").gsub("-", "")}.com"
59
- audit_passed = is_direct_cloudfront_asset_host || is_cdn_subdomain_asset_host ? "Yes" : "No"
60
- if audit_passed == "No"
61
- comments = "ASSET_HOST value is not a Cloudfront CDN URL or a CDN subdomain URL."
62
- end
63
- end
57
+
64
58
  apps_data << [app, asset_host_value, comments, audit_passed]
65
59
  end
66
60
  ui.print_table(apps_data)
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "../../github_issue_creation"
3
4
  module Neetob
4
5
  class CLI
5
6
  module MonthlyAudit
@@ -15,12 +16,14 @@ module Neetob
15
16
 
16
17
  apps_data = [["App", "All essential env variables set", "Comments", "Audit Passed"]]
17
18
  ui.info("\n", print_to_audit_log: false)
19
+
18
20
  Neetob::CLI::Sre::Base::APPS_LIST[:neetodeploy].select { |app| app.include?("production") }.each do |app|
19
21
  ui.info("Checking essential env variables for #{app}", print_to_audit_log: false)
20
22
  essential_env_variables_result = Neetob::CLI::Sre::CheckEssentialEnv.new(app).run
21
23
  audit_passed = nil
22
24
  comments = nil
23
25
  all_essential_env_variables_set = nil
26
+ repo = app.gsub("-production", "")
24
27
  if essential_env_variables_result["error"] == "Forbidden"
25
28
  audit_passed = "No"
26
29
  comments = "You do not have permission to access the config vars for this app."
@@ -29,20 +32,14 @@ module Neetob
29
32
  audit_passed = all_essential_env_variables_set ? "Yes" : "No"
30
33
  if audit_passed == "No"
31
34
  comments = "Missing keys: #{essential_env_variables_result[:missing_keys].join(", ")}"
35
+ issue_url = GithubIssueCreation.new.create_issue(
36
+ repo:, title: "Missing essential environment variables",
37
+ description: comments)
38
+ audit_passed += " #{issue_url}"
32
39
  end
33
40
  end
34
41
  apps_data << [app, all_essential_env_variables_set, comments, audit_passed]
35
42
  end
36
- Neetob::CLI::Sre::Base::APPS_LIST[:heroku].select { |app| app.include?("production") }.each do |app|
37
- ui.info("Checking essential env variables for #{app}", print_to_audit_log: false)
38
- essential_env_variables_result = Neetob::CLI::Sre::CheckEssentialEnv.new(app).run
39
- all_essential_env_variables_set = essential_env_variables_result[:all_keys_present]
40
- audit_passed = all_essential_env_variables_set ? "Yes" : "No"
41
- if audit_passed == "No"
42
- comments = "Missing keys: #{essential_env_variables_result[:missing_keys].join(", ")}"
43
- end
44
- apps_data << [app, all_essential_env_variables_set, comments, audit_passed]
45
- end
46
43
  ui.print_table(apps_data)
47
44
  end
48
45
  end
@@ -3,7 +3,6 @@
3
3
  require_relative "ssl_certificates_over_thirty_days_from_expiry"
4
4
  require_relative "cloudfront_cdn_enabled"
5
5
  require_relative "essential_environment_variables_set"
6
- require_relative "auto_scaling_enabled"
7
6
  require_relative "scheduled_exports_enabled"
8
7
 
9
8
  module Neetob
@@ -23,8 +22,6 @@ module Neetob
23
22
  ui.info "\n"
24
23
  EssentialEnvironmentVariablesSet.new.run
25
24
  ui.info "\n"
26
- AutoScalingEnabled.new.run
27
- ui.info "\n"
28
25
  ScheduledExportsEnabled.new.run
29
26
  end
30
27
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "../../github_issue_creation"
3
4
  module Neetob
4
5
  class CLI
5
6
  module MonthlyAudit
@@ -11,7 +12,7 @@ module Neetob
11
12
  end
12
13
 
13
14
  def run
14
- ui.success "### 3.1.5. Checking whether scheduled exports are enabled"
15
+ ui.success "### 3.1.4. Checking whether scheduled exports are enabled"
15
16
 
16
17
  apps_data = [["App", "Scheduled exports config", "Comments", "Audit Passed"]]
17
18
  ui.info("\n", print_to_audit_log: false)
@@ -22,18 +23,21 @@ module Neetob
22
23
  audit_passed = nil
23
24
  comments = nil
24
25
  scheduled_exports_config = nil
26
+ repo = app.gsub("-production", "")
25
27
  if scheduled_exports_result.include? "Forbidden"
26
28
  audit_passed = "No"
27
29
  comments = "You do not have permission to access the config for this app."
28
30
  else
29
- scheduled_exports_config = scheduled_exports_result
30
- .gsub("\e[32m", "")
31
- .gsub("\e[0m", "")
31
+ scheduled_exports_config = scheduled_exports_config = strip_ansi_codes(scheduled_exports_result)
32
32
  .gsub("#{app}'s", "")
33
33
  .strip
34
34
  audit_passed = scheduled_exports_config.include?("turned on") ? "Yes" : "No"
35
35
  if audit_passed == "No"
36
36
  comments = scheduled_exports_config
37
+ issue_url = GithubIssueCreation.new.create_issue(
38
+ repo:, title: "Enable scheduled exports",
39
+ description: strip_ansi_codes(comments))
40
+ audit_passed += " #{issue_url}"
37
41
  end
38
42
  same_as_last_scheduled_export_config = scheduled_exports_config == last_scheduled_exports_config
39
43
  last_scheduled_exports_config = scheduled_exports_config