Skip to content

Make sure color value is stripped when creating label - #887

Open
marmarta wants to merge 1 commit into
QubesOS:mainfrom
marmarta:bugfix11116
Open

marmarta wants to merge 1 commit into
QubesOS:mainfrom
marmarta:bugfix11116

Conversation

@marmarta

Copy link
Copy Markdown
Member

Currently validating function checks stripped value for correctness but then just discards it. Let's use a stripped value to avoid stray characters.
Also removed reference to a ticket that is no longer relevant in the context.

content notice: debugging was assisted by qwen 3.8 large language model; no code in this PR was generated by an llm

fixes QubesOS/qubes-issues#11116

Currently validating function checks stripped value for correctness but
then just discards it. Let's use a stripped value to avoid stray
characters.
Also removed reference to a ticket that is no longer relevant in the
context.

fixes QubesOS/qubes-issues#11116
@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.75%. Comparing base (66ca68a) to head (8b73ea5).
⚠️ Report is 125 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #887      +/-   ##
==========================================
+ Coverage   70.42%   70.75%   +0.33%     
==========================================
  Files          61       61              
  Lines       14128    14360     +232     
==========================================
+ Hits         9950    10161     +211     
- Misses       4178     4199      +21     
Flag Coverage Δ
unittests 70.75% <100.00%> (+0.33%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ben-grande ben-grande left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see now, on the issue, I did the debugging steps on R4.3 instead of R4.4, cause I thought you were at that version.

I don't think the validation should be responsible for providing the value in most cases, but on this specific function, it is sanitization (decode to ASCII) plus validation, so I think it is fine.

Comment thread qubes/utils.py


def validate_label_value(untrusted_label_value) -> None:
def validate_label_value(untrusted_label_value) -> str:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe there shouldn't be a .strip() below, other checks below would detect that \n is not hexdigit, and the length would not match also.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And please provide a test for a color value ending with a newline char.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API allowed me to create a label with a newline in the color

2 participants