Skip to content

Commit 4df7cf3

Browse files
authored
Merge branch 'master' into empty_message
2 parents 0e61536 + 4bffa0c commit 4df7cf3

File tree

13 files changed

+162
-65
lines changed

13 files changed

+162
-65
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
2121
2222
- name: Install uv
23-
uses: astral-sh/setup-uv@v3
23+
uses: astral-sh/setup-uv@v4
2424
with:
2525
version: "0.4.12"
2626
enable-cache: true

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@v4
1717

1818
- name: Install uv
19-
uses: astral-sh/setup-uv@v3
19+
uses: astral-sh/setup-uv@v4
2020
with:
2121
version: "0.4.12"
2222
enable-cache: true

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v4
1515

1616
- name: Install uv
17-
uses: astral-sh/setup-uv@v3
17+
uses: astral-sh/setup-uv@v4
1818
with:
1919
version: "0.4.12"
2020
enable-cache: true

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.0.19 (2024-11-30)
4+
5+
* Don't warn when CRLF is found after last boundary on `MultipartParser` [#193](https://github.com/Kludex/python-multipart/pull/193).
6+
7+
## 0.0.18 (2024-11-28)
8+
9+
* Hard break if found data after last boundary on `MultipartParser` [#189](https://github.com/Kludex/python-multipart/pull/189).
10+
311
## 0.0.17 (2024-10-31)
412

513
* Handle PermissionError in fallback code for old import name [#182](https://github.com/Kludex/python-multipart/pull/182).

SECURITY.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Security Policy
2+
3+
If you think you have identified a security issue with `python-multipart`, **do not open a public issue**.
4+
5+
To responsibly report a security issue, please navigate to the Security tab for the repo and click "Report a vulnerability."
6+
7+
![Screenshot of repo security tab showing "Report a vulnerability" button](https://github.com/encode/.github/raw/master/img/github-demos-private-vulnerability-reporting.png)
8+
9+
Be sure to include as much detail as necessary in your report. As with reporting normal issues, a minimal reproducible example will help the maintainers address the issue faster.
10+
11+
Thank you.

docs/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ def simple_app(environ, start_response):
1616

1717
# The following two callbacks just append the name to the return value.
1818
def on_field(field):
19-
ret.append(b"Parsed field named: %s" % (field.field_name,))
19+
ret.append(b"Parsed value parameter named: %s" % (field.field_name,))
2020

2121
def on_file(file):
22-
ret.append(b"Parsed file named: %s" % (file.field_name,))
22+
ret.append(b"Parsed file parameter named: %s" % (file.field_name,))
2323

2424
# Create headers object. We need to convert from WSGI to the actual
2525
# name of the header, since this library does not assume that you are
@@ -55,7 +55,7 @@ Date: Sun, 07 Apr 2013 01:40:52 GMT
5555
Server: WSGIServer/0.1 Python/2.7.3
5656
Content-type: text/plain
5757

58-
Parsed field named: foo
58+
Parsed value parameter named: foo
5959
```
6060

6161
For a more in-depth example showing how the various parts fit together, check out the next section.

noxfile.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ def rename(session: nox.Session, editable: bool) -> None:
1414
assert "import python_multipart" not in session.run("python", "-c", "import multipart", silent=True)
1515

1616
assert "import python_multipart" in session.run("python", "-Wdefault", "-c", "import multipart", silent=True)
17-
assert "import python_multipart" in session.run("python", "-Wdefault", "-c", "import multipart.exceptions", silent=True)
18-
assert "import python_multipart" in session.run("python", "-Wdefault", "-c", "from multipart import exceptions", silent=True)
17+
assert "import python_multipart" in session.run(
18+
"python", "-Wdefault", "-c", "import multipart.exceptions", silent=True
19+
)
20+
assert "import python_multipart" in session.run(
21+
"python", "-Wdefault", "-c", "from multipart import exceptions", silent=True
22+
)
1923
assert "import python_multipart" in session.run(
2024
"python", "-Wdefault", "-c", "from multipart.exceptions import FormParserError", silent=True
2125
)

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ dev-dependencies = [
4444
"PyYAML==6.0.1",
4545
"invoke==2.2.0",
4646
"pytest-timeout==2.3.1",
47-
"ruff==0.3.4",
47+
"ruff==0.8.0",
4848
"mypy",
4949
"types-PyYAML",
5050
"atheris==2.3.0; python_version != '3.12'",
@@ -122,4 +122,4 @@ exclude_lines = [
122122
]
123123

124124
[tool.check-sdist]
125-
git-only = ["docs", "fuzz", "scripts", "mkdocs.yml", "uv.lock"]
125+
git-only = ["docs", "fuzz", "scripts", "mkdocs.yml", "uv.lock", "SECURITY.md"]

python_multipart/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
__author__ = "Andrew Dunham"
33
__license__ = "Apache"
44
__copyright__ = "Copyright (c) 2012-2013, Andrew Dunham"
5-
__version__ = "0.0.17"
5+
__version__ = "0.0.19"
66

77
from .multipart import (
88
BaseParser,

python_multipart/multipart.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,6 @@ def data_callback(name: CallbackName, end_i: int, remaining: bool = False) -> No
11061106
# Skip leading newlines
11071107
if c == CR or c == LF:
11081108
i += 1
1109-
self.logger.debug("Skipping leading CR/LF at %d", i)
11101109
continue
11111110

11121111
# index is used as in index into our boundary. Set to 0.
@@ -1414,9 +1413,14 @@ def data_callback(name: CallbackName, end_i: int, remaining: bool = False) -> No
14141413
state = MultipartState.END
14151414

14161415
elif state == MultipartState.END:
1417-
# Do nothing and just consume a byte in the end state.
1418-
if c not in (CR, LF):
1419-
self.logger.warning("Consuming a byte '0x%x' in the end state", c) # pragma: no cover
1416+
# Don't do anything if chunk ends with CRLF.
1417+
if c == CR and i + 1 < length and data[i + 1] == LF:
1418+
i += 2
1419+
continue
1420+
# Skip data after the last boundary.
1421+
self.logger.warning("Skipping data after last boundary")
1422+
i = length
1423+
break
14201424

14211425
else: # pragma: no cover (error case)
14221426
# We got into a strange state somehow! Just stop processing.

0 commit comments

Comments
 (0)