From 8b90b51b1afb172a5aace8c4944f42af65fbc298 Mon Sep 17 00:00:00 2001 From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Tue, 24 Jan 2023 10:30:32 -0800 Subject: [PATCH] Adjust the barcode to ASN range check and add test case to cover the check --- src/documents/consumer.py | 6 ++--- .../barcodes/barcode-128-asn-too-large.pdf | Bin 0 -> 23427 bytes src/documents/tests/test_barcodes.py | 21 ++++++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 src/documents/tests/samples/barcodes/barcode-128-asn-too-large.pdf diff --git a/src/documents/consumer.py b/src/documents/consumer.py index c583abc60..bc344abb9 100644 --- a/src/documents/consumer.py +++ b/src/documents/consumer.py @@ -140,13 +140,13 @@ class Consumer(LoggingMixin): if not self.override_asn: # check not necessary in case no ASN gets set return - # Validate the range is above zero and less than int32 max + # Validate the range is above zero and less than uint32_t max # otherwise, Whoosh can't handle it in the index - if self.override_asn < 0 or self.override_asn > 2_147_483_647: + if self.override_asn < 0 or self.override_asn > 0xFF_FF_FF_FF: self._fail( MESSAGE_ASN_RANGE, f"Not consuming {self.filename}: " - "Given ASN is out of range [0, 2147483647]", + f"Given ASN {self.override_asn} is out of range [0, 4,294,967,295]", ) if Document.objects.filter(archive_serial_number=self.override_asn).exists(): self._fail( diff --git a/src/documents/tests/samples/barcodes/barcode-128-asn-too-large.pdf b/src/documents/tests/samples/barcodes/barcode-128-asn-too-large.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2d190c8762e5573b39572f941dc9935d7c581a66 GIT binary patch literal 23427 zcmeFWWpE_TvZmQ$W@cu!n3Te%%ktzJ9}nl&BkW` zAG5SfFE@|ZE8ILQBA%j95|jAO%)kaqF@JWt3(HK*L~L(l1D2@+B*0YG?kX%f`&f zCLloU?BZk!u!Z%=zQ~$Q-CIKxqsn`grq2O&On{_8h655zcP_64*tU&z6y5e#7QJ++ zhj^dzVpOFdljKcD`s@El6CbARss1^f_qJ+qF)xV)NnvJ%WO*%ylnnswe$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_O5uggd zksxou0OTmpPH55jELV`)!1sRiEAHVC27`j3(QqsdatH~aU|2X7j)VYkI2?k2gPw6{ zJQ4?jAovy_#)Jw$_|yeHN#ak`1IUQ|mr(y}uof_Q7~c$JwmNxJ`DgtY_g^enZ37+t z4n7|P0K+lRvGUY2&@plH0;v}+VE8m2|F5#8zc(1W0o~P;&$FO?m;2^z5jEB*Fi9TsXX$aK)lbQAqk8 zA>3NSH*F(nh#tkcWnTX{asy<+r-PIBGf4t5zfg1GjOv^AF%Aic^Jq)Q1x6iq~PE%|D<8 zb#-1>&7^+*bae1U;6ea%)$Z)_6k((gQQ|nG*UhZfwisUBGh1|~MpYG{ys^PL7DaQJ`P0ssQ| zr!4@W@qhE{!*BvS9fMEIwxk7s*+Pn_T6lVbd})5xz-G#CIsCTA&!D%D6T|0g{s1H# Mj}VcUCz|U12lQL;TmS$7 literal 0 HcmV?d00001 diff --git a/src/documents/tests/test_barcodes.py b/src/documents/tests/test_barcodes.py index b2d0824ed..5bf12a037 100644 --- a/src/documents/tests/test_barcodes.py +++ b/src/documents/tests/test_barcodes.py @@ -9,6 +9,7 @@ from django.test import override_settings from django.test import TestCase from documents import barcodes from documents import tasks +from documents.consumer import ConsumerError from documents.tests.utils import DirectoriesMixin from PIL import Image @@ -779,3 +780,23 @@ class TestBarcode(DirectoriesMixin, TestCase): args, kwargs = mocked_call.call_args self.assertEqual(kwargs["override_asn"], 123) + + @override_settings(CONSUMER_ENABLE_ASN_BARCODE=True) + def test_asn_too_large(self): + + src = os.path.join( + os.path.dirname(__file__), + "samples", + "barcodes", + "barcode-128-asn-too-large.pdf", + ) + dst = os.path.join(self.dirs.scratch_dir, "barcode-128-asn-too-large.pdf") + shutil.copy(src, dst) + + with mock.patch("documents.consumer.Consumer._send_progress"): + self.assertRaisesMessage( + ConsumerError, + "Given ASN 4294967296 is out of range [0, 4,294,967,295]", + tasks.consume_file, + dst, + )