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

Fix missing input validation for needle API endpoints #4985

Merged
merged 2 commits into from Jan 23, 2023

Conversation

kraih
Copy link
Member

@kraih kraih commented Jan 23, 2023

This gets rid of:

[2023-01-21T22:04:08.897649Z] [error] [bXpoFGyR3PEg] DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::Pg::st execute failed: ERROR:  invalid input syntax for type bigint: "root-console-20200501"
CONTEXT:  unnamed portal parameter $1 = '...' [for Statement "SELECT me.id, me.dir_id, me.filename, me.last_seen_time, me.last_seen_module_id, me.last_matched_time, me.last_matched_module_id, me.last_updated, me.file_present, me.tags, me.t_created, me.t_updated FROM needles me WHERE ( me.id = ? )" with ParamValues: 1='root-console-20200501'] at /usr/share/openqa/script/../lib/OpenQA/WebAPI/Controller/File.pm line 65

Which can happen when someone accidentally requests GET /needles/root-console-20200501/image.

Progress: https://progress.opensuse.org/issues/123490

@kraih
Copy link
Member Author

kraih commented Jan 23, 2023

I've also cleaned up the Mojolicious::Static use in the controller a bit. That file could use some more cleaning though.

This avoids cases where the instance is accidentally recreated, or not
created at all.
@codecov
Copy link

codecov bot commented Jan 23, 2023

Codecov Report

Merging #4985 (68440d6) into master (bcd646c) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #4985   +/-   ##
=======================================
  Coverage   98.17%   98.17%           
=======================================
  Files         379      379           
  Lines       35478    35479    +1     
=======================================
+ Hits        34831    34833    +2     
+ Misses        647      646    -1     
Impacted Files Coverage Δ
lib/OpenQA/WebAPI.pm 97.15% <100.00%> (ø)
lib/OpenQA/WebAPI/Controller/File.pm 97.05% <100.00%> (+0.90%) ⬆️
t/ui/07-file.t 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@mergify mergify bot merged commit b00c126 into master Jan 23, 2023
@mergify mergify bot deleted the k/needles_validation branch January 23, 2023 16:23
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.

None yet

4 participants