The smoke boots the fake Secrets Manager in a container and drives the real binary from the host through a 0600 env file: login, listings, get by name and uuid, failure paths, and a redaction sweep over every captured output. README documents the implemented wire protocol, the library surface keyproxy will call, the verified quickstart, and the config table.
51 lines
1.7 KiB
Go
51 lines
1.7 KiB
Go
// Command fakesm boots the fake Bitwarden Secrets Manager on a plain TCP
|
|
// listener for the smoke script (tests use httptest via fakesm.Server
|
|
// directly). The credential identity below is the published SDK sample;
|
|
// the smoke script configures the CLI with the exact same string, and the
|
|
// organization key is random per boot so the full decrypt chain runs.
|
|
package main
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"encoding/base64"
|
|
"flag"
|
|
"log"
|
|
"time"
|
|
|
|
"git.knownelement.com/ukrrs/mopac-bitwarden-go/internal/fakesm"
|
|
)
|
|
|
|
const smokeCredential = "0.ec2c1d46-6a4b-4751-a310-af9601317f2d.C2IgxjjLF7qSshsbwe8JGcbM075YXw:X8vbvA0bduihIDe/qrzIQQ=="
|
|
|
|
func main() {
|
|
addr := flag.String("addr", ":8600", "listen address")
|
|
flag.Parse()
|
|
tokenKey, err := base64.StdEncoding.DecodeString("X8vbvA0bduihIDe/qrzIQQ==")
|
|
if err != nil || len(tokenKey) != 16 {
|
|
log.Fatal("fakesm: bad token key part")
|
|
}
|
|
orgKey := make([]byte, 64)
|
|
if _, err := rand.Read(orgKey); err != nil {
|
|
log.Fatal("fakesm: entropy")
|
|
}
|
|
s := &fakesm.Server{
|
|
ClientID: "ec2c1d46-6a4b-4751-a310-af9601317f2d",
|
|
ClientSecret: "C2IgxjjLF7qSshsbwe8JGcbM075YXw",
|
|
TokenKey: tokenKey,
|
|
OrgKey: orgKey,
|
|
OrgID: "3fb1c0de-0000-4000-8000-000000000000",
|
|
TokenTTL: time.Hour,
|
|
Projects: []fakesm.Project{
|
|
{ID: "ac1d0000-0000-4000-8000-000000000001", Name: "harness"},
|
|
},
|
|
Secrets: []fakesm.Secret{
|
|
{ID: "5ec1e700-0000-4000-8000-00000000000a", Name: "smoke-redmine-key", Value: "smoke-redmine-value-0123456789abcdef"},
|
|
{ID: "5ec1e700-0000-4000-8000-00000000000b", Name: "smoke-litellm-key", Value: "smoke-litellm-value-fedcba9876543210"},
|
|
},
|
|
}
|
|
log.Printf("fakesm: listening addr=%s org=%s", *addr, s.OrgID)
|
|
if err := s.ListenAndServe(*addr); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|