Skip to content

shouldSaveDiscardedRecording permits Infinity duration and non-object settings #1805

Description

@hsusul

Describe the bug

In src/helpers/discardedRecording.js:

  1. shouldSaveDiscardedRecording(settings, durationSeconds, policyState = null) evaluates durationSeconds >= MIN_DISCARDED_DURATION_SECONDS. When durationSeconds is Infinity or non-finite, it returns true instead of false.
  2. When settings is a non-object primitive (e.g. true or "invalid"), settings.dataRetentionEnabled and settings.saveDiscardedTranscriptions evaluate improperly or can cause unexpected policy rule evaluations.

To Reproduce

  1. Call shouldSaveDiscardedRecording(settings, Infinity) -> returns true (expected false).
  2. Call shouldSaveDiscardedRecording("invalid", 3) -> returns false but doesn't validate object type upfront.

Expected Behavior

  • shouldSaveDiscardedRecording should return false if !settings || typeof settings !== "object".
  • shouldSaveDiscardedRecording should return false if !Number.isFinite(durationSeconds) or durationSeconds < MIN_DISCARDED_DURATION_SECONDS.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions