Zomato Blog, published 2023-09-13 (Read from an archive copy captured in April 2025.)
Architecture
Vinifera is a standard Rails app. Sidekiq manages its jobs, Postgres is the persistent store and Redis the application cache. Employees added to the GitHub organisation are registered as targets and their public repositories and gists are scanned as assets, with revisions stored so that changes are found quickly. Scans run the Gitleaks Docker image through the Docker API in isolated containers. There is a Slack integration for monitoring, and pager events notify the on-call team.
Section: Vinifera’s Development Journey | Section: Vinifera’s Operations
Components
Component
Role
Where
Sidekiq
Manages the job lifecycle, including scheduling and retries; scans are triggered through it, and a target monitor job is re-enqueued for the next scan after it succeeds.
Near: Sidekiq is used for efficient job lifecycle | Near: Scanning is triggered via Sidekiq | Near: it is re-enqueued for the subsequent scan
Gitleaks integration
The scanner: its Docker image is run through the Docker API, each scan in an isolated container.
Near: Docker image is used for scanning with | Near: all scans are performed within isolated Docker
Postgres
The persistent data store; it also holds the enqueue information that controls when a target's next scan runs.
Near: Postgres was chosen as the persistent data | Near: with the enqueue information stored in the
Redis
The application cache, also used to cache GitHub API responses.
Near: Redis served as the application cache | Near: to cache the responses in Redis
Slack integration and pager events
Give real-time monitoring and event checking in Slack, and page the on-call team for security incidents.
Near: real-time monitoring and event checking through Slack | Near: Pager events are triggered to notify the
Datadog
Monitors relevant statistics and the health of the service.
Near: Vinifera further leverages Datadog to monitor relevant
DiSeAl (Distributed Security Alerting)
An alerting and acknowledgment system: when a new resource is registered, an internal lookup finds its owner in the organisation and an alert is sent to them.
Section: Distributed Security Alerting
Figures, as the source states them
Figure
As stated
Note
Where
Maximum memory used by a scan of a large fork, in some cases
1 GB
Almost; before patch-only scanning
Near: the maximum memory used for scanning reached
Share of total CPU used by a scan of a large fork, in some cases
99 percent
Approximately; before patch-only scanning
Near: the maximum memory used for scanning reached
Cloning and scanning developers' huge open-source forks spiked the Docker daemon and at times choked the cluster
zomato-2023-vinifera#f1at corpus version 26a1b3a7e3dd
Trigger
Recurring, with no dates given. A developer forked a large open-source project in order to contribute to it; the post names the Linux kernel repository, odoo and the Android AOSP source as examples.
Near: This arose when a developer forked a
How it failed
Vinifera scanned the entire forked repository for violations. Scanning big forks was one of the main causes of resource usage spikes on the Docker daemon; in some cases a scan's maximum memory reached almost 1GB and about 99% of the total CPU.
Near: One of the main causes that spiked | Near: the maximum memory used for scanning reached
Impact
The enormous forks sometimes caused the cluster to choke. The post reports no missed leak or outage figure.
Near: sometimes caused the cluster to choke
Fix
Vinifera now works out the commit patch and scans that directly, without cloning the whole fork: the GitHub user activity API identifies commits a developer pushed to collaborative projects or forks, and the relevant patch is extracted for scanning.
Near: scanned the commit patch instead of cloning | Near: By leveraging the user activity GitHub API
Throttle jobs automatically by error type so retries do not pile onto a struggling dependency
zomato-2023-vinifera#d1at corpus version 26a1b3a7e3dd
Chosen
Vinifera analyses the type of error when a job fails. When the failure comes from GitHub or from the Docker box, jobs are throttled automatically, with limits adjusted dynamically for specific periods, to give the system a window in which to avoid further errors.
Near: If the failures are attributed to issues | Near: dynamically adjusting limits for specific periods
Reasoning
A system that relies on third-party services, or on internal services with limited capacity, needs checks so that it does not overwhelm them. The post says the approach helps avoid the disruption caused by exponential retries.
Near: When relying on third-party services or internal
Reviewer's notes
The post lists this among measures taken for stability and scalability without describing an incident that prompted it or giving the limits used.
Cache GitHub API responses in Redis, using HTTP caching response headers, to stay under the rate limit
zomato-2023-vinifera#d2at corpus version 26a1b3a7e3dd
Chosen
GitHub API responses are cached in Redis through the faraday-http-cache library, which uses response headers such as Etag, Last-Modified and Age. Caching is selective: heavy responses and resources not needed again are deliberately left out.
Near: We employed the faraday-http-cache library | Near: Vinifera employs a selective caching approach
Reasoning
The purpose given is to mitigate rate-limiting issues with the GitHub API.
Near: To mitigate rate-limiting issues, we leveraged caching
Cost
A small impact on storage, as the post puts it, because responses now sit in Redis memory; the selective caching is how that is kept in check.
Run scans on a dedicated Docker daemon with capped CPU so scan trouble cannot stop discovery
zomato-2023-vinifera#d3at corpus version 26a1b3a7e3dd
Chosen
Scanning was moved to a dedicated machine with its own Docker daemon, and each scan is restricted to a single CPU core and a fraction of CPU weight.
Near: Separating scanning operations to a dedicated machine | Near: restricting scans to a single CPU core
Reasoning
Isolating scans limits the blast radius of any issue, and the CPU restriction is meant to prevent resource exhaustion.
Near: we were able to limit the blast | Near: restricting scans to a single CPU core
Outcome
By the team's account the separation greatly improved performance and prevented resource congestion, and discovery kept running without interruption even while the dedicated Docker machine was experiencing errors. No figures are given.
Near: Separating scanning operations to a dedicated machine | Near: continuity of discovery operations in an uninterrupted
Reviewer's notes
The post does not say where scans ran before the move, and does not present the big-fork spikes in f1 as the reason for this change.
Re-enqueue each target's monitor job after a successful run and keep the schedule in the database
zomato-2023-vinifera#d4at corpus version 26a1b3a7e3dd
Chosen
After the target monitor Sidekiq job runs successfully it is put back on the queue for the next scan, and the enqueue information is stored in the database.
Near: it is re-enqueued for the subsequent scan
Reasoning
Keeping the enqueue information in the database allows fine-tuning and control over when the next scan happens.
Near: This enables fine-tuning and control over the