fix: escape the container name in the Docker name filter - #3837
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Summary by CodeRabbit
WalkthroughThe Docker provider now escapes container names before building its name filter regex. A regression test confirms that periods are treated literally. ChangesContainer name matching
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The name filter of the Docker container list API is a regular expression, so metacharacters in a container name are interpreted instead of matched literally. A lookup for "cache.1" therefore also matches "cacheX1", and ReuseOrCreateContainer can reuse the wrong container.
a8e2927 to
4365cfa
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Rebased. |
What does this PR do?
Quotes the
namefilter of the Docker container list API is a regular expression, so metacharacters in a container name are interpreted instead of matched literally.Why is it important?
A lookup for "cache.1" also matches "cacheX1", and
ReuseOrCreateContainercan reuse the wrong container.Since container names may only include
^[a-zA-Z0-9][a-zA-Z0-9_.-]+$char.(dot) is the only metacharacter reachable through a legal container name.Related issues
Not related to, by raised in #3051 by an LLM code review.