mesh/merge-gate head c9dd07f919a2 merged into trunk 404b4409e70e — pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; every …
mesh/repo-check head c9dd07f919a2 merged into trunk 404b4409e70e — pass: its merge-check.sh passed (run 2)
mesh/delivery delivered
A Servarr app's API key, an indexer's key and a downloader's password are values the provider's
software holds; the pair path made a random value for every consumer of them, sealed it to both ends
and reported success, and the provider refused it. An offer may now say `"credential": {"issued-by":
"outside"}`: SecretFor never makes a value for it, the plan reads such a pair as given or not given
and sends the consumer no credential file until a person gives it, without refusing its machine;
remakeShared and SharedSecretFor never make a provider's own secret issued outside either.
`secret accept <provider's node> <provider module> <provision>` seals one value to every consumer that
binds the provision from that provider, the provider and the operator, under one generation; the
per-pair form is refused for such a provision, and rotate names the accept. A consumer may wait for a
provision's credential: the controller excuses the wait only when the store bears it out, and its
needs-operator condition names the one accept line.
Adds the replay of issue 164 (TestReplay164), written with only what the controller had before.
47 lines
2.0 KiB
Go
47 lines
2.0 KiB
Go
package catalogue
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// A provision's credential may be one only a person outside the mesh can give (novox/hq ADR 0337 §1, issue 164):
|
|
// the offer says `issued-by: outside` and names neither an own secret nor a tool, and the parser refuses it beside
|
|
// either. An offer that says `software` keeps ADR 0305's shape.
|
|
func TestAnOfferMaySayAPersonOutsideTheMeshIssuesItsCredential(t *testing.T) {
|
|
m, err := ParseManifest([]byte(`{"module":"tv","version":"1",
|
|
"provides":[{"name":"tv-api","scope":"mesh","credential":{"issued-by":"outside"}}],
|
|
"serves":{"tv-api":{"port":8989}}}`))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !m.IssuedOutsideOf("tv-api") {
|
|
t.Fatal("the offer's credential issued outside was not read")
|
|
}
|
|
if m.IssuedOutsideOf("other") {
|
|
t.Fatal("a provision the module does not offer reads as issued outside")
|
|
}
|
|
if _, issued := m.IssuedCredentialOf("tv-api"); issued {
|
|
t.Fatal("a credential issued outside was read as issued by the software")
|
|
}
|
|
if _, shared := m.SharedCredentialOf("tv-api"); shared {
|
|
t.Fatal("a credential issued outside was read as an own secret shared")
|
|
}
|
|
if who, offered := OffersIssuedOutside(map[string]Manifest{"tv": m}, "tv-api"); !offered || who != "tv" {
|
|
t.Fatalf("the catalogue does not say tv offers tv-api issued outside: %q %v", who, offered)
|
|
}
|
|
|
|
for want, raw := range map[string]string{
|
|
"names its own secret": `{"module":"d","version":"1","own-secrets":{"key":{"path":"/p","taken":"at-start"}},
|
|
"provides":[{"name":"d-api","credential":{"issued-by":"outside","own":"key"}}]}`,
|
|
"names the tool": `{"module":"d","version":"1",
|
|
"provides":[{"name":"d-api","credential":{"issued-by":"outside","tool":"d_key"}}]}`,
|
|
"the issuers an offer may name": `{"module":"d","version":"1",
|
|
"provides":[{"name":"d-api","credential":{"issued-by":"a-person"}}]}`,
|
|
} {
|
|
if _, err := ParseManifest([]byte(raw)); err == nil || !strings.Contains(err.Error(), want) {
|
|
t.Errorf("expected a refusal saying %q, got %v", want, err)
|
|
}
|
|
}
|
|
}
|