Parse BL security scan limit env var as base 10

What does this MR do and why?

DUO_WORKFLOW_MAX_CONCURRENT_BL_SECURITY_SCANS_PER_GROUP was parsed with Integer(...) with no base, so a value with a leading zero was read as octal: 010 became a limit of 8 (and 0x10 would have been 16).

Ai::DuoWorkflows::CreateWorkflowService#max_active_bl_security_scans now parses the variable with an explicit base of 10. As suggested on the issue, the default is passed to ENV.fetch as a string, because Integer(<Integer>, 10) is not a valid call. Values that are not numbers still fall back to the default, and 0 or less still turns the limit off.

Value Before After
010 8 10
09 default (invalid octal) 9
0x10 16 default
unset / many default default

Closes #639683 (closed)

How to set up and validate locally

bin/rspec ee/spec/services/ai/duo_workflows/create_workflow_service_spec.rb -e 'business logic security scan limit'

The new spec puts 8 active scans in the root namespace and sets the variable to 010. The scan is created with a limit of 10; with the old octal parse (limit 8) it would be refused.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Merge request reports

Loading
Loading