You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix API_key message showing the API port instead of the access key - #1867
nettacker/api/engine.py formats the startup banner as _("API_key").format(options.api_port, options.api_access_key). 20 locales only had {0},
so they printed the port where the access key should be. This changes {0} to {1} in those
strings (no translation text changes) and adds a regression test that renders API_key for
every locale and checks that the key is in the output.
The PR for #1860 (#1866) only adds missing Spanish keys and does not touch API_key, so both
can be merged in any order.
Tests: the new test passes for all 24 locales; with the locale change reverted, 20 cases fail.
Type of change
New core framework functionality
Bugfix (non-breaking change that fixes an issue)
Code refactoring without any functionality changes
New or existing module/payload change
Documentation/localization improvement
Test coverage improvement
Dependency upgrade
Other improvement (best practice, cleanup, optimization, etc)
nettacker/api/engine.py formats API_key as (api_port, api_access_key),
but 20 locales only had a {0} placeholder, so the startup banner printed
the port where the API key should be. Use {1} for the key, matching
en.yaml, and add a regression test that renders API_key for every locale.
FixesOWASP#1861
Reviewing files that changed from the base of the PR and between bd56281 and 1d4cf8d.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Summary by CodeRabbit
Bug Fixes
Corrected API key formatting across supported translations, ensuring the key appears properly in localized messages.
Tests
Added coverage to verify API key messages render correctly across locales.
Walkthrough
Twenty locale files now use {1} for the API access key in the API_key message. A unit test formats available locale messages and checks that the rendered output contains the test access key.
Changes
API key locale messages
Layer / File(s)
Summary
Locale placeholders and rendered-key test nettacker/locale/{ar,de,el,es,fa,fr,hy,id,it,iw,ja,ko,nl,ps,pt-br,ru,tr,ur,vi,zh-cn}.yaml, tests/unit/core/test_locale_messages.py
The 20 locale messages use {1} instead of {0}. The test formats each available API_key message and checks that its output contains the test access key.
OWASP/Nettacker#1860 — The PR changes the Spanish API_key placeholder, but does not add the other missing Spanish translations requested by the issue.
Possibly related PRs
OWASP/Nettacker#1866 — This PR also changes nettacker/locale/es.yaml, and its description notes that the API_key placeholder is handled by this change.
Merge Risk: Minimal · previous review ddedd
The API key message in 20 languages will now show the access key instead of the port. The change is small and low risk, and it adds test coverage.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title states the main change: the API_key banner showed the API port where the access key should appear. The changeset changes the {0} placeholder to {1} in 20 locale files, which matches this tit…
Description check
The description explains the cause (engine.py passes port and access key as format arguments, while 20 locales only had {0}), the fix (changing {0} to {1} with no translation text changes), and the re…
Linked Issues check
Issue #1861 requires two coding changes: (1) change {0} to {1} in the 20 listed locale API_key strings, and (2) add a unit test that renders API_key for every locale and checks that the access…
Out of Scope Changes check
The PR changes only the 20 locale API_key strings and adds one test file. Each locale change replaces {0} with {1} and does not alter translation text, which the issue specifies. The test file d…
Full details: Title check
Explanation
The title states the main change: the API_key banner showed the API port where the access key should appear. The changeset changes the {0} placeholder to {1} in 20 locale files, which matches this title. A regression test is also added, which the title does not mention, but that is expected.
Full details: Description check
Explanation
The description explains the cause (engine.py passes port and access key as format arguments, while 20 locales only had {0}), the fix (changing {0} to {1} with no translation text changes), and the regression test. It also links issue #1861 and notes test results. It is directly related to the changeset.
Full details: Linked Issues check
Explanation
Issue #1861 requires two coding changes: (1) change {0} to {1} in the 20 listed locale API_key strings, and (2) add a unit test that renders API_key for every locale and checks that the access key appears. The PR changes the placeholder in the 20 locale files, as listed in the summary. I confirmed this in nettacker/locale/de.yaml: API_key: "* API-Schlüssel: {1}" (was {0}), with no translation text change. The PR adds tests/unit/core/test_locale_messages.py, which parametrizes over all *.yaml locale files, skips files without API_key, formats the message with (5000, "test-access-key-1234"), and asserts the key appears in the output. This matches the issue's test requirement. Because the test formats with two arguments, a locale that still uses only {0} would print the port, not the key, and the test would fail. I did not inspect the diff of all 20 locale files individually; the remaining locale changes rest on the summary and the author's reported test results (20 failures when reverted).
Full details: Out of Scope Changes check
Explanation
The PR changes only the 20 locale API_key strings and adds one test file. Each locale change replaces {0} with {1} and does not alter translation text, which the issue specifies. The test file directly verifies the issue's requirement. No unrelated functional change appears in the reviewed summary or in the inspected de.yaml and test diffs.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Reviewing files that changed from the base of the PR and between c7ecc2c and ddedd0a.
Files selected for processing: 21
nettacker/locale/ar.yaml
nettacker/locale/de.yaml
nettacker/locale/el.yaml
nettacker/locale/es.yaml
nettacker/locale/fa.yaml
nettacker/locale/fr.yaml
nettacker/locale/hy.yaml
nettacker/locale/id.yaml
nettacker/locale/it.yaml
nettacker/locale/iw.yaml
nettacker/locale/ja.yaml
nettacker/locale/ko.yaml
nettacker/locale/nl.yaml
nettacker/locale/ps.yaml
nettacker/locale/pt-br.yaml
nettacker/locale/ru.yaml
nettacker/locale/tr.yaml
nettacker/locale/ur.yaml
nettacker/locale/vi.yaml
nettacker/locale/zh-cn.yaml
tests/unit/core/test_locale_messages.py
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed change
Fixes #1861
nettacker/api/engine.py formats the startup banner as
_("API_key").format(options.api_port, options.api_access_key). 20 locales only had {0},so they printed the port where the access key should be. This changes {0} to {1} in those
strings (no translation text changes) and adds a regression test that renders API_key for
every locale and checks that the key is in the output.
The PR for #1860 (#1866) only adds missing Spanish keys and does not touch API_key, so both
can be merged in any order.
Tests: the new test passes for all 24 locales; with the locale change reverted, 20 cases fail.
Type of change
Checklist
make pre-commitand confirm it didn't generate any warnings/changesmake testand I confirm all tests passed locallydocs/folder