Repository navigation
Commit cf90ddf
committed
fix(ops): Atom 解析改用 defusedxml(bandit B314)
上游状态页的 DeepSeek 解析器用 stdlib `ElementTree.fromstring` 读外部 Atom,
对「十亿笑声 / 实体展开」这类 XXE / DoS 载荷不设防,CI security job 的
bandit 报 B314(Medium)。
- 解析入口换成 `defusedxml.ElementTree.fromstring`(bandit 官方推荐的修法,
比逐处 `# nosec` 或全局 skip B314 更稳:保留规则对新增解析点的保护)
- Element 类型仍复用 stdlib(defusedxml 只是换了安全解析入口)
- 新增用例:XXE 外部实体与十亿笑声载荷都必须抛 ValueError → 由 fetch_source
兜成 unknown 条目,不让外部站点读到本地文件或炸内存
pyproject 新增 defusedxml>=0.7.1(纯 Python,约 25KB)。1 parent 628cd83 commit cf90ddf
4 files changed
Lines changed: 43 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
43 | 50 | | |
44 | 51 | | |
45 | 52 | | |
| |||
508 | 515 | | |
509 | 516 | | |
510 | 517 | | |
511 | | - | |
512 | | - | |
| 518 | + | |
| 519 | + | |
513 | 520 | | |
514 | 521 | | |
515 | 522 | | |
| |||
581 | 588 | | |
582 | 589 | | |
583 | 590 | | |
584 | | - | |
| 591 | + | |
585 | 592 | | |
586 | 593 | | |
587 | 594 | | |
588 | 595 | | |
589 | 596 | | |
590 | 597 | | |
591 | 598 | | |
592 | | - | |
| 599 | + | |
593 | 600 | | |
594 | 601 | | |
595 | 602 | | |
596 | 603 | | |
597 | 604 | | |
598 | 605 | | |
599 | | - | |
| 606 | + | |
600 | 607 | | |
601 | 608 | | |
602 | 609 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
496 | 513 | | |
497 | 514 | | |
498 | 515 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments