require_tls only enforced on RFC 6764 discovery, not on explicit URLs
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 62/100
- Issue 类型
- 文档
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- python
调研方向
阅读require_tls文档以及DAVClient和AsyncDAVClient构造函数的docstring;issue未指定具体文件。明确该选项目前适用于RFC 6764发现,而不适用于显式提供的URL,并且全局强制执行推迟到4.0。完成标准是文档说明的范围与当前行为一致。
由索引模型根据 Issue 内容生成。
描述
require_tls was added together with the .well-known forwarding, as one out of two measures to prevent a man-in-the-middle-attack. However, something went wrong because in the current main the configuration option is not checked anywhere. In the current v3.3.0-dev branch and future v3.3.0-release there is a fix which will honor this variable but only for well-known forwarding. I think this is silly, it should be for all connections.
Now True is and should be the default. If doing this for all connections, it will be a breaking change - so it's procrastinated until the 4.0-release.
I was too lazy to create this issue myself, so below is the initial text from Claude.
⚠️ This issue is AI-generated (Claude Opus 4.8 via Claude Code) on behalf of tobixen ⚠️
Summary
require_tls is named and documented as if it guarantees a TLS-only connection, but it currently only gates the RFC 6764 discovery path. When a fully-qualified URL is passed explicitly, the parameter has no effect.
Current behaviour (v3.3.x)
The parameter is threaded only through discovery:
DAVClient.__init__ / AsyncDAVClient.__init__ → _auto_url(require_tls=...) → discover_caldav(require_tls=...) → discover_service (where d6267c78 closed the well-known-redirect hole).
But _auto_url returns early for any URL containing /, so discovery — and therefore the require_tls check — is skipped entirely. Result:
# require_tls=True is the DEFAULT, yet this connects over plaintext:
DAVClient(url="http://caldav.example.com/dav/", username=..., password=...)
A parameter literally named require_tls does not require TLS for the connection actually made. This is a name/behaviour mismatch and a potential downgrade footgun.
Proposed fix (deferred to 4.0)
Make enforcement global rather than discovery-only:
- Add a shared
BaseDAVClient._enforce_require_tls(url)helper (there is no shared__init__today — the two constructors are separate). - Call it from both
DAVClient.__init__andAsyncDAVClient.__init__right after URL objectification, rejecting non-httpsURLs whenrequire_tls=True. - Update docstrings + CHANGELOG.
Why this is deferred (breaking change)
require_tls defaults to True. Making it global would reject every explicitly-passed http:// URL by default, which breaks real usage:
- The project's own docker integration test servers (Cyrus, SOGo, Baikal, …) are all
http://localhost:PORT/.... - Anyone running an internal/LAN CalDAV server over plain HTTP with default args.
So this changes the default security posture and is a breaking change — appropriate for a major release (4.0), with require_tls=False threaded through the test config.
Out of scope for the constructor check
A constructor-time scheme check does not catch an https → http downgrade via redirect during live requests. If "applies to any connection" is taken literally, the per-request path in each client needs enforcement too — worth tracking separately.
Decision
For now: keep require_tls discovery-only and document the scope precisely (done alongside this issue). Revisit global enforcement in 4.0.
⚠️ This issue is AI-generated (Claude Opus 4.8 via Claude Code) on behalf of tobixen ⚠️
- 主要语言
- Python
- 星标
- 412
- 派生
- 113
- 平均合并
- 8 小时 43 分钟
- 30 天内合并 PR
- 74
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python-caldav/caldav 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 68/100
python-caldav/caldav#844 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
python-caldav/caldav#792 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
python-caldav/caldav#788 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 56/100
python-caldav/caldav#842 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 42/100
python-caldav/caldav#841 · 1 条评论 ·
维护者通常 1 天内回复
查看 python-caldav/caldav 的全部 Issue
相似的 Issue
-
Backend issue lists report in-patch warnings and out-of-patch errors as not publishable可能已有人在做 @RaphaelFakhri 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
mozilla/code-review#3794 ·
维护者通常 1 天内回复
-
[oblt-aw][autodoc] Update docs that still describe the security registry as empty可能已有人在做 @github-actions 今天认领。 未关闭
难度 1/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
[Bug] adb backup script reports "Done" & exits 0 when the backup fails可能已有人在做 @bhattmanthan 今天认领。 未关闭request-issue-assignment
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
agent-ui bug p2
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
correction metadata
难度 1/5 1 小时以内 新手友好度 72/100
acl-org/acl-anthology#10768 · 1 条评论 ·
维护者通常 1 天内回复