mirror of
https://github.com/hanzoai/iam.git
synced 2026-11-19 18:37:16 +00:00
This repo is public and its LICENSE called the source "confidential and
proprietary ... All rights reserved". Public visibility contradicts
confidentiality, and HIP-0130 puts `iam` in the OSS core tier. The declaration
now matches both.
LICENSE-APACHE and LICENSE-MIT carry the canonical texts, unedited —
LICENSE-APACHE is byte-identical to apache.org/licenses/LICENSE-2.0.txt
(sha256 cfc7749b…, 11358 bytes, blob d645695). LICENSE declares the pair.
LICENSE-MIT carries the copyright line the notice requires.
249 Go files led with `// Copyright 2026 Hanzo AI, Inc. All rights reserved.`
— the classic proprietary reservation, and a per-file contradiction of the new
grant. Each now carries `// SPDX-License-Identifier: MIT OR Apache-2.0`. The
word "confidential" survives untouched in the OIDC sense (confidential client),
which is protocol vocabulary, not a licence claim.
There is nothing else to declare: `go.mod` has no licence field and this repo
ships no Cargo/npm/PyPI manifest.
Relicensing is ours alone to do. The tree is original work, not a fork:
`fork: false` with no parent, its own root commit, and no Casdoor-lineage tag
is an ancestor of `main`. The retired Casdoor fork is `hanzoai/iam-v1`; the
provenance note in LICENSE names it, restoring the vendor name a clean-room
assertion needs in order to say what it is clean of.
Build, vet and all 29 test packages green.
Co-authored-by: Hanzo Dev <[email protected]>
43 lines
1.8 KiB
Go
43 lines
1.8 KiB
Go
// Copyright 2026 Hanzo AI, Inc.
|
|
// SPDX-License-Identifier: MIT OR Apache-2.0
|
|
|
|
package bootstrap
|
|
|
|
import "testing"
|
|
|
|
// A public client must STAY public across reconciles. An upsert that omits
|
|
// `public` (an operator reconcile, a probe, any caller that only sets a name)
|
|
// must not read "no stored secret" as "mint one" — that silently converts the
|
|
// client back to confidential and every browser login starts failing
|
|
// `invalid_client` with nothing in the provision document changed to explain it.
|
|
func TestUpsertApplication_PublicStaysPublicAcrossReconciles(t *testing.T) {
|
|
for _, tc := range []struct {
|
|
name string
|
|
public bool
|
|
reqSecret string
|
|
existingSecret string
|
|
hasExisting bool
|
|
wantSecretEmpty bool
|
|
wantSecretEquals string
|
|
}{
|
|
{name: "public clears an inherited secret", public: true, existingSecret: "old", hasExisting: true, wantSecretEmpty: true},
|
|
{name: "omitting public preserves empty", hasExisting: true, existingSecret: "", wantSecretEmpty: true},
|
|
{name: "omitting public preserves a secret", hasExisting: true, existingSecret: "keepme", wantSecretEquals: "keepme"},
|
|
{name: "explicit secret wins", reqSecret: "rotated", hasExisting: true, existingSecret: "old", wantSecretEquals: "rotated"},
|
|
} {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
got := resolveSecret(tc.public, tc.reqSecret, tc.hasExisting, tc.existingSecret)
|
|
switch {
|
|
case tc.wantSecretEmpty && got != "":
|
|
t.Errorf("secret = %q, want empty", got)
|
|
case tc.wantSecretEquals != "" && got != tc.wantSecretEquals:
|
|
t.Errorf("secret = %q, want %q", got, tc.wantSecretEquals)
|
|
}
|
|
})
|
|
}
|
|
// A brand-new confidential client still gets one.
|
|
if resolveSecret(false, "", false, "") == "" {
|
|
t.Error("a new confidential client must be minted a secret")
|
|
}
|
|
}
|