Repository navigation
Fix secret transfer issues between modules - #8358
Conversation
fcdb94b to
1b8c175
Compare
|
Hm, even the Turns out, we can very easily hit this case: #7804 (comment) (and I've pushed a test for it in 1b8c175). We incorrectly assume that if a call is cached (and so This isn't the case in the following scenario (which I do in the test):
This is very fiddly, and I'm not 100% sure what the fix to this looks like. Even if we actually perform the ID load as suggested in #7804 (comment) (using a different dagql server, and correctly mock a fake client so that we can actually correctly load the secret into Client 5, we hit the issue that Another option (this one might work 🎉), could be to have a However, it feels to me that if we want to solve the general caching for #7428, we're going to need to make Gonna have a bit more of a think about this, I'm leaning towards the final option, since I think we're gonna need to do it anyways one day. |
1b8c175 to
fc61581
Compare
Signed-off-by: Justin Chadwell <[email protected]>
This turns out to be very easy to implement, with our new worker setup - we just write a special meta file to record this. We also need to disable dagql-level caching of function calls, which is sad, but we need more complex logic to handle the secret transfers, and if we keep this enabled, then we have no-where to put it.
This is fiddly. I don't really have any good ideas for how we would even do this - so deferred this to some generic point in the future. |
fc61581 to
5203522
Compare
There was a problem hiding this comment.
LGTM (just some nit pick comments), thanks for tracking all this down while I was away!
Another option (this one might work 🎉), could be to have a Call additionally return the client ID that it actually used. This is neat, because now when we cached, we would ignore the randomly generated ID for Client 5, and could instead get the ID of Client 4 and load secrets from there. This still doesn't solve the generalized caching of function calls #7428, but gets us over this hurdle temporarily.
Nice, I like that idea a lot! As for the longer term problem with function caching, SetSecret indeed is a known thorn that will pop up with all of that. Users will just have to mark functions that make SetSecret calls as uncached.
- In the somewhat longer-term I think we'll just end up implementing secret providers (there's an issue for this somewhere, I can't find it rn though), which will allow us to deprecate the nasty side-effectful
SetSecretand replace it with something more interoperable with caching and just generally more comprehensible to work with.
e6ade01 to
6ad7af7
Compare
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
This PR contains a few fixes, extracted out of #8149, and others.
Added two changelogs, since there are two distinct fixes here, but not worth splitting them out into separate PRs, since they're both part of the same effort here 😆
Both issues were introduced in #7804.
There's a rather nasty bug with
// +privatefields (and the equivalent in python/typescript). If an ID is stored in there, we have no way of knowing it's there.As discussed in discord, it's not feasible to expose each private field to the API - there may be data in there that cannot be exposed to the API (e.g. today maps are a big case), but there may definitely be others. For backwards-compat reasons, it's probably way too much effort to try and expose the structure of those private fields - we've made our bed, now we have to lie in it.
This PR is a draft idea to do a "best-effort" detection - we look through the returned JSON objects, and scan for things that look enough like IDs - then we try and grab secrets and sockets from there. This resolves the issue, but I'm also not entirely convinced it's the right approach - it feels very hacky, and I'm somewhat worried we might misinterpret something as an ID when it shouldn't be.
Some alternative ideas I've considered (ranging from worse->better, easier->harder):
id:- this hopefully reduces false positives, but also strings could legitimately have this prefix.{ "_dagger.id": "<id>" }. Again, we're just reducing false positives, modules could definitely still produce these.Also, we have a caching bug, described in more detail here, which we also fix here as well.