fix(docker): bouncer name strips wrong field from Docker secrets path#4490
fix(docker): bouncer name strips wrong field from Docker secrets path#4490tejgokani wants to merge 2 commits into
Conversation
When registering bouncers via Docker/Podman secrets, the secret filename 'bouncer_key_caddy' was split with 'cut -d_ -f2-', yielding 'key_caddy' instead of 'caddy'. The env-var registration loop (line 474) correctly uses 'cut -d_ -f3-' for BOUNCER_KEY_NAME → NAME. The secrets loop was inconsistent, using f2- instead of f3-. Fix: change f2- to f3- in the secrets loop (line 511). Adds regression test: mounts a mock secret file and asserts the registered bouncer name matches the suffix after 'bouncer_key_'. Fixes crowdsecurity#4301
|
@tejgokani: There are no 'kind' label on this PR. You need a 'kind' label to generate the release automatically.
DetailsI am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository. |
|
@tejgokani: There are no area labels on this PR. You can add as many areas as you see fit.
DetailsI am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4490 +/- ##
==========================================
- Coverage 63.88% 63.87% -0.01%
==========================================
Files 478 478
Lines 34298 34298
==========================================
- Hits 21911 21909 -2
- Misses 10231 10232 +1
- Partials 2156 2157 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@blotus take a look at this PR |
/kind fix
/area configuration
Summary
When registering bouncers via Docker/Podman secrets (Swarm mode), the bouncer
name was derived incorrectly. A secret file named
bouncer_key_caddyproduceda bouncer named
key_caddyinstead ofcaddy.Root cause
build/docker/docker_start.shline 511:The secret basename
bouncer_key_caddyhas three_-separated fields:bouncer|key|caddycut -d_ -f2-returns fields 2 onward →key_caddy.cut -d_ -f3-returns fields 3 onward →caddy(correct).The env-var registration loop at line 474 already uses
f3-correctly forBOUNCER_KEY_CADDY→CADDY. The secrets loop was inconsistent.Fix
One character change on line 511:
Testing
Added
test_register_bouncer_secrettobuild/docker/test/tests/test_bouncer.py.The test mounts a mock secret file at
/run/secrets/bouncer_key_caddy, startsthe container, and asserts the registered bouncer name is
caddy— notkey_caddy.Before this fix, the test fails with: AssertionError: Bouncer name is 'key_caddy' — expected 'caddy'
Checklist
Fixes #4301Fixes #4301