Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function SubmissionComplete({ resource }) {

function handleResponse() {
if (response.isPending) {
if (statusPollInterval !== undefined) {
if (Number.isFinite(statusPollInterval)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More context for these changes in the extended commit description of 484665c:

The || undefined logic will be tripped for 0. The intention was to try to avoid scheduling a poll if the result of "Number" parsing was "NaN", since that would be treated the same as "0" in setTimeout, thus potentially causing a DDOS. Instead, check for finiteness of the value when scheduling.

Number.isFinite(1)
// true
Number.isFinite(0)
// true
Number.isFinite(NaN)
// false
Number.isFinite(undefined)
// false

sleepTimeout.current = window.setTimeout(() => {
setRetryError(() => {
throw new RetrySubmissionError();
Expand Down
3 changes: 1 addition & 2 deletions app/javascript/packs/document-capture.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ function addPageAction(event, payload) {
{
endpoint: String(appRoot.getAttribute('data-endpoint')),
statusEndpoint: String(appRoot.getAttribute('data-status-endpoint')),
statusPollInterval:
Number(appRoot.getAttribute('data-status-poll-interval-ms')) || undefined,
statusPollInterval: Number(appRoot.getAttribute('data-status-poll-interval-ms')),
csrf,
isMockClient,
backgroundUploadURLs,
Expand Down
2 changes: 1 addition & 1 deletion config/application.yml.default
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ test:
phone_setups_per_ip_period: 10
phone_setups_per_ip_track_only_mode: false
piv_cac_verify_token_secret: 3ac13bfa23e22adae321194c083e783faf89469f6f85dcc0802b27475c94b5c3891b5657bd87d0c1ad65de459166440512f2311018db90d57b15d8ab6660748f
poll_rate_for_verify_in_seconds: 1
poll_rate_for_verify_in_seconds: 0
recurring_jobs_disabled_names: '["disabled job"]'
reg_confirmed_email_max_attempts: 3
reg_unconfirmed_email_max_attempts: 4
Expand Down