Cookies took Secure from r.TLS, which is nil behind a proxy that terminates TLS, so sign-in cookies went out without it. Every dashboard cookie now goes through one builder that reads the scheme the way the origin check does. The worktree reset and the agent worker's chown walk use os.Root, so a symlink swapped in mid-walk can't point them outside the worktree. gosec runs in golangci-lint, tests included. G104, G115, G204 and G304 are excluded in config; each remaining finding is fixed or suppressed at the site with its reason.
43 lines
1.3 KiB
Go
43 lines
1.3 KiB
Go
package staterpc
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/samcharles93/archie-core/internal/config"
|
|
)
|
|
|
|
// A provider's credential reference must survive the State Store wire. It is a
|
|
// reference, not a secret: the daemon needs it to resolve the key for a model
|
|
// egress session, and without it every provider arrives credential-less and a
|
|
// run is built with no runtime key at all.
|
|
func TestModelProviderWireCarriesCredentialRef(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
sent := map[string]config.Provider{
|
|
"remote": { //nolint:gosec // G101: env var and secret names, not values.
|
|
Class: "deepseek",
|
|
BaseURL: "https://example.invalid/v1",
|
|
APIKeyEnv: "REMOTE_API_KEY",
|
|
APIKey: config.SecretRef{Engine: "bws", Key: "REMOTE_SECRET"},
|
|
},
|
|
"local": {
|
|
Class: "ollama",
|
|
BaseURL: "http://127.0.0.1:5800/v1",
|
|
},
|
|
}
|
|
|
|
got := map[string]config.Provider{}
|
|
for name, provider := range sent {
|
|
got[name] = modelProviderFromPB(modelProviderToPB(provider))
|
|
}
|
|
|
|
for name, want := range sent {
|
|
if got[name] != want {
|
|
t.Errorf("provider %q round-trip = %+v, want %+v", name, got[name], want)
|
|
}
|
|
}
|
|
if got["remote"].APIKey != (config.SecretRef{Engine: "bws", Key: "REMOTE_SECRET"}) {
|
|
t.Errorf("credential reference was dropped on the wire: %+v", got["remote"].APIKey)
|
|
}
|
|
}
|