wlc 3.2.0__tar.gz → 3.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. {wlc-3.2.0 → wlc-3.3.0}/CHANGES.md +18 -0
  2. {wlc-3.2.0 → wlc-3.3.0}/PKG-INFO +1 -1
  3. {wlc-3.2.0 → wlc-3.3.0}/SECURITY.md +14 -2
  4. {wlc-3.2.0 → wlc-3.3.0}/THREAT_MODEL.md +23 -9
  5. {wlc-3.2.0 → wlc-3.3.0}/pyproject.toml +4 -4
  6. {wlc-3.2.0 → wlc-3.3.0}/tests/test_base.py +13 -0
  7. {wlc-3.2.0 → wlc-3.3.0}/tests/test_client.py +18 -6
  8. {wlc-3.2.0 → wlc-3.3.0}/tests/test_config.py +38 -1
  9. wlc-3.3.0/tests/test_config_discovery.py +531 -0
  10. {wlc-3.2.0 → wlc-3.3.0}/tests/test_errors.py +51 -7
  11. {wlc-3.2.0 → wlc-3.3.0}/tests/test_urls.py +72 -0
  12. {wlc-3.2.0 → wlc-3.3.0}/wlc/base.py +4 -4
  13. {wlc-3.2.0 → wlc-3.3.0}/wlc/client.py +28 -18
  14. {wlc-3.2.0 → wlc-3.3.0}/wlc/config.py +225 -35
  15. {wlc-3.2.0 → wlc-3.3.0}/wlc/const.py +1 -1
  16. {wlc-3.2.0 → wlc-3.3.0}/wlc/main.py +10 -2
  17. {wlc-3.2.0 → wlc-3.3.0}/wlc.egg-info/PKG-INFO +1 -1
  18. {wlc-3.2.0 → wlc-3.3.0}/wlc.egg-info/SOURCES.txt +1 -0
  19. {wlc-3.2.0 → wlc-3.3.0}/LICENSE +0 -0
  20. {wlc-3.2.0 → wlc-3.3.0}/LICENSES/CC0-1.0.txt +0 -0
  21. {wlc-3.2.0 → wlc-3.3.0}/LICENSES/GPL-3.0-or-later.txt +0 -0
  22. {wlc-3.2.0 → wlc-3.3.0}/MANIFEST.in +0 -0
  23. {wlc-3.2.0 → wlc-3.3.0}/README.md +0 -0
  24. {wlc-3.2.0 → wlc-3.3.0}/completion/wlc +0 -0
  25. {wlc-3.2.0 → wlc-3.3.0}/setup.cfg +0 -0
  26. {wlc-3.2.0 → wlc-3.3.0}/tests/__init__.py +0 -0
  27. {wlc-3.2.0 → wlc-3.3.0}/tests/test_category.py +0 -0
  28. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/.weblate +0 -0
  29. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/categories +0 -0
  30. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/categories-1 +0 -0
  31. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/changes +0 -0
  32. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components +0 -0
  33. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-android +0 -0
  34. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-android-file +0 -0
  35. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-android-file--GET--format=zip +0 -0
  36. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-olderweblate +0 -0
  37. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate +0 -0
  38. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate--DELETE-- +0 -0
  39. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate--PATCH--priority=80 +0 -0
  40. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-changes +0 -0
  41. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-file +0 -0
  42. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-file--GET--format=zip +0 -0
  43. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-lock +0 -0
  44. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-lock--POST--lock=0 +0 -0
  45. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-lock--POST--lock=1 +0 -0
  46. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-lock--POST--lock=false +0 -0
  47. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-lock--POST--lock=true +0 -0
  48. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-repository +0 -0
  49. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-repository--POST--operation=cleanup +0 -0
  50. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-repository--POST--operation=commit +0 -0
  51. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-repository--POST--operation=pull +0 -0
  52. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-repository--POST--operation=push +0 -0
  53. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-repository--POST--operation=reset +0 -0
  54. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-statistics +0 -0
  55. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-statistics--GET--page=2 +0 -0
  56. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-statistics--GET--page=3 +0 -0
  57. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-translations +0 -0
  58. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-translations--GET--page=2 +0 -0
  59. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/components-hello-weblate-translations--POST--language_code=nl_BE +0 -0
  60. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/languages +0 -0
  61. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/languages--GET--page=2 +0 -0
  62. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/languages--GET--page=3 +0 -0
  63. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/languages--POST--code=tst--name=Test-Language--direction=rtl--plural=number=2--formula=n-!=-1 +0 -0
  64. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects +0 -0
  65. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects--POST--name=Hello--slug=hello--web=http---example.com---source_language=name=Malayalam--code=ml +0 -0
  66. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects--POST--name=denied_json--slug=denide_json--web=http---some-weblate-app.com- +0 -0
  67. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects-acl +0 -0
  68. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects-empty +0 -0
  69. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects-empty-components +0 -0
  70. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects-hello +0 -0
  71. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects-hello--DELETE-- +0 -0
  72. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects-hello-categories +0 -0
  73. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects-hello-changes +0 -0
  74. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects-hello-components +0 -0
  75. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects-hello-components--POST--3fcd0ab4 +0 -0
  76. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects-hello-components--POST--c9c26539 +0 -0
  77. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects-hello-languages +0 -0
  78. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects-hello-repository +0 -0
  79. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects-hello-repository--POST--operation=cleanup +0 -0
  80. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects-hello-repository--POST--operation=commit +0 -0
  81. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects-hello-repository--POST--operation=pull +0 -0
  82. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects-hello-repository--POST--operation=push +0 -0
  83. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects-hello-repository--POST--operation=reset +0 -0
  84. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects-hello-statistics +0 -0
  85. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/projects-invalid +0 -0
  86. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations +0 -0
  87. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations--GET--page=2 +0 -0
  88. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations--GET--page=3 +0 -0
  89. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-android-en-units +0 -0
  90. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-android-en-units--POST--key=test-monolingual--value=-test-me- +0 -0
  91. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs +0 -0
  92. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs--DELETE-- +0 -0
  93. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs-changes +0 -0
  94. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs-file +0 -0
  95. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs-file--GET--format=csv +0 -0
  96. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs-file--POST--3748506a +0 -0
  97. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs-file--POST--5c6a101f +0 -0
  98. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs-file--POST--85762547 +0 -0
  99. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs-file--POST--90a4957d +0 -0
  100. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs-file--POST--f8672b4c +0 -0
  101. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs-file--POST--fe040a0c +0 -0
  102. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs-repository +0 -0
  103. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs-repository--POST--operation=cleanup +0 -0
  104. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs-repository--POST--operation=commit +0 -0
  105. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs-repository--POST--operation=pull +0 -0
  106. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs-repository--POST--operation=push +0 -0
  107. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs-repository--POST--operation=reset +0 -0
  108. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs-statistics +0 -0
  109. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs-units +0 -0
  110. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/translations-hello-weblate-cs-units--GET--q=source%3A%3D%22mr%22 +0 -0
  111. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/units +0 -0
  112. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/units-123 +0 -0
  113. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/units-123--DELETE-- +0 -0
  114. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/units-123--PATCH--target=-foo---state=30 +0 -0
  115. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/api/units-123--PUT--target=-foo---state=30 +0 -0
  116. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/mock/project-local-file.pot +0 -0
  117. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/section +0 -0
  118. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/weblate.ini +0 -0
  119. {wlc-3.2.0 → wlc-3.3.0}/tests/test_data/wlc +0 -0
  120. {wlc-3.2.0 → wlc-3.3.0}/tests/test_download.py +0 -0
  121. {wlc-3.2.0 → wlc-3.3.0}/tests/test_insecure_http.py +0 -0
  122. {wlc-3.2.0 → wlc-3.3.0}/tests/test_insecure_ssl.py +0 -0
  123. {wlc-3.2.0 → wlc-3.3.0}/tests/test_lazy_object.py +0 -0
  124. {wlc-3.2.0 → wlc-3.3.0}/tests/test_main.py +0 -0
  125. {wlc-3.2.0 → wlc-3.3.0}/tests/test_output.py +0 -0
  126. {wlc-3.2.0 → wlc-3.3.0}/tests/test_package.py +0 -0
  127. {wlc-3.2.0 → wlc-3.3.0}/tests/test_signatures.py +0 -0
  128. {wlc-3.2.0 → wlc-3.3.0}/tests/test_statistics.py +0 -0
  129. {wlc-3.2.0 → wlc-3.3.0}/tests/test_utils.py +0 -0
  130. {wlc-3.2.0 → wlc-3.3.0}/tests/test_wlc.py +0 -0
  131. {wlc-3.2.0 → wlc-3.3.0}/wl +0 -0
  132. {wlc-3.2.0 → wlc-3.3.0}/wlc/__init__.py +0 -0
  133. {wlc-3.2.0 → wlc-3.3.0}/wlc/exceptions.py +0 -0
  134. {wlc-3.2.0 → wlc-3.3.0}/wlc/http_debug.py +0 -0
  135. {wlc-3.2.0 → wlc-3.3.0}/wlc/models.py +0 -0
  136. {wlc-3.2.0 → wlc-3.3.0}/wlc/output.py +0 -0
  137. {wlc-3.2.0 → wlc-3.3.0}/wlc/py.typed +0 -0
  138. {wlc-3.2.0 → wlc-3.3.0}/wlc/utils.py +0 -0
  139. {wlc-3.2.0 → wlc-3.3.0}/wlc.egg-info/dependency_links.txt +0 -0
  140. {wlc-3.2.0 → wlc-3.3.0}/wlc.egg-info/entry_points.txt +0 -0
  141. {wlc-3.2.0 → wlc-3.3.0}/wlc.egg-info/requires.txt +0 -0
  142. {wlc-3.2.0 → wlc-3.3.0}/wlc.egg-info/top_level.txt +0 -0
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.3.0
4
+
5
+ * Released on 10th November 2026.
6
+ * Bound automatic project configuration discovery to the nearest repository
7
+ root and, on POSIX systems, trusted ownership and permissions, including
8
+ symlink targets.
9
+ * Added `--project-config` to explicitly select project configuration and
10
+ `--no-config` to disable configuration-file loading.
11
+ * Prevented malformed configuration errors from exposing file contents,
12
+ including API keys, in CLI diagnostics and Python exceptions.
13
+ * Reject API keys containing anything other than printable ASCII.
14
+ * Match URL-scoped API keys regardless of whether the default port is explicit,
15
+ while preserving precedence for exact URL matches.
16
+ * Reject Unicode compatibility forms of traversal and URL syntax in object
17
+ paths.
18
+ * Updated the threat model to clarify configuration and credential boundaries.
19
+ * Updated development dependencies, CI actions, and Docker base images.
20
+
3
21
  ## 3.2.0
