Skip to content
Snippets Groups Projects
Commit d78513cb authored by Douwe Maan's avatar Douwe Maan
Browse files

Enable Security/JSONLoad

parent 5cd9c7c6
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -944,6 +944,9 @@ Rails/TimeZone:
Rails/Validation:
Enabled: true
 
Security/JSONLoad:
Enabled: true
Style/AlignParameters:
Enabled: false
 
Loading
Loading
Loading
Loading
@@ -38,18 +38,6 @@ RSpec/SingleArgumentMessageChain:
Exclude:
- 'spec/requests/api/internal_spec.rb'
 
# Offense count: 8
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect.
Security/JSONLoad:
Exclude:
- 'db/migrate/20161019190736_migrate_sidekiq_queues_from_default.rb'
- 'db/migrate/20161024042317_migrate_mailroom_queue_from_default.rb'
- 'db/migrate/20161124141322_migrate_process_commit_worker_jobs.rb'
- 'spec/migrations/migrate_process_commit_worker_jobs_spec.rb'
- 'spec/models/project_services/irker_service_spec.rb'
- 'spec/support/stub_gitlab_calls.rb'
# Offense count: 55
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Loading
Loading
Loading
Loading
@@ -93,7 +93,7 @@ class MigrateSidekiqQueuesFromDefault < ActiveRecord::Migration
 
def migrate_from_queue(redis, queue, job_mapping)
while job = redis.lpop("queue:#{queue}")
payload = JSON.load(job)
payload = JSON.parse(job)
new_queue = job_mapping[payload['class']]
 
# If we have no target queue to migrate to we're probably dealing with
Loading
Loading
Loading
Loading
@@ -47,7 +47,7 @@ class MigrateMailroomQueueFromDefault < ActiveRecord::Migration
 
def migrate_from_queue(redis, queue, job_mapping)
while job = redis.lpop("queue:#{queue}")
payload = JSON.load(job)
payload = JSON.parse(job)
new_queue = job_mapping[payload['class']]
 
# If we have no target queue to migrate to we're probably dealing with
Loading
Loading
Loading
Loading
@@ -34,7 +34,7 @@ class MigrateProcessCommitWorkerJobs < ActiveRecord::Migration
new_jobs = []
 
while job = redis.lpop('queue:process_commit')
payload = JSON.load(job)
payload = JSON.parse(job)
project = Project.find_including_path(payload['args'][0])
 
next unless project
Loading
Loading
@@ -75,7 +75,7 @@ class MigrateProcessCommitWorkerJobs < ActiveRecord::Migration
new_jobs = []
 
while job = redis.lpop('queue:process_commit')
payload = JSON.load(job)
payload = JSON.parse(job)
 
payload['args'][2] = payload['args'][2]['id']
 
Loading
Loading
Loading
Loading
@@ -62,7 +62,7 @@ describe MigrateProcessCommitWorkerJobs do
end
 
def pop_job
JSON.load(Sidekiq.redis { |r| r.lpop('queue:process_commit') })
JSON.parse(Sidekiq.redis { |r| r.lpop('queue:process_commit') })
end
 
before do
Loading
Loading
@@ -198,7 +198,7 @@ describe MigrateProcessCommitWorkerJobs do
let(:job) do
migration.down
 
JSON.load(Sidekiq.redis { |r| r.lpop('queue:process_commit') })
JSON.parse(Sidekiq.redis { |r| r.lpop('queue:process_commit') })
end
 
it 'includes the project ID' do
Loading
Loading
Loading
Loading
@@ -59,7 +59,7 @@ describe IrkerService, models: true do
 
conn = @irker_server.accept
conn.readlines.each do |line|
msg = JSON.load(line.chomp("\n"))
msg = JSON.parse(line.chomp("\n"))
expect(msg.keys).to match_array(['to', 'privmsg'])
expect(msg['to']).to match_array(["irc://chat.freenode.net/#commits",
"irc://test.net/#test"])
Loading
Loading
Loading
Loading
@@ -35,7 +35,7 @@ module StubGitlabCalls
{ "tags" => tags }
)
allow_any_instance_of(ContainerRegistry::Client).to receive(:repository_manifest).and_return(
JSON.load(File.read(Rails.root + 'spec/fixtures/container_registry/tag_manifest.json'))
JSON.parse(File.read(Rails.root + 'spec/fixtures/container_registry/tag_manifest.json'))
)
allow_any_instance_of(ContainerRegistry::Client).to receive(:blob).and_return(
File.read(Rails.root + 'spec/fixtures/container_registry/config_blob.json')
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment