Skip to content

problem_report: validate key names in ProblemReport.extract_keys - #650

Open
bdrung wants to merge 2 commits into
canonical:mainfrom
bdrung:check-key
Open

bdrung wants to merge 2 commits into
canonical:mainfrom
bdrung:check-key

Conversation

@bdrung

@bdrung bdrung commented Sep 15, 2026

Copy link
Copy Markdown
Member

Apport report files consist of key/value pairs based on the standard RFC822 format, except that Apport uses case sensitive keys. Key names must only contain numbers, letters, '.', '_', and '-'. This is validated in ProblemReport.__setitem__, but not when extracting a report in ProblemReport.extract_keys.

So use _check_problem_report_key in ProblemReport.extract_keys before contructing a path from the key.

Bug: https://launchpad.net/bugs/2167360

Move the check for a valid problem report key to the helper function
`_check_problem_report_key` to make it reusable.
Apport report files consist of key/value pairs based on the standard
RFC822 format, except that Apport uses case sensitive keys. Key names
must only contain numbers, letters, '.', '_', and '-'. This is validated
in `ProblemReport.__setitem__`, but not when extracting a report in
`ProblemReport.extract_keys`.

So use `_check_problem_report_key` in `ProblemReport.extract_keys`
before contructing a path from the key.

Bug: https://launchpad.net/bugs/2167360
@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.46%. Comparing base (d7b9734) to head (24531a0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #650      +/-   ##
==========================================
- Coverage   84.48%   84.46%   -0.02%     
==========================================
  Files         106      106              
  Lines       21038    21049      +11     
  Branches     3184     3186       +2     
==========================================
+ Hits        17773    17780       +7     
  Misses       2795     2795              
- Partials      470      474       +4     

☔ 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.

@Hyask Hyask 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.

Thanks

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.

2 participants