4
22
 
5
23
  * Released on 3rd November 2026.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wlc
3
- Version: 3.2.0
3
+ Version: 3.3.0
4
4
  Summary: A command-line utility for Weblate, translation tool with tight version control integration
5
5
  Author-email: Michal Čihař <michal@weblate.org>
6
6
  License-Expression: GPL-3.0-or-later
@@ -8,14 +8,26 @@ This file is maintained in https://github.com/WeblateOrg/meta/
8
8
 
9
9
  # Weblate security
10
10
 
11
- If you believe you have found a security vulnerability in a Weblate project,
12
- **do not open a public issue**. Report it privately by emailing
11
+ Report **low and medium severity** security issues in a Weblate project as
12
+ public GitHub issues in the affected repository.
13
+
14
+ For **high and critical severity** vulnerabilities, **do not open a public
15
+ issue**. Report them privately by emailing
13
16
  [security@weblate.org](mailto:security@weblate.org) or selecting
14
17
  **Security → Report a vulnerability** in this repository.
15
18
 
19
+ If you are unsure of the severity, you may start privately. If the security
20
+ team assesses the issue as low or medium severity, we will ask you to continue
21
+ in a public GitHub issue.
22
+
16
23
  Please describe the issue, affected versions, and steps to reproduce it, if
17
24
  known.
18
25
 
26
+ Public discussion allows the community to help review and fix low and medium
27
+ severity issues, while private coordination focuses on vulnerabilities with
28
+ serious impact. We publish security advisories only for high and critical
29
+ severity vulnerabilities, not for low or medium severity issues.
30
+
19
31
  For security scope and assumptions, consult this repository's threat model if
20
32
  it has one, or the [Weblate threat model][threat-model] for the main application.
21
33
  The [security documentation][reporting] explains the full reporting and
@@ -23,7 +23,13 @@ CLI output, or downloaded files.
23
23
  user-selected output paths are trusted instructions. The operating system,
24
24
  runtime, installed package, and these trusted sources are assumed intact.
25
25
  - **Checked-out repository:** Automatic discovery loads user configuration and
26
- then the nearest project configuration in the current directory or a parent.
26
+ then the nearest eligible project configuration in the current directory or
27
+ a parent, stopping at the nearest repository root. On POSIX systems discovery
28
+ also stops at directories owned by another non-root user or writable by
29
+ everyone; discovered files must meet the same permission rules. Group-writable
30
+ locations remain trusted. Symlink targets must stay within these discovery
31
+ boundaries. Windows uses repository boundaries without POSIX permission
32
+ checks; access is governed by Windows ACLs.
27
33
  Project configuration is intentionally trusted to select the endpoint,
28
34
  repository defaults, request parameters, and a matching URL-scoped key. It
29
35
  cannot acquire an unrelated unscoped CLI/environment key or supply transport
@@ -44,7 +50,10 @@ CLI output, or downloaded files.
44
50
  validate and escape data for their own use.
45
51
 
46
52
  An explicit `--config` loads only the named file and disables user and project
47
- configuration discovery; CLI/environment overrides still apply. Direct
53
+ configuration discovery. `--project-config` loads user configuration and the
54
+ explicitly selected project file, bypassing discovery location checks while
55
+ retaining project credential and transport restrictions. `--no-config` disables
56
+ all configuration-file loading; CLI/environment overrides still apply. Direct
48
57
  construction of `Weblate` does not discover project configuration. Python
49
58
  callers opt into configuration resolution by passing a `WeblateConfig`.
50
59
 
@@ -55,19 +64,19 @@ See the [configuration documentation][configuration-docs] and
55
64
 
56
65
  ### Configuration and credentials
57
66
 
58
- - When project discovery supplies the otherwise-effective URL, a CLI or
67
+ - When project configuration supplies the otherwise-effective URL, a CLI or
59
68
  environment key must be paired with a URL from the same source: `--key` with
60
69
  `--url`, or `WLC_KEY` with `WLC_URL`. Repository-selected destinations cannot
61
70
  silently receive these unscoped secrets.
62
- - Automatically discovered project configuration cannot enable authenticated
71
+ - Project configuration cannot enable authenticated
63
72
  insecure HTTP, disable TLS verification, or supply insecure origin entries.
64
73
  Transport exceptions require a CLI/environment setting paired with its own
65
- URL, or a matching origin in trusted user or explicit configuration. An
74
+ URL, or a matching origin in trusted user or complete explicit configuration. An
66
75
  unscoped CLI/environment exception cannot be combined with a project URL.
67
76
  - Authentication comes only from configured API-key sources. Automatic
68
77
  `.netrc`/`NETRC` authentication is disabled, URL-embedded credentials are
69
- rejected, and keys containing carriage returns or line feeds are rejected
70
- before HTTP request construction.
78
+ rejected, and keys containing anything other than printable ASCII are
79
+ rejected before HTTP request construction.
71
80
 
72
81
  These rules protect credential sources and transport policy while preserving
73
82
  repository-driven endpoint selection. A key supplied by a repository for its
@@ -137,7 +146,9 @@ Coverage: [download tests](tests/test_download.py).
137
146
  guarantee. Do not put secrets in request parameters.
138
147
 
139
148
  Handled CLI errors also mask exact configured authorization values and
140
- credentials as defense in depth. This does not provide confidentiality against
149
+ credentials as defense in depth. Configuration syntax diagnostics omit file
150
+ contents, including when Python callers format the resulting exception.
151
+ This does not provide confidentiality against
141
152
  the selected server, which already receives the key and can return arbitrary
142
153
  content, including transformed or partial secrets. Successful output and Python
143
154
  results can likewise contain server-provided secrets. A failure of exact-value
@@ -165,7 +176,10 @@ Implementation and coverage: [output implementation](wlc/output.py),
165
176
  the installed CLI.
166
177
  - **Repository and server selection:** Review project configuration before
167
178
  relying on its endpoint and defaults; use a trusted explicit `--config` to
168
- disable discovery. A CLI or environment URL can still use a matching key from
179
+ replace discovery or `--no-config` to avoid file loading. Discovery checks do
180
+ not secure a namespace being concurrently replaced, evaluate additional ACL
181
+ grants, or protect against members of a trusted writable group. A CLI or
182
+ environment URL can still use a matching key from
169
183
  discovered project configuration; supply a trusted key explicitly when its
170
184
  identity matters. Do not commit valuable keys to project configuration.
171
185
  Choose a server appropriate for the data and operations sent to it. Server
@@ -13,7 +13,7 @@ lint = [
13
13
  { include-group = "pylint" }
14
14
  ]
15
15
  pre-commit = [
16
- "prek==0.5.9"
16
+ "prek==0.5.10"
17
17
  ]
18
18
  pylint = [
19
19
  "pylint==4.1.3"
@@ -25,10 +25,10 @@ test = [
25
25
  "responses==0.26.3"
26
26
  ]
27
27
  types = [
28
- "ty==0.0.96",
28
+ "ty==0.0.100",
29
29
  "mypy==2.4.1",
30
- "types-pyxdg==0.28.0.20261017",
31
- "types-python-dateutil==2.9.0.20261029",
30
+ "types-pyxdg==0.28.0.20261106",
31
+ "types-python-dateutil==2.9.0.20261104",
32
32
  "types-requests==2.33.0.20261030"
33
33
  ]
34
34
 
@@ -35,6 +35,19 @@ DATA_TEST_BASE = TEST_DATA / "api"
35
35
  TEST_CONFIG = TEST_DATA / "wlc"
36
36
  TEST_SECTION = TEST_DATA / "section"
37
37
  BODY_HASH_THRESHOLD = 100
38
+ CONFIG_PARSE_MARKER = "synthetic-config-secret"
39
+ CONFIG_PARSE_ERRORS = (
40
+ (f"[keys]\n{CONFIG_PARSE_MARKER}\n", "ParsingError at line 2"),
41
+ (f"key = {CONFIG_PARSE_MARKER}\n", "MissingSectionHeaderError at line 1"),
42
+ (
43
+ f"[keys]\n{CONFIG_PARSE_MARKER} = first\n{CONFIG_PARSE_MARKER} = second\n",
44
+ "DuplicateOptionError at line 3",
45
+ ),
46
+ (
47
+ f"[{CONFIG_PARSE_MARKER}]\n[{CONFIG_PARSE_MARKER}]\n",
48
+ "DuplicateSectionError at line 2",
49
+ ),
50
+ )
38
51
 
39
52
 
40
53
  class BufferedStringIO(StringIO):
@@ -296,19 +296,31 @@ class WeblateAuthenticationTest(APITest):
296
296
  obj = Weblate(key="KEY").get_object("acl")
297
297
  self.assertEqual(obj.name, "ACL")
298
298
 
299
- def test_api_key_rejects_line_breaks(self) -> None:
300
- """API keys with line breaks should be rejected without disclosure."""
301
- for line_break in ("\r", "\n"):
302
- with self.subTest(line_break=repr(line_break)):
303
- key = f"invalid-secret{line_break}continuation"
299
+ def test_api_key_rejects_unsafe_characters(self) -> None:
300
+ """API keys unsafe in a header should be rejected without disclosure."""
301
+ for code in (
302
+ *range(0x20), # C0 controls and line breaks
303
+ *range(0x7F, 0xA0), # DEL and C1 controls
304
+ 0xA0, # Encodable as Latin-1, but not ASCII
305
+ 0xE9,
306
+ 0x2028, # Not encodable as Latin-1
307
+ 0x1F511,
308
+ ):
309
+ with self.subTest(code=hex(code)):
310
+ key = f"invalid-secret{chr(code)}continuation"
304
311
  with self.assertRaises(WeblateException) as raised:
305
312
  Weblate(key=key)
306
313
 
307
314
  message = str(raised.exception)
308
- self.assertIn("must not contain", message)
315
+ self.assertIn("printable ASCII", message)
309
316
  self.assertNotIn("invalid-secret", message)
310
317
  self.assertNotIn("continuation", message)
311
318
 
319
+ def test_api_key_accepts_printable_ascii(self) -> None:
320
+ """Every printable ASCII character should remain usable in an API key."""
321
+ key = "".join(chr(code) for code in range(0x20, 0x7F))
322
+ self.assertEqual(Weblate(key=key).key, key)
323
+
312
324
  def assert_netrc_authentication_is_ignored(self) -> None:
313
325
  """Assert netrc credentials are not added or used over an API token."""
314
326
  for key, expected in (("", None), ("KEY", "Token KEY")):
@@ -5,14 +5,18 @@
5
5
  """Configuration parsing tests."""
6
6
 
7
7
  import os
8
+ from configparser import Error as ConfigParserError
8
9
  from pathlib import Path
9
10
  from tempfile import TemporaryDirectory
11
+ from traceback import format_exception
10
12
  from unittest import TestCase
11
13
  from unittest.mock import patch
12
14
 
13
15
  import wlc
14
16
  from wlc.config import WeblateConfig, WLCConfigurationError
15
17
 
18
+ from .test_base import CONFIG_PARSE_ERRORS, CONFIG_PARSE_MARKER
19
+
16
20
  TEST_DATA = Path(__file__).parent / "test_data"
17
21
  TEST_CONFIG = TEST_DATA / "wlc"
18
22
 
@@ -77,7 +81,7 @@ class WeblateConfigTestCase(TestCase):
77
81
  """Project discovery terminates at the filesystem root."""
78
82
  with (
79
83
  patch("wlc.config.Path.cwd", return_value=Path(Path.cwd().anchor)),
80
- patch.object(Path, "is_file", return_value=False),
84
+ patch.object(WeblateConfig, "_project_stat", return_value=None),
81
85
  ):
82
86
  self.assertIsNone(WeblateConfig.find_project_config())
83
87
 
@@ -86,6 +90,39 @@ class WeblateConfigTestCase(TestCase):
86
90
  config = WeblateConfig()
87
91
  config.load(TEST_CONFIG)
88
92
 
93
+ def test_malformed_config_hides_contents(self) -> None:
94
+ """Parser failures omit secrets even in formatted library tracebacks."""
95
+ for content, detail in CONFIG_PARSE_ERRORS:
96
+ with self.subTest(content=content), TemporaryDirectory() as tmpdirname:
97
+ path = Path(tmpdirname) / "invalid.ini"
98
+ path.write_text(content, encoding="utf-8")
99
+ with self.assertRaises(WLCConfigurationError) as raised:
100
+ WeblateConfig().load(path)
101
+ self.assertEqual(
102
+ str(raised.exception),
103
+ f"Invalid configuration file: {path} ({detail})",
104
+ )
105
+ self.assertNotIn(
106
+ CONFIG_PARSE_MARKER, "".join(format_exception(raised.exception))
107
+ )
108
+
109
+ def test_config_parser_error_without_line(self) -> None:
110
+ """Parser errors without location metadata still omit their raw message."""
111
+ with (
112
+ patch(
113
+ "wlc.config.RawConfigParser.read",
114
+ side_effect=ConfigParserError("synthetic-config-secret"),
115
+ ),
116
+ self.assertRaises(WLCConfigurationError) as raised,
117
+ ):
118
+ WeblateConfig().load("invalid.ini")
119
+ self.assertEqual(
120
+ str(raised.exception), "Invalid configuration file: invalid.ini (Error)"
121
+ )
122
+ self.assertNotIn(
123
+ "synthetic-config-secret", "".join(format_exception(raised.exception))
124
+ )
125
+
89
126
  def test_deprecated_raises_error(self) -> None:
90
127
  """Deprecated configuration parsing raises error."""
91
128
  config = WeblateConfig(section="withkey")