Skip to content

Commit 6b559ac

Browse files
Devin Rileymaschwenk
authored andcommitted
Allow VRT ids to contain numbers (#17)
The current validation fails on validating VRT IDs that contain numbers which breaks on the current version of VRT. This commit loosens the validation on IDs to allow digits.
1 parent 1cd8665 commit 6b559ac

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

lib/vrt/map.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def categories
4242

4343
def valid_identifier?(vrt_id)
4444
# At least one string of lowercase or _, plus up to 2 more with stops
45-
@_valid_identifiers[vrt_id] ||= vrt_id =~ /other|\A[a-z_]+(\.[a-z_]+){0,2}\z/
45+
@_valid_identifiers[vrt_id] ||= vrt_id =~ /other|\A[a-z_\d]+(\.[a-z_\d]+){0,2}\z/
4646
end
4747

4848
def construct_lineage(string, max_depth)

spec/vrt/map_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,10 @@
121121
let(:string) { 'server_security_misconfiguration.meep_meep_meep' }
122122
it { is_expected.to be_falsey }
123123
end
124+
125+
context 'when contains numbers' do
126+
let(:string) { 'sensitive_data_exposure.token_leakage_via_referer.untrusted_3rd_party' }
127+
it { is_expected.to be_truthy }
128+
end
124129
end
125130
end

0 commit comments

Comments
 (0)