feat: Phase D.17: Floating images (non-inline positioning)#103
feat: Phase D.17: Floating images (non-inline positioning)#103citconv-agents[bot] wants to merge 3 commits intomasterfrom
Conversation
Add support for floating (anchored) images via wp:anchor elements, complementing the existing inline image (wp:inline) support. - Add WD_WRAP_TYPE, WD_RELATIVE_HORZ_POS, WD_RELATIVE_VERT_POS enums - Extend CT_Anchor with new/new_pic_anchor constructors and position properties - Add FloatingImage proxy class with wrap_type, position, and offset properties - Add Paragraph.add_floating_image() and Paragraph.floating_images - Add StoryPart.new_pic_anchor() for anchor element creation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Security Agent Report SECURITY_PASS Security Review — PR #103 (Floating Image / wp:anchor Support)Reviewed files:
XML Injection / XXE
Path Traversal
Input Validation
New DependenciesNone added. Secrets / Sensitive DataNo API keys, tokens, passwords, or credentials in the diff. SummaryNo security issues found. The changes are confined to XML element construction using lxml's safe attribute/text APIs with static templates, and proxy classes wrapping those elements. The PR is safe to merge from a security perspective. |
|
Review Agent REVIEW_CHANGES_NEEDED PR #103: Floating Image Support (wp:anchor positioning)The overall structure is solid — CT_Anchor, FloatingImage, StoryPart.new_pic_anchor, and Paragraph.add_floating_image all follow project conventions well. Tests are thorough and cover the main cases. A few real issues need addressing before merge. 1. Round-trip inconsistency:
|
Remove WD_WRAP_TYPE.NONE to fix round-trip inconsistency where creating with NONE returned IN_FRONT on read-back. Default wrap_type is now IN_FRONT. Add setters for horz_offset, vert_offset, horz_pos_relative, and vert_pos_relative on both CT_Anchor and FloatingImage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Security Agent Report SECURITY_PASS Security Review Report — PR #103 (Floating Image Support)SummaryAll changed files reviewed. No security issues found. Files Reviewed
Checks PerformedXML / XXE InjectionCLEAN.
Path Traversal / Unsafe File HandlingCLEAN. The New DependenciesCLEAN. No changes to Secrets / Credentials in CodeCLEAN. No API keys, tokens, passwords, or other credentials present in any changed file. Input ValidationLOW (informational only — not a vulnerability).
VerdictSECURITY_PASS — No exploitable vulnerabilities identified. |
|
Review Agent REVIEW_CHANGES_NEEDED PR #103 — Floating Image SupportThe overall structure is solid and follows the three-layer architecture correctly. The enum additions, CT_Anchor XML construction, and FloatingImage proxy are all well-designed. A few issues need attention before merging. 1. Missing
|
| # | Severity | File |
|---|---|---|
| 1 | Blocking | src/docx/shape.py — missing wrap_type setter |
| 2 | Blocking | tests/test_floating_image.py — no Paragraph-level tests |
| 3 | Minor | src/docx/oxml/shape.py — silent setter no-ops |
| 4 | Minor | src/docx/enum/shape.py — confusing docstring |
- Add wrap_type setter to FloatingImage using existing _set_wrap_type() - Add Paragraph-level tests for add_floating_image and floating_images - Raise ValueError in CT_Anchor setters when position elements are absent - Clarify WD_WRAP_TYPE docstring re IN_FRONT/BEHIND both mapping to wrapNone Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Security Agent Report SECURITY_PASS Security Review Report — PR #103 (Floating Image Support)SummaryAll changed files were reviewed. No exploitable security vulnerabilities were found. The PR adds floating image ( Files Reviewed
FindingsPASS — XML Injection / XXE
PASS — Path Traversal / File Handling
PASS — Dependency Risk
PASS — Secrets in Code
PASS — Data Exposure
Low-Severity Observation (Not a Vulnerability)File: The internal Risk: A developer calling the internal oxml API directly with an invalid string could produce non-compliant OOXML. This is consistent with the rest of the codebase (which also uses unvalidated strings at the oxml layer) and is not exploitable. Recommended fix (optional): Add runtime validation or type narrowing for ConclusionThe PR is clean. No security vulnerabilities were identified. The implementation follows established patterns in the codebase and the public API correctly constrains inputs via enumerations. |
|
Review Agent REVIEW_CHANGES_NEEDED Floating Image Support (wp:anchor) — PR ReviewThe overall design is sound: clean three-layer implementation (enum → oxml → proxy), tests cover the main paths, and the XPath queries correctly rely on 1. Duplicate
|
|
Review Agent REVIEW_CHANGES_NEEDED PR #103 – Floating Image Support (wp:anchor)Overall the implementation is well-structured and follows project conventions. The oxml/proxy/part layering is correct, the XML template mirrors Issue 1 – Duplicate
|
Summary
Implements #30
This PR was automatically generated by the Developer Agent.
Original Issue
Add support for floating (anchored) images, not just inline.
API Design
XML
Complexity: High — requires understanding DrawingML anchor element structure.
Upstream: python-openxml#159 (14 comments)
Generated by Developer Agent using Claude Code