Bug 201189 - results.webkit.org: Sanitize all commit arguments on upload
Summary: results.webkit.org: Sanitize all commit arguments on upload
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jonathan Bedard
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-08-27 11:06 PDT by Jonathan Bedard
Modified: 2019-08-28 08:45 PDT (History)
3 users (show)

See Also:


Attachments
Patch (3.26 KB, patch)
2019-08-27 11:10 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (3.58 KB, patch)
2019-08-27 11:39 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (4.34 KB, patch)
2019-08-27 14:47 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (5.27 KB, patch)
2019-08-27 15:56 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (5.25 KB, patch)
2019-08-27 16:09 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (5.95 KB, patch)
2019-08-27 17:08 PDT, Jonathan Bedard
commit-queue: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from webkit-cq-03 for mac-highsierra (3.32 MB, application/zip)
2019-08-27 17:54 PDT, WebKit Commit Bot
no flags Details
Archive of layout-test-results from webkit-cq-03 for mac-highsierra (3.20 MB, application/zip)
2019-08-28 08:34 PDT, WebKit Commit Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Bedard 2019-08-27 11:06:54 PDT
Repository ids, branches and commit ids have a very specific set of allowed values. Rather than permit any string to be uploaded, restrict these values to the valid ones.
Comment 1 Jonathan Bedard 2019-08-27 11:07:26 PDT
<rdar://problem/54564837>
Comment 2 Jonathan Bedard 2019-08-27 11:10:59 PDT
Created attachment 377354 [details]
Patch
Comment 3 Jonathan Bedard 2019-08-27 11:39:20 PDT
Created attachment 377359 [details]
Patch
Comment 4 Jonathan Bedard 2019-08-27 14:47:12 PDT
Created attachment 377388 [details]
Patch
Comment 5 Aakash Jain 2019-08-27 15:01:06 PDT
View in context: https://bugs.webkit.org/attachment.cgi?id=377354&action=review

> Tools/ChangeLog:13
> +        repostiroy_id, branch or commit id are rejected.

Nit: typo repostiroy_id

> Tools/resultsdbpy/resultsdbpy/controller/commit.py:58
> +            raise ValueError(f'{self.branch} is an invalid branch')

Nit: 'invalid branch' => 'invalid branch name'. We don't know if the branch is invalid, the 'branch name' is invalid. 

Curious, can branch name contain unicode characters?

> Tools/resultsdbpy/resultsdbpy/controller/commit.py:63
> +            raise ValueError(f'{self.id} is an invalid id')

Nit: 'invalid id' => 'invalid commit id'.

> Tools/resultsdbpy/resultsdbpy/controller/commit_unittest.py:110
> +        with self.assertRaises(ValueError):

Can we test the exact error message as well (e.g.: 'invalid-repo is an invalid repository id').
Comment 6 Jonathan Bedard 2019-08-27 15:17:37 PDT
(In reply to Aakash Jain from comment #5)
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=377354&action=review
> 
> > Tools/ChangeLog:13
> > +        repostiroy_id, branch or commit id are rejected.
> 
> Nit: typo repostiroy_id
> 
> > Tools/resultsdbpy/resultsdbpy/controller/commit.py:58
> > +            raise ValueError(f'{self.branch} is an invalid branch')
> 
> Nit: 'invalid branch' => 'invalid branch name'. We don't know if the branch
> is invalid, the 'branch name' is invalid. 
> 
> Curious, can branch name contain unicode characters?

Even if git allows it, I don't think we should. We can cross this bridge when and if we come to it.

> 
> > Tools/resultsdbpy/resultsdbpy/controller/commit.py:63
> > +            raise ValueError(f'{self.id} is an invalid id')
> 
> Nit: 'invalid id' => 'invalid commit id'.
> 
> > Tools/resultsdbpy/resultsdbpy/controller/commit_unittest.py:110
> > +        with self.assertRaises(ValueError):
> 
> Can we test the exact error message as well (e.g.: 'invalid-repo is an
> invalid repository id').
Comment 7 Jonathan Bedard 2019-08-27 15:56:53 PDT
Created attachment 377395 [details]
Patch
Comment 8 Jonathan Bedard 2019-08-27 16:09:41 PDT
Created attachment 377397 [details]
Patch
Comment 9 Aakash Jain 2019-08-27 16:40:40 PDT
Comment on attachment 377397 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=377397&action=review

> Tools/resultsdbpy/resultsdbpy/controller/commit_unittest.py:102
> +    def assertRaisesWithMessage(self, msg, func, *args, **kwargs):

is this used anywhere?

> Tools/resultsdbpy/resultsdbpy/controller/commit_unittest.py:140
> +        self.assertEqual(str(error.exception), "'<html>1234</html>' is an invalid commit id")

Please add a test-case for checking the max length as well.
Comment 10 Jonathan Bedard 2019-08-27 17:08:44 PDT
Created attachment 377403 [details]
Patch
Comment 11 WebKit Commit Bot 2019-08-27 17:54:02 PDT
Comment on attachment 377403 [details]
Patch

Rejecting attachment 377403 [details] from commit-queue.

New failing tests:
fullscreen/full-screen-request-removed-with-raf.html
Full output: https://webkit-queues.webkit.org/results/12975101
Comment 12 WebKit Commit Bot 2019-08-27 17:54:04 PDT
Created attachment 377411 [details]
Archive of layout-test-results from webkit-cq-03 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the commit-queue.
Bot: webkit-cq-03  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 13 WebKit Commit Bot 2019-08-28 08:34:17 PDT
Comment on attachment 377403 [details]
Patch

Rejecting attachment 377403 [details] from commit-queue.

New failing tests:
fullscreen/full-screen-request-removed-with-raf.html
Full output: https://webkit-queues.webkit.org/results/12976521
Comment 14 WebKit Commit Bot 2019-08-28 08:34:19 PDT
Created attachment 377443 [details]
Archive of layout-test-results from webkit-cq-03 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the commit-queue.
Bot: webkit-cq-03  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 15 Jonathan Bedard 2019-08-28 08:45:22 PDT
Committed r249200: <https://trac.webkit.org/changeset/249200>