-
Notifications
You must be signed in to change notification settings - Fork 34
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
Remove dead code #806
base: master
Are you sure you want to change the base?
Remove dead code #806
Conversation
I have no idea why _api_ would become "API" rather than "Api" but anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to also keep some of the dumps code, although it's dead now, it may be alive again if we move off of Thomas's infra.
def check_token | ||
token = SmokeDetector.where(access_token: params[:token]).first | ||
payload = { | ||
exists: token.present?, | ||
owner_name: token&.user&.username, | ||
location: token&.location, | ||
created_at: token&.created_at, | ||
updated_at: token&.updated_at | ||
} | ||
|
||
render json: payload | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forget when this was introduced, but I think we will want to keep this unless helios is official dead.
Well, the point being the code is originally bugged for performance and security, so if we move away from the infra we have to rewrite them anyway. |
A lot of this seems like stuff that's potentially still alive/useful. Could you add a comment to each of the files changed to explain what the rationale for considering it dead is? |
This reverts commit 7998d3d.
@@ -2,7 +2,6 @@ | |||
|
|||
class APIController < ApplicationController | |||
before_action :verify_key, except: %i[filter_generator api_docs filter_fields calculate_filter] | |||
before_action :verify_trusted_key, only: [:regex_search] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method has been deleted long before.
@@ -1,8 +1,6 @@ | |||
# frozen_string_literal: true | |||
|
|||
class DumpsController < ApplicationController | |||
before_action :set_dump, only: %i[show edit update destroy] | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The four methods in only clause does not exist.
before_action :verify_blacklist_manager, only: %i[force_failover force_pull] | ||
before_action :verify_smoke_detector_runner, only: %i[mine token_regen new create] | ||
before_action :set_smoke_detector, except: %i[audits mine new create check_token] | ||
before_action :set_smoke_detector, except: %i[audits mine new create] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think Helios is still active but this may need to be reverted.
@@ -45,25 +45,6 @@ onLoad(() => { | |||
}); | |||
}); | |||
|
|||
$('input.pin-checkbox').change(function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pinned roles are indistinguishable from non-pinned roles.
sanitized = sanitize_for_search term, **cols | ||
select(Arel.sql("`#{table_name}`.*, #{sanitized} AS search_score")) | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is never used.
def has_pinned_role?(role) | ||
UsersRole.where(user: self, role: Role.find_by(name: role), pinned: true).exists? | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indistinguishable
<%= form_tag migrate_token_path do %> | ||
<%= hidden_field_tag "state", params[:state] %> | ||
<%= submit_tag "Confirm that you've granted access", class: 'btn btn-primary' %> | ||
<% end %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is no longer being linked to, and I think all token migration is finished.
class DropTableDumps < ActiveRecord::Migration[5.2] | ||
def change | ||
execute 'DROP TABLE dumps' | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Table no longer being used after Rails based full dump being disabled.
class RemoveAPITokenLegacy < ActiveRecord::Migration[5.2] | ||
def change | ||
remove_column :users, :encrypted_api_token_legacy | ||
remove_column :users, :token_migrated_legacy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Legacy column; may introduce security risks.
This all looks good to me, but I want to get confirmation as to Helios being officially dead yet. I feel like it's still a thing we want to make happen eventually? |
Well, Helios is archived and is way out dated. It is highly unlikely that the original project will become active again. Although we do want that kind of change, it is likely that we need to rewrite it. |
This PR tries to remove code that is no longer in use.