Menu

1 / 2

When 010 means 8: parsing a GitLab env var as base 10

DEV Community: ruby·Priyanshu Jha·about 10 hours ago
#CSGDoE8R
Long article (1012 words) — no AI summary yet.
Reading 0:00
15s threshold

Ruby will happily turn 010 into 8. That's not a typo. Integer without a base treats a leading zero as octal, and a concurrency limit of ten becomes a limit of eight.

This is the story of gitlab-org/gitlab!270247 , a small parse fix in Duo Workflow's business-logic security scan limit. I'll cover the gotcha, the one extra argument that removes it, and the spec that fails if someone takes the base back out.

The issue: a limit you could not type in decimal

The issue was gitlab-org/gitlab#639683 , opened by Meir Benayoun after Mohamed Hamda raised it in review of !268212 , which had just added the limit.

Ops can raise or lower how many of those scans may run at once in a root namespace with DUO_WORKFLOW_MAX_CONCURRENT_BL_SECURITY_SCANS_PER_GROUP . The default is 20. A value of 0 or less turns the cap off. The parser looked like this:

Integer ( ENV .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.