Security hardening, code cleanup, and dynamic currency list for currency_converter#31
Draft
Security hardening, code cleanup, and dynamic currency list for currency_converter#31
Conversation
Agent-Logs-Url: https://github.com/deefrawley/Flow.Launcher.Plugin.Currency/sessions/5b92f8d4-f8c8-45ff-9854-4a84692bc119 Co-authored-by: deefrawley <18594055+deefrawley@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
deefrawley
May 5, 2026 04:35
View session
Owner
|
@copilot add change for dynamic sourcing of currency types in init |
Agent-Logs-Url: https://github.com/deefrawley/Flow.Launcher.Plugin.Currency/sessions/990ee005-f444-4818-abdb-cec390cdef27 Co-authored-by: deefrawley <18594055+deefrawley@users.noreply.github.com>
Author
Done in e2e9138. |
Copilot
AI
changed the title
Security hardening and code cleanup for currency_converter
Security hardening, code cleanup, and dynamic currency list for currency_converter
May 5, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The rates feed was fetched over plain HTTP with no timeout and no status check before writing to disk, leaving the plugin vulnerable to MITM rate substitution and silent XML corruption on server errors. Additionally, the currency list was hardcoded and could fall out of sync with the ECB's actual published currencies.
Security
ratesURLtimeout=10onrequests.get()— prevents indefinite UI thread blockingr.raise_for_status()before file write — a 4xx/5xx response no longer silently overwrites the cached XML; the existingHTTPErrorhandler catches itDynamic currency list
__init__now buildsself.CURRENCIESfrom the cachedeurofxref-daily.xml— the list stays in sync with the ECB's actual published currencies without any per-keystroke overhead, since the parse happens once at plugin startupCURRENCIESlist is used silently and a warning is loggedCode quality
import decimal"{}".format(attrib)calls inpopulate_rates— XML attribs are already strings[f"{x}" for x in hint]list comprehension with direct", ".join(hint)else: passat end ofquery()sourcerate = 1alongsidedestrateincurrconv— previously an unexpected loop exit would raiseUnboundLocalError