Send-Document has no job-state check, resurrects canceled jobs and re-prints processing jobs
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 70/100
Hướng nghiên cứu
Bắt đầu tại scheduler/ipp.c ở send_document(), nơi việc tìm job và kiểm tra quyền sở hữu được thực hiện trước, sau đó đọc khối xử lý trạng thái quanh dòng 10273-10295 trước lệnh gọi add_file() gần dòng 10224. Tái hiện chuỗi bốn bước trong issue bằng ipptool, dùng máy in raw test trên cổng 8631. Hoàn thành khi một Send-Document gửi tới job đã bị hủy, đã hoàn tất hoặc đã hủy bỏ (aborted) bị từ chối với lỗi và job vẫn ở trạng thái kết thúc, đồng thời hành vi hiện có đối với stopped và held vẫn vượt qua các bài kiểm tra của scheduler.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
send_document() never checks whether the target job is in a terminal state. A user who owns a job can send a document to a job that has already been canceled, completed, or aborted. CUPS accepts the document, sets the job back to PENDING or HELD, and starts it. A canceled job can therefore be revived with Release-Job; a job that is already being processed can be dragged back to HELD and printed a second time when the hold expires.
Details
scheduler/ipp.c, send_document():
- The job is looked up (
scheduler/ipp.c:10016) and ownership is validated (scheduler/ipp.c:10032). - The document is added to the job with
add_file()atscheduler/ipp.c:10224, unconditionally. - The only state transitions handled are
IPP_JOB_STOPPEDandIPP_JOB_HELD(scheduler/ipp.c:10273-10295).IPP_JOB_CANCELED,IPP_JOB_ABORTEDandIPP_JOB_COMPLETEDare not handled; no error is returned. - On the last document the function sets
start_job = 1(scheduler/ipp.c:10300) and callscupsdCheckJobs()(scheduler/ipp.c:10341-10342), which starts the job. - On a non-last document it sets
job->state = IPP_JOB_HELD,job->hold_until = time(NULL) + MultipleOperationTimeout(scheduler/ipp.c:10310-10312).
The same code is present in CUPS 2.4.20. send_document() needs a check equivalent to if (job->state_value >= IPP_JOB_CANCELED) return IPP_NOT_POSSIBLE; before adding the file.
PoC
Configuration as in the standard cupsd test setup: Listen 127.0.0.1:8631, <Location /> Allow localhost </Location>, one raw printer test.
Sequence and observed wire results:
1. Create-Job (printer-uri=ipp://127.0.0.1:8631/printers/test)
-> successful-ok, job-id=1, job-state=3 (pending)
2. Send-Document (job-id=1, last-document=true, document=raw bytes)
-> successful-ok, job-state=5 (processing) then 9 (completed)
3. Cancel-Job (job-id=1)
-> successful-ok, job-state=7 (canceled)
4. Send-Document (job-id=1, last-document=true, document=raw bytes)
-> successful-ok
Step 4 is the defect: CUPS accepts a document for a job in state 7 and changes its state. With last-document=false it sets the job to HELD (4); a following Release-Job returns successful-ok and the job returns to PROCESSING (6) and prints again.
Same result when the document is sent while the job is already processing:
1. Print-Job (raw document)
-> job-state=5 (processing)
2. Send-Document (job-id=1, last-document=false)
-> successful-ok, job-state=4 (held)
3. Release-Job (job-id=1)
-> successful-ok, job-state=6 (processing)
Request shape for step 4 (ipptool):
{
OPERATION Send-Document
GROUP operation-attributes-tag
ATTR charset attributes-charset utf-8
ATTR language attributes-natural-language en
ATTR uri job-uri ipp://127.0.0.1:8631/jobs/1
ATTR name requesting-user-name attacker
ATTR mimeMediaType document-format application/vnd.cups-raw
ATTR boolean last-document false
FILE /tmp/poc.txt
}
- Ngôn ngữ chính
- C
- Star
- 1.8k
- Fork
- 367
- Merge trung bình
- 1 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 7
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của OpenPrinting/cups
-
OAuth (bearer) quota check denies every user when the allowed-user list is emptyCó thể đã có người làm @RonitMehta08 đã nhận 9 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
OpenPrinting/cups#1795 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
OpenPrinting/cups#1832 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
cupsdGetPrivateAttrs: @ACL never grants access, and @OWNER is looked up as an operating-system group for non-ownersCó thể đã có người làm @user-Param đã nhận 16 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
OpenPrinting/cups#1796 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
OAuth/OIDC token-validation gaps: nonce not enforced when absent, at_hash alg, inbound bearer not signature/aud/exp-validated + unverified email used for authzCó thể làm lại được @michaelrsweet đã nhận 154 ngày trước và không có pull request nào đang mở. Đang mởinvestigating
OpenPrinting/cups#1609 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
OpenPrinting/cups#1572 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của OpenPrinting/cups
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
compiler-explorer/compiler-explorer#9710 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
libsndfile/libsndfile#1238 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
DaveGamble/cJSON#1143 ·