Repository navigation
Conversation
|
Heads up! This PR modifies the following files:
|
|
Also, this requires a one-line change to webrender_traits, but I wanted to get some feedback before making a PR for that (just need to change the definition of PipelineId there to match this one.) I'm wondering if there's a way to avoid having to duplicate the PipelineId struct, though. |
f9d7168 to
06e35ff
Compare
|
We should try to share the RNG. Is there a uuid crate we could use for this? Reviewed 3 of 3 files at r1, 2 of 9 files at r2. components/msg/constellation_msg.rs, line 267 [r2] (raw file): components/msg/constellation_msg.rs, line 282 [r2] (raw file): components/msg/constellation_msg.rs, line 309 [r2] (raw file): Comments from Reviewable |
|
There's a uuid crate that we already use in other places in Servo. |
|
☔ The latest upstream changes (presumably #10654) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Just realized a conflict between randomized pipeline ids and repeatability of stress testing: https://github.com/servo/servo/blob/master/components/compositing/constellation.rs#L1859 says "In order to get repeatability, we sort the pipeline ids," which isn't going to work if pipeline ids are unguessable. |
|
@aneeshusa are you planning on picking this back up again? Using uuids as pipeline ids seems like the way to go. We'll lose a bit of test repeatability, but I think we can live with that. |
|
@aneeshusa ping? |
|
Started rebasing this to use the Also @asajeffrey, I definitely agree that we should cache the RNG instance. What's the best place to cache it/way to do that? |
|
It's also possible to use |
|
@aneeshusa where to store the RNG for uuid generation depends on where we're going to do the uuid generation. If it's the constellation, we just need one RNG there, but if we want each pipeline to be able to generate sub-pipelines, we'll need to have an RNG per script thread. |
06e35ff to
10f09a4
Compare
|
Updated. Now requires servo/webrender_traits#56 and servo/webrender#291. I haven't added the caching yet. The RNG instance should be cached in the script thread, but I'm not sure how to easily get a reference to it from the HTMLIFrameElement so it can be used. There is also a usage of fake_root_pipeline_id() in tests/unit/net/http_loader.rs that needs to be removed; I'm not exactly sure how to approach this. |
|
I'll r+ the changes to the dependent crates once @asajeffrey signs off on the design behind this change. |
|
☔ The latest upstream changes (presumably #10225) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Ping? Is this still alive? :) |
This was being kept around for code in devtools/lib.rs, which itself was a TODO. That TODO was fixed in b7de946 in October, allowing this method to be removed as well.
Make PipelineIds unique and unforgeable, enacting a capability security scheme and preventing spoofing. This makes the only way to interact with a pipeline to be given its ID. Previously, PipelineIds were (namespaced) incremented integers, making them easy to generate but lacking the necessary security properties. Now, each pipeline ID is a v4 UUID: an opaque 128 bit random token. They are generated via a cryptographically-secure RNG (OsRng), which provides the key properties of uniqueness and unguessability that together make pipeline IDs unforgeable. Uniqueness can be provided by any RNG with a sufficiently large period, which will stop the same pipeline ID from being generated more than once. However, in order for the RNG output to be unguessable (i.e. an attacker cannot predict the next output based on previous outputs, or reconstruct previous outputs if (part of) the internal RNG state is revealed), the RNG must be cryptographically secure.
10f09a4 to
c01833c
Compare
|
Rebased this and the required PRs; sorry about the delay. I was waiting on some WR changes to be merged and their version bumped in Servo, so I could rebase my bitrotted WR changes, so I could rebase this locally and test it. |
|
☔ The latest upstream changes (presumably #12216) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Sorry about the delay. Only one comment, which is about using Reviewed 3 of 11 files at r3, 9 of 9 files at r6. components/msg/constellation_msg.rs, line 282 [r2] (raw file):
|
|
@asajeffrey I wrote about this in Let me know how I can change the wording to make this more clear, since this is a key part of the design and so I want the reasoning should be easily understood from the comments/commit message. |
|
I don't think we need a cryptographically secure RNG, we just need something to make guessing attacks unlikely. I think |
|
I don't really mind about generating an RNG every time, as pipeline id generation doesn't happen that often. You can rebase, squash, and r=me. |
|
@aneeshusa ping? |
|
I don't have time to finish right now. |
Took a pass at #10542.
Also, we should definitely make the RNG instance once and then cache it, but I'm not sure of the best way to do that. (I could use TLS as was being used for the pipeline namespaces previously, but what's the best place to initialize the RNG?) This is especially important for OsRng because it tried to call getrandom every time
newis called to see if the syscall is supported.This change is