add a new UAPI.16 File Manifest spec (WIP)#213
add a new UAPI.16 File Manifest spec (WIP)#213poettering wants to merge 1 commit intouapi-group:mainfrom
Conversation
|
(mostly posted here to start the discussion) |
54f9001 to
f4a161c
Compare
|
As mentioned elsewhere, it would be great if this could be embedded in existing json manifests, to avoid having to ship multiple ones, and consumers knew how to find it - essentially the existing mkosi manifest. If I understand correctly, the only thing needed for this to work is to establish an optional and well-known "key" under which this object can be found under a parent json object? |
|
Is the intention of this specc to solve this issue, or is this trying to solve a different problem? |
|
@Foxboron Totally different problem, it's designed to replace SHA256SUMS for sysupdate to list remote resources |
|
@daandemeyer Hmm, should the title be |
keszybz
left a comment
There was a problem hiding this comment.
I think it'd be nice to use semantic line breaks here. We agreed in general to do this in new documents.
I'd probably call the other spec an "Inode Spec", since that's more what it is. Or "File System Object" or so. This one here is purely about files. You are absolutely right, this might be confusing, but it will either way I am sure. I am against naming this after the software that likely implements this, it's supposed to be a generic spec, independent of any specific implementation. |
|
Hmm, we could also consider extending this spec to just cover what is requested in #207 too. I mean, if I grok this right it would just mean adding some more fields to encode UNIX inode properties in full: i.e. |
f4a161c to
914c9f6
Compare
|
Posted a new version covering all comments, but not trying to address #207 (would prefer if we did that in a later follow-up PR) |
^^^ ? |
i don't grok this request? it seems to me that the manifest format here could easily be embedded by mkosi's package manifests if it wants file-level information. But that's something to decide and define in mkosi's format, it's not something we could dictate here? |
Having a "suggested" key for the object would allow consumers to know what to search for, without having to come up with one for each case. Just like there's a "suggested" filename for the file in the spec? |
|
I wouldn't merge this into the mkosi manifest but treat it like the SHA256SUMS file mkosi can generate with |
|
Nah it has to be in the same file, at least as an option, as I most definitely do not want to have to deal with having to publish yet another file |
| should also be reflected in the POSIX 'w' access mode bit when storing the data in a regular file on disk. If | ||
| unspecified, defaults to false. | ||
|
|
||
| `valid*USec` is in µs since UNIX epoch UTC, and shall be an unsigned integer. It defines a validity time |
There was a problem hiding this comment.
We can expire individual files this way, but what we really aught to be able to do is expire the entire manifest
There was a problem hiding this comment.
you could just rewrite each entry, no? doing this a 2nd time on the whole manifest seems redundant to me?
There was a problem hiding this comment.
I think the expiration date of an individual file is orthogonal to the expiration date of the manifest.
The manifest should expire to avoid a situation where an attacker serves a stale manifest w/ a stale list of files. Individual files can expire for any additional number of reasons: maybe the file is tied to a TPM secret that self-destructs by a certain deadline. Maybe we expire old versions of the image to make rollbacks harder. Maybe old images expire because we have certificates in there that expire. Really there's any number of reasons to expire an individual file. Point is: you may want to set a different expiration date on the manifest than the individual files
With the scheme you suggest, each time we update the manifest we need to:
- Separately keep a database of how the real expiration dates for each file
- Compute the expiration date of the manifest
- For each file set the expiration date to either the real expiration date or the manifest's expiration date, whichever comes first
So sure it's possible but it's a pain. We'd need separate storage for the real dates, and the manifest becomes less self-descriptive.
|
|
||
| A number of future extensions are envisioned: | ||
|
|
||
| * Inline cryptographic signatures |
There was a problem hiding this comment.
We should have this in the manifest from day 1. Part of what we want to do here is get away from GPG, right?
There was a problem hiding this comment.
Ack. I'm concerned that inline signatures expose a json parser to untrusted, potentially malicious data. To verify signatures, the signatures themselves need to be skipped so this might require some data mangling. Not sure that can be done safe enough in this context.
There was a problem hiding this comment.
Detached signatures aren't too bad though, or? There are alternatives to GPG.
There was a problem hiding this comment.
well, in a way https also can provide authentication. but sure we can look into adding this right-away.
There was a problem hiding this comment.
Detached signatures aren't too bad though, or? There are alternatives to GPG.
Detached signatures suck because they're separate files but need to be updated atomically as a pair. We've encountered issues where the SHA256SUMS and SHA256SUMS.gpg desync for the client, leading to signature check failures.
The leading hypothesis here is that our CDN is deciding to expire one of the files but not the other one, so there's a period of time where you might get a new manifest but an old signature (or vice versa). To fix this correctly, we'd need to figure out how to tell our CDN explicitly to expire both files together and re-fetch them. In practice, we just set a really short cache time-to-live for those two files and let the signature check fail occasionally for an unlucky client. By the time the client retries the update a while later, the files will probably be sync'd up again
If it's just one file, there's no more race condition to worry about
in a way https also can provide authentication
Not nearly enough for our security model, though! An attacker could totally put sysupdate drop-ins in /run to point it at their own domain, which can use HTTPS without issue, and none of this would be measurable. The manifest must be validated against certificates that are measured into the TPM
Sorry I'm not groking how you can avoid this. Anyway, this isn't "yet another file" to publish since it'll replace SHA256SUMS |
| { | ||
| "mediaType" : "application/vnd.uapi.manifest", | ||
| "files" : [ | ||
| { | ||
| "name" : "FooOS.raw", | ||
| "dataEncoding": "gzip", | ||
| "encodedDataSize": 5642649603, | ||
| "dataSize" : 7523532800, | ||
| "sha256" : "922a9bae0e02b4ffac3e5ed5054230d0689b9c2e25b0178ba82b925f2a0c3e48", | ||
| "validBeforeUSec" : 1776856773123234 | ||
| }, | ||
| { | ||
| "name" : "FooOS_esp.raw", | ||
| "dataFile" : "FooOS.raw", | ||
| "dataEncoding": "gzip", | ||
| "encodedDataSize": 5642649603, | ||
| "dataSize" : 7523532800, | ||
| "sliceOffset" : 2097152, | ||
| "sliceSize" : 149175808, | ||
| "gptLabel" : "EFI System Partition", | ||
| "gptTypeUuid" : "c12a7328-f81f-11d2-ba4b-00a0c93ec93b", | ||
| "sha256" : "5dcfd837a4868550cc61c256d9567a974e32a20985afa9e100b8b96755a20cae", | ||
| "validBeforeUSec" : 1776856773123234 | ||
| }, | ||
| { | ||
| "name" : "FooOS_root.raw", | ||
| "dataFile" : "FooOS.raw", | ||
| "dataEncoding": "gzip", | ||
| "encodedDataSize": 5642649603, | ||
| "dataSize" : 7523532800, | ||
| "sliceOffset" : 351272960, | ||
| "sliceSize" : 234003200, | ||
| "sha256" : "00b70a0813e15f309828d3a36156283cba87576c26755e0b2d4cf0951eff8163", | ||
| "gptLabel" : "FooOS_root", | ||
| "gptTypeUuid": "4f68bce3-e8cd-4db1-96e7-fbcaf984b709", | ||
| "readOnly": true, | ||
| "validBeforeUSec" : 1776856773123234 | ||
| } | ||
| ] | ||
| } |
There was a problem hiding this comment.
Let's say someone wants to use this file to describe an ML dataset that has billions of files. Will that scale?
There was a problem hiding this comment.
cuI guess because you can have links to other files it wouldn't be a problem.
Curious though: can a manifest point to another manifest?
| `sha256` is the SHA256 hash of the specified slice, formatted in 64 hexadecimal characters. Parsers should | ||
| parse this case-insensitively. | ||
|
|
||
| The `gpt*` fields encode fields that we need when placing these resources in a GPT partition table entry. The |
There was a problem hiding this comment.
I am not sure that the gpt* fields belong to the file object. The gpt data of one object can contradict another one and there are not clear rules about how to resolve them.
Maybe is part of the manifest root? Maybe part of a different UAPI 16 Container Manifest spec?
There was a problem hiding this comment.
hmm? not sure i follow? how would they contradict? each other? these are gpt per-partition fields?
The "top-level" build is mkosi, and it's a single mkos build that produces these artifacts. Just like it right now includes extensions DDI metadata in the mkosi manifest, it can also include this metadata.
Well it is, as it's new |
I am not convinced that is necessary. For example, let's say we do something to address #207. The way I see this happen would be that for directories they'd contain an additional |
|
so i wonder if we should maybe fold the stepping stone and revoked thing into a single "updatePolicy" field or so, giving that a revoked item should never be a stepping stone. And given this state is relevant only when using this manifests for sysupdate-style updaters I think it makes sense to make that clear in the name. Hence:
With this we'd have a single field encoding the whole policy, and it would be self-contained inside the file object (which is a property I like very much) |
| "encodedDataSize" : 2011, | ||
| "dataSize" : 4711, | ||
| "dataFile" : "…", | ||
| "dataUrl" : "http://…", |
There was a problem hiding this comment.
For those without CDN budgets, it might be nice to allow specifying multiple URLs and the client can pick an arbitrary one?
No description provided.