-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(validate_locale_configuration
): discard and warn on configured but unsupported locale
#7443
base: develop
Are you sure you want to change the base?
Conversation
…ut unsupported locale If validate_locale_configuration() doesn't check the authoritative list of supported locales in the "i18n.json" file installed by securedrop-app-code, then a language for which support has been revoked won't be disabled until config.SUPPORTED_LOCALES is updated on the next "securedrop-admin {sdconfig,install}" run.
Noting for the record (from way back in 9c11950): |
Clarified out of band with @zenmonkeykstop: We can just close this pull request if we don't care about this disablement case—or defer to v2.13. |
IMO the ideal behavior would be:
Would that be reasonable? Also, I'm not sure where in your plan it was, but can we also disable hi/ro before the rc is cut so that behavior can be QA'd at the same time? |
@@ -29,6 +30,8 @@ | |||
from flask_babel import Babel | |||
from sdconfig import FALLBACK_LOCALE, SecureDropConfig | |||
|
|||
I18N_CONF = "i18n.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use an absolute path please, like Path(__file__).parent / "i18n.json"
with open(I18N_CONF) as i18n_conf_file: | ||
i18n_conf = json.load(i18n_conf_file) | ||
supported = parse_locale_set(i18n_conf["supported_locales"].keys()) | ||
except FileNotFoundError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In what case would the file not be found? If i18n.json is missing, that feels like a fatal error to me.
I agree with @legoktm's ideal scenario above, and disabling a removed language on update rather than running If we do decide to go this route, I think adding a short blurb in our docs saying "in the event that you are using a language that is no longer supported, your SecureDrop will disable it during the upgrade process for that release" (or similar). |
Thanks both. Replying to @legoktm in #7443 (comment):
Very reasonable, and I've done some slicing and checklisting here to show what we have currently (checked) and as of this pull request (checked and in bold). Changing from error (with OSSEC alert) to warning (no OSSEC alert) should be a one-line change I'll tack on tomorrow along with responding to your review feedback. |
Status
Ready for review
Description of Changes
Closes #7442: If
validate_locale_configuration()
doesn't check the authoritative list of supported locales in thei18n.json
file installed bysecuredrop-app-code
, then a language for which support has been revoked won't be disabled untilconfig.SUPPORTED_LOCALES
is updated on the nextsecuredrop-admin {sdconfig,install}
run.This isn't a bug; it was simply out of scope of #6557. Now #7442 motivates us to at least consider: Do we want an unsupported language to be disabled immediately on upgrade of
securedrop-app-code
, not just on the nextsecuredrop-admin {sdconfig,install}
? If yes, then this diff handles this case. If not, then we can just close this pull request.Testing
Under
make dev
with:/?l=ro
defaults to en_USDeployment
As above:
securedrop-app-code
, not just on the nextsecuredrop-admin {sdconfig,install}
?Checklist
If you made changes to the server application code:
make lint
) and tests (make test
) pass in the development containerNB. This is already covered at the implementation (as opposed to configuration) level by
test_valid_but_unusable_locales()
.If you made changes to
securedrop-admin
:make -C admin test
) pass in the admin development containerIf you made changes to the system configuration:
If you added or removed a file deployed with the application:
If you made non-trivial code changes:
Choose one of the following: