fix: require HTTPS for Redmine URL

Config.validate() now rejects REDMINE_URL values whose scheme is not
HTTPS (http://, missing scheme, or any other scheme). The API key is
sent in request headers, so a plain-HTTP endpoint would expose it.
Scheme comparison is case-insensitive per RFC 3986.

Closes #54
This commit is contained in:
Кокос Артем Николаевич
2026-07-17 12:48:45 +07:00
parent 594db90227
commit a1febd6999
3 changed files with 58 additions and 1 deletions

View File

@@ -398,8 +398,14 @@ class Config:
@classmethod
def validate(cls) -> None:
if not cls.get_redmine_url():
url = cls.get_redmine_url()
if not url:
raise ValueError("REDMINE_URL is required (set via env or .env)")
if not url.lower().startswith("https://"):
raise ValueError(
"REDMINE_URL must use HTTPS: the API key is sent in request "
"headers and requires TLS"
)
if cls.get_redmine_api_key():
return
if not (cls.get_redmine_user() and cls.get_redmine_password()):