Repository navigation
Test that preset text cannot inject a PPD line (OCU-01-008) - #1808
Closed
Dhirenderchoudhary wants to merge 2 commits into
Closed
Dhirenderchoudhary wants to merge 2 commits into
Dhirenderchoudhary wants to merge 2 commits into
Conversation
michaelrsweet
left a comment
Member
There was a problem hiding this comment.
I'm not sure we need a unit test for this specifically, although we could load different IPP attribute files and generate PPDs to test different aspects of PPD creation. However, without the message catalog stuff we aren't actually testing everything that could "go wrong"...
Author
|
@michaelrsweet Master already skips those text preset values, so this PR is just the test so the newline does not come back. If you don't want the test, I can close it. The fix is in the libppd PR. |
Member
|
OK, closing for now but we might circle back... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
7ASecurity audit of OpenPrinting, finding OCU-01-008, WP1/2, Medium.
CUPS and libppd build a local PPD from the IPP attributes of a remote printer when a driverless queue is created. In the audited CUPS tree, unknown
job-presets-supportedmembers were written withippAttributeString()andcupsFilePrintf(fp, "*%s %s\n", member_name, member_value).ippAttributeString()keeps embedded newlines in text and name values, so a preset value could start a new top-level PPD statement.Current master already writes an unknown member only when
ippValidateAttribute()succeeds and the value is a boolean, an integer, or a keyword. This pull request does not change that generator. It adds the regression test the finding asked for, and runs the test from the existingtestppdsuite.The libppd copy of this generator still had the open fallback. That fix is OpenPrinting/libppd#105.
Why
The audited fallback treated an unknown preset member as safe PPD syntax. Master already closed that path. Without a test, a later edit can open it again.
What changed
testppd --preset-injectioncalls_ppdCreateFromIPPwith a preset that hassides=one-sided, aprint-color-modekeyword, and a text value that contains a newline.*Duplex Noneand*print-color-mode monochrome, and must not contain the injected directive.testppdrun, whichmake testalready executes, calls the same check.Scope
No change to the PPD generator.
ippAttributeString()is unchanged. The libppd generator is the other pull request.Blast Radius
testppdwith no arguments now runs one extra check before the existing PPD tests. A failure there makes the suite fail.Verification
./cups/testppd --preset-injectionprintedpreset text newline is not a new PPD directive: PASS (duplex=1 color=1 injected=0)and exited 0../cups/testppd(the suitemakeruns) exited 0, and that same line was PASS.