Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
mat2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tails
mat2
Commits
072ee181
Commit
072ee181
authored
6 years ago
by
Julien (jvoisin) Voisin
Browse files
Options
Downloads
Patches
Plain Diff
Remove defusedxml support and document why
parent
3649c0cc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/implementation_notes.md
+8
-0
8 additions, 0 deletions
doc/implementation_notes.md
libmat2/office.py
+1
-5
1 addition, 5 deletions
libmat2/office.py
with
9 additions
and
5 deletions
doc/implementation_notes.md
+
8
−
0
View file @
072ee181
...
@@ -61,3 +61,11 @@ Images handling
...
@@ -61,3 +61,11 @@ Images handling
When possible, images are handled like PDF: rendered on a surface, then saved
When possible, images are handled like PDF: rendered on a surface, then saved
to the filesystem. This ensures that every metadata is removed.
to the filesystem. This ensures that every metadata is removed.
XML attacks
-----------
Since our thread model conveniently excludes files crafted to specifically
bypass MAT2, fileformats containing harmful XML are out of our scope.
But since MAT2 is using
[
etree
](
https://docs.python.org/3/library/xml.html#xml-vulnerabilities
)
to process XML, it's "only" vulnerable to DoS, and not memory corruption:
odds are that the user will notice that the cleaning didn't succeed.
This diff is collapsed.
Click to expand it.
libmat2/office.py
+
1
−
5
View file @
072ee181
...
@@ -7,11 +7,7 @@ import zipfile
...
@@ -7,11 +7,7 @@ import zipfile
import
logging
import
logging
from
typing
import
Dict
,
Set
,
Pattern
from
typing
import
Dict
,
Set
,
Pattern
try
:
# protect against DoS
import
xml.etree.ElementTree
as
ET
# type: ignore
from
defusedxml
import
ElementTree
as
ET
# type: ignore
except
ImportError
:
import
xml.etree.ElementTree
as
ET
# type: ignore
from
.
import
abstract
,
parser_factory
from
.
import
abstract
,
parser_factory
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment