You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tooling.apache.org by "andrewmusselman (via GitHub)" <gi...@apache.org> on 2026/02/25 18:54:45 UTC
[I] Vote content fields lack length and content validation (tooling-trusted-releases)
andrewmusselman opened a new issue, #776:
URL: https://github.com/apache/tooling-trusted-releases/issues/776
**Source:** ASVS 2.2.1 Finding MEDIUM-003
**CWE:** CWE-20 (Improper Input Validation)
**Locations:**
- `atr/shared/vote.py` — `CastVoteForm`
- `atr/post/voting.py`, lines 95–105
#### Description
Vote comments, email bodies, and resolution text are accepted without length limits. Oversized content could cause email delivery failures, storage exhaustion, or abuse of mailing list archives.
#### Recommendation
- Add `max_length` constraints to vote comment fields (e.g., 5,000 characters)
- Add length limits to email body generation (e.g., 50,000 characters)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For additional commands, e-mail: dev-help@tooling.apache.org
Re: [I] Vote content fields lack length and content validation (tooling-trusted-releases)
Posted by "alitheg (via GitHub)" <gi...@apache.org>.
alitheg commented on issue #776:
URL: https://github.com/apache/tooling-trusted-releases/issues/776#issuecomment-4160976985
This is now waiting for the server-side session work from @sbp as we will store these there instead of a separate cache.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For additional commands, e-mail: dev-help@tooling.apache.org
Re: [I] Vote content fields lack length and content validation (tooling-trusted-releases)
Posted by "dave2wave (via GitHub)" <gi...@apache.org>.
dave2wave commented on issue #776:
URL: https://github.com/apache/tooling-trusted-releases/issues/776#issuecomment-4048861863
I think that we can allow larger bodies. Let's set these limits to:
- 50,000 for comments.
- 100,000 for email bodies.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For additional commands, e-mail: dev-help@tooling.apache.org
Re: [I] Vote content fields lack length and content validation (tooling-trusted-releases)
Posted by "alitheg (via GitHub)" <gi...@apache.org>.
alitheg commented on issue #776:
URL: https://github.com/apache/tooling-trusted-releases/issues/776#issuecomment-4054814957
This has exposed another issue I'm working on now - error messages are returned as quart flashes, and they include the full field input. So for a large invalid field, the session (which is where the flash lives) becomes too large for the Cookie Header.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For additional commands, e-mail: dev-help@tooling.apache.org
Re: [I] Vote content fields lack length and content validation (tooling-trusted-releases)
Posted by "alitheg (via GitHub)" <gi...@apache.org>.
alitheg commented on issue #776:
URL: https://github.com/apache/tooling-trusted-releases/issues/776#issuecomment-4055347538
@sbp Interesting - I can do something to stop this, for example not sending the values or truncating them, but it looks like we use the flash data to repopulate the form, so for large values like this that would mean we don't have the user's original data to repopulate.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For additional commands, e-mail: dev-help@tooling.apache.org
Re: [I] Vote content fields lack length and content validation (tooling-trusted-releases)
Posted by "alitheg (via GitHub)" <gi...@apache.org>.
alitheg commented on issue #776:
URL: https://github.com/apache/tooling-trusted-releases/issues/776#issuecomment-4085413920
I have a PR (#894) for review and merge tomorrow.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For additional commands, e-mail: dev-help@tooling.apache.org
Re: [I] Vote content fields lack length and content validation (tooling-trusted-releases)
Posted by "dave2wave (via GitHub)" <gi...@apache.org>.
dave2wave commented on issue #776:
URL: https://github.com/apache/tooling-trusted-releases/issues/776#issuecomment-4084953609
@alitheg is this complete?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For additional commands, e-mail: dev-help@tooling.apache.org
Re: [I] Vote content fields lack length and content validation (tooling-trusted-releases)
Posted by "dave2wave (via GitHub)" <gi...@apache.org>.
dave2wave commented on issue #776:
URL: https://github.com/apache/tooling-trusted-releases/issues/776#issuecomment-4063497893
I asked ChatGPT and received the following advice:
Yep — with Quart forms plus `flash`, there are **two different size traps** that tend to get mixed together:
1. **Request/form parsing limits**
2. **Session cookie size limits from `flash()`**
If you have a big `<textarea>`, both can bite you.
## 1) Big textarea post body: raise the request/form limits
Quart limits request body size with `MAX_CONTENT_LENGTH`. Its docs note the default is **16 MB**, and requests larger than that can trigger **413 Request Entity Too Large**. ([GitHub][1])
If your form is `multipart/form-data`, modern Flask/Werkzeug also distinguish:
* **MAX_FORM_MEMORY_SIZE**: max size of any non-file field in multipart form data, default **500,000 bytes**
* **MAX_FORM_PARTS**: max number of multipart fields, default **1,000** ([Flask Documentation][2])
Quart sits in the same Werkzeug request-parsing world, so these are the knobs to think about when a textarea gets large.
Typical app config:
```python
app.config.update(
MAX_CONTENT_LENGTH=8 * 1024 * 1024, # 8 MiB total request body
MAX_FORM_MEMORY_SIZE=2 * 1024 * 1024, # 2 MiB per non-file multipart field
MAX_FORM_PARTS=2000,
)
```
### Important gotcha
If your form is a normal POST without file upload, prefer:
```html
<form method="post" enctype="application/x-www-form-urlencoded">
```
or just omit `enctype` entirely.
That avoids multipart parsing entirely for a plain textarea. A lot of “large textarea” pain happens because the form was switched to `multipart/form-data` unnecessarily.
## 2) `flash()` can blow up the session cookie
This one is sneakier.
Flask-style sessions are cookie-based, and cookie size is effectively around **4 KB**; Flask documents `MAX_COOKIE_SIZE` warning defaulting to **4093 bytes**. ([Flask Documentation][2])
So if you do something like:
```python
flash(large_textarea_value)
```
or flash a giant validation error containing the whole submitted text, you can break things even if the POST itself was accepted.
### Rule of thumb
Use `flash()` only for **small status messages**:
```python
flash("Draft saved.", "success")
flash("Description is too long.", "error")
```
Do **not** flash:
* the textarea contents
* giant error details
* serialized form state
* traceback-ish blobs
## Best practice for large text fields
For a big textarea, the safe pattern is:
* increase `MAX_CONTENT_LENGTH` enough for your real use case
* avoid `multipart/form-data` unless uploading files
* keep `flash()` messages tiny
* persist large text server-side, not in session
Example:
```python
app.config["MAX_CONTENT_LENGTH"] = 8 * 1024 * 1024
@app.post("/submit")
async def submit():
form = await request.form
body = form.get("body", "")
if len(body) > 500_000:
flash("Body is too large.", "error")
return redirect(url_for("edit"))
# Save body to DB / file / server-side store
save_text(body)
flash("Content saved.", "success")
return redirect(url_for("edit"))
```
## If you are seeing weird symptoms, they often map like this
* **413 Request Entity Too Large**
usually `MAX_CONTENT_LENGTH`, or multipart field limits
* **Flash message disappears / redirect behaves oddly / session issues / cookie warnings**
usually oversized session cookie from `flash()` or other session data
* **Only fails when file upload is present**
likely `multipart/form-data` parsing limits
My hot take: for **really large text blobs**, HTML forms still work, but it’s often cleaner to POST JSON to an endpoint or save drafts incrementally, especially if users may paste multi-hundred-KB content.
If you want, I can show a **minimal Quart patch** for:
* bigger textarea support,
* safe flashing,
* and a custom `413` handler.
[1]: https://github.com/pallets/quart/blob/main/docs/discussion/dos_mitigations.rst?utm_source=chatgpt.com "quart/docs/discussion/dos_mitigations.rst at main · pallets/quart - GitHub"
[2]: https://flask.palletsprojects.com/en/stable/config/?utm_source=chatgpt.com "Configuration Handling — Flask Documentation (3.1.x)"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For additional commands, e-mail: dev-help@tooling.apache.org
Re: [I] Vote content fields lack length and content validation (tooling-trusted-releases)
Posted by "sbp (via GitHub)" <gi...@apache.org>.
sbp commented on issue #776:
URL: https://github.com/apache/tooling-trusted-releases/issues/776#issuecomment-4067918279
In a recent meeting we decided to investigate threading error data through on the server side instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For additional commands, e-mail: dev-help@tooling.apache.org
Re: [I] Vote content fields lack length and content validation (tooling-trusted-releases)
Posted by "alitheg (via GitHub)" <gi...@apache.org>.
alitheg closed issue #776: Vote content fields lack length and content validation
URL: https://github.com/apache/tooling-trusted-releases/issues/776
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For additional commands, e-mail: dev-help@tooling.apache.org