asf-tooling opened a new issue, #1115:
URL: https://github.com/apache/tooling-trusted-releases/issues/1115
**ASVS Level(s):** L1
**Description:**
### Summary
Failed PAT validation raises `ASFQuartException` without specifying
errorcode, defaulting to HTTP 500 (Internal Server Error) instead of 401
(Unauthorized). This affects three validation points: invalid PAT hash, user
mismatch, and expired PAT. While verification still occurs correctly on the
backend, API consumers and monitoring systems misinterpret authentication
failures as server errors.
### Details
In `atr/jwtoken.py` at lines 134-143, PAT validation failures raise
exceptions without specifying errorcode=401, resulting in HTTP 500 responses
for authentication failures.
### Recommended Remediation
Add errorcode=401 to all PAT validation exceptions:
```python
raise ASFQuartException('Personal Access Token invalid', errorcode=401) #
for hash mismatch and user mismatch
raise ASFQuartException('Personal Access Token expired', errorcode=401) #
for expiration
```
### Acceptance Criteria
- [ ] All PAT validation failures return HTTP 401
- [ ] API consumers receive correct error codes
- [ ] Monitoring systems correctly identify authentication failures
- [ ] Unit tests verify error codes
### References
- Source reports: L1:7.2.1.md
- Related findings: None
- ASVS sections: 7.2.1
### Priority
Low
---
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]