Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow qube (template) sending basic OS metadata #578

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

marmarek
Copy link
Member

Save distribution, version and EOL date in features.

Fixes QubesOS/qubes-issues#8725

Comment on lines 44 to 49
safe_set = string.digits + ".-"
untrusted_version = untrusted_features["os-version"]
if all(c in safe_set for c in untrusted_version):
vm.features["os-version"] = untrusted_version
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be required to start with a digit?

if "os-eol" in untrusted_features:
untrusted_eol = untrusted_features["os-eol"]
valid = False
if re.match(r"\d{4}-\d{2}-\d{2}", untrusted_eol):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if re.match(r"\d{4}-\d{2}-\d{2}", untrusted_eol):
if re.match(r"\A\d{4}-\d{2}-\d{2}\Z", untrusted_eol):

don’t allow trailing junk

@@ -34,6 +36,32 @@ async def qubes_features_request(self, vm, event, untrusted_features):
'Ignoring qubes.NotifyTools for template-based VM')
return

if "os-distribution" in untrusted_features:
# entry point already validats values for safe characters
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# entry point already validats values for safe characters
# entry point already validates values for safe characters

@marmarek marmarek force-pushed the distro-metadata branch 2 times, most recently from 1cbdec2 to fa415a8 Compare January 29, 2024 16:15
Copy link

codecov bot commented Jan 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (62f3c3d) 68.39% compared to head (8fbb02b) 68.45%.
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #578      +/-   ##
==========================================
+ Coverage   68.39%   68.45%   +0.06%     
==========================================
  Files          56       56              
  Lines       11159    11181      +22     
==========================================
+ Hits         7632     7654      +22     
  Misses       3527     3527              
Flag Coverage Δ
unittests 68.45% <100.00%> (+0.06%) ⬆️

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

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

Save distribution, version and EOL date in features.

Fixes QubesOS/qubes-issues#8725
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants