Merge pull request #10329 from demarches-simplifiees/virus_stuff

Tech: ne lance pas de job d'analyse antivirus pour les fichiers crés par l'application
This commit is contained in:
Paul Chavard 2024-04-16 08:05:32 +00:00 committed by GitHub
commit d8a5d708b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 15 additions and 13 deletions

View file

@ -15,6 +15,13 @@ module AttachmentVirusScannerConcern
private
def scan_for_virus_later
blob&.scan_for_virus_later
return if blob.nil?
# do not scan if the blob is already marked as safe
# usually because of metadata[:virus_scan_result] = ActiveStorage::VirusScanner::SAFE
# added on a blob built by the application itself
return if blob.virus_scan_result == ActiveStorage::VirusScanner::SAFE
blob.scan_for_virus_later
end
end

View file

@ -0,0 +1,5 @@
class DropVirusScanTable < ActiveRecord::Migration[7.0]
def up
drop_table :virus_scans
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2024_04_11_164502) do
ActiveRecord::Schema[7.0].define(version: 2024_04_15_192417) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_buffercache"
enable_extension "pg_stat_statements"
@ -1148,16 +1148,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_11_164502) do
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
end
create_table "virus_scans", force: :cascade do |t|
t.string "blob_key"
t.bigint "champ_id"
t.datetime "created_at", precision: nil, null: false
t.datetime "scanned_at", precision: nil
t.string "status"
t.datetime "updated_at", precision: nil, null: false
t.index ["champ_id"], name: "index_virus_scans_on_champ_id"
end
create_table "without_continuation_mails", id: :serial, force: :cascade do |t|
t.text "body"
t.datetime "created_at", precision: nil, null: false

View file

@ -139,7 +139,7 @@ describe 'Instructing a dossier:', js: true do
expect(page).to have_text("Export .csv dun dossier « à suivre » demandé il y a moins d'une minute")
expect(page).to have_text("En préparation")
assert_performed_jobs 2 do
assert_performed_jobs 1 do
perform_enqueued_jobs(only: ExportJob)
end