-
Notifications
You must be signed in to change notification settings - Fork 696
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
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? |
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.
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.
Clarified in ef98aa0. Let me know if this doesn't address your concern.
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.
Sorry, but why would it not be available under test? Is something deleting it?
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.
2b1214c has a green check. I'll turn it into a PR, but we don't need to get it into 2.12.
If I had to guess, if it was failing earlier possibly because the path was relative, but now that you changed it to an absolute path, it works?
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. |
ac79d45
to
bda09ec
Compare
As of e50ead6:
|
bda09ec
to
7bbc6ad
Compare
…age from error to warning ---primarily to avoid triggering OSSEC alerts.
7bbc6ad
to
e50ead6
Compare
CR addressed via inline docs.
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.
Change and test plan LGTM - this should likely have an additional test case but that can happen via a subsequent PR.
This operation should never fail because the i18n.json file is shipped with the package and always present. Possibly the rationale of needing it for tests no longer applies since the path is now absolute and not relative to the current working directory. See <#7443 (comment)>.
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}
?Do we want an error to be logged and an OSSEC alert to be sent in this case?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: