Skip to content
Snippets Groups Projects
Verified Commit 71e043d0 authored by Jay's avatar Jay :japanese_ogre:
Browse files

Collect device_id from arkose payload

parent 93ac32a5
No related branches found
No related tags found
2 merge requests!122597doc/gitaly: Remove references to removed metrics,!119235Collect device_id from arkose payload
......@@ -29,6 +29,7 @@ def add_or_update_arkose_attributes
def custom_attributes
custom_attributes = []
custom_attributes.push({ key: 'arkose_session', value: response.session_id })
custom_attributes.push({ key: 'arkose_device_id', value: response.device_id }) unless response.device_id.nil?
custom_attributes.push({ key: UserCustomAttribute::ARKOSE_RISK_BAND, value: response.risk_band })
custom_attributes.push({ key: 'arkose_global_score', value: response.global_score })
custom_attributes.push({ key: 'arkose_custom_score', value: response.custom_score })
......
......@@ -60,6 +60,10 @@ def session_id
response&.dig('session_details', 'session') || 'Unavailable'
end
def device_id
response&.dig('session_details', 'device_id')
end
def risk_category
response&.dig('session_risk', 'risk_category') || 'Unavailable'
end
......
......@@ -22,6 +22,7 @@
"ip_rep_list": null,
"game_number_limit_reached": false,
"user_language_shown": "en",
"device_id": "gaFCZkxoGZYW6",
"telltale_list": [
"eng-1362",
"eng-1362-game3-py-0."
......@@ -79,11 +80,15 @@
"risk_band": "Low",
"global": {
"score": "0",
"telltales": []
"telltales": [
]
},
"custom": {
"score": "0",
"telltales": []
"telltales": [
]
}
}
}
......@@ -22,6 +22,7 @@
"ip_rep_list": null,
"game_number_limit_reached": false,
"user_language_shown": "en",
"device_id": "gaFCZkxoGZYW6",
"telltale_list": [
"eng-1362",
"eng-1362-game3-py-0."
......
......@@ -22,6 +22,7 @@
"ip_rep_list": null,
"game_number_limit_reached": false,
"user_language_shown": "en",
"device_id": "gaFCZkxoGZYW6",
"telltale_list": [
"eng-1362",
"eng-1362-game3-py-0."
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Arkose::VerifyResponse do
RSpec.describe Arkose::VerifyResponse, feature_category: :instance_resiliency do
def parse_json(file_path)
Gitlab::Json.parse(File.read(Rails.root.join(file_path)))
end
......@@ -166,6 +166,7 @@ def parse_json(file_path)
:risk_category | "BOT-STD"
:global_telltale_list | lazy { global_telltale_list }
:custom_telltale_list | lazy { custom_telltale_list }
:device_id | "gaFCZkxoGZYW6"
end
with_them do
......@@ -186,6 +187,7 @@ def parse_json(file_path)
:risk_category | 'Unavailable'
:global_telltale_list | 'Unavailable'
:custom_telltale_list | 'Unavailable'
:device_id | nil
end
with_them do
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Arkose::RecordUserDataService do
RSpec.describe Arkose::RecordUserDataService, feature_category: :instance_resiliency do
let(:user) { create(:user) }
let(:arkose_verify_response) do
......@@ -14,13 +14,14 @@
describe '#execute' do
it 'adds new custom attributes to the user' do
expect { service.execute }.to change { user.custom_attributes.count }.from(0).to(4)
expect { service.execute }.to change { user.custom_attributes.count }.from(0).to(5)
end
it 'adds arkose data to custom attributes' do
service.execute
expect(user.custom_attributes.find_by(key: 'arkose_session').value).to eq('22612c147bb418c8.2570749403')
expect(user.custom_attributes.find_by(key: 'arkose_device_id').value).to eq('gaFCZkxoGZYW6')
expect(
user.custom_attributes.find_by(key: UserCustomAttribute::ARKOSE_RISK_BAND).value
).to eq(Arkose::VerifyResponse::RISK_BAND_LOW)
......
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