mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-23 20:25:56 +00:00
Align routed and hosted Proxmox private-input contracts
Keep fresh token issuance, scope, persistence, normalized product and origin checks while requiring the minted credential outside copied shell text. Dynamic executable coverage already pins decoded quoted arguments. No runtime or frontend content changes. Change-source: pulse-maintainer
This commit is contained in:
@@ -23275,8 +23275,8 @@ func TestContract_RequestOriginCannotRetargetTokenBearingCommands(t *testing.T)
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &response); err != nil {
|
||||
t.Fatalf("decode response: %v", err)
|
||||
}
|
||||
if response.Token == "" || !strings.Contains(response.Command, response.Token) {
|
||||
t.Fatalf("fresh token was not carried by install command: %#v", response)
|
||||
if response.Token == "" || strings.Contains(response.Command, response.Token) || !strings.Contains(response.Command, `--token-file "$token_file"`) {
|
||||
t.Fatal("fresh credential must be returned separately and entered privately")
|
||||
}
|
||||
if !strings.Contains(response.Command, tc.wantBaseURL+"/install.sh") ||
|
||||
!strings.Contains(response.Command, "--url "+posixShellQuote(tc.wantBaseURL)) {
|
||||
@@ -24090,7 +24090,7 @@ func TestContract_HostedInstallerOriginsFailClosedAtRouter(t *testing.T) {
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &response); err != nil {
|
||||
t.Fatalf("decode install response: %v", err)
|
||||
}
|
||||
if response.Token == "" || !strings.Contains(response.Command, response.Token) || !strings.Contains(response.Command, wantBaseURL+"/install.sh") {
|
||||
if response.Token == "" || strings.Contains(response.Command, response.Token) || !strings.Contains(response.Command, `--token-file "$token_file"`) || !strings.Contains(response.Command, wantBaseURL+"/install.sh") {
|
||||
t.Fatalf("install response did not bind fresh token to configured URL %q: %#v", wantBaseURL, response)
|
||||
}
|
||||
if strings.Contains(response.Command, "attacker") || len(cfg.APITokens) != 2 {
|
||||
@@ -25075,8 +25075,8 @@ func TestContract_HostedRuntimeAgentInstallCommandCarriesToken(t *testing.T) {
|
||||
if strings.TrimSpace(token) == "" {
|
||||
t.Fatalf("%s: hosted install payload has no token: %s", body, rec.Body.String())
|
||||
}
|
||||
if command, _ := payload["command"].(string); command != "" && !strings.Contains(command, token) {
|
||||
t.Fatalf("%s: install command does not carry the minted token", body)
|
||||
if command, _ := payload["command"].(string); command != "" && (strings.Contains(command, token) || !strings.Contains(command, `--token-file "$token_file"`)) {
|
||||
t.Fatalf("%s: minted credential must be entered privately, not embedded", body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ func TestHostedTenantAgentInstallCommand_GeneratesOrgBoundTokenAndCommand(t *tes
|
||||
require.Contains(t, resp.Command, "https://cloud.example.com/install.sh")
|
||||
require.NotContains(t, resp.Command, resp.Token)
|
||||
require.Contains(t, resp.Command, `--token-file "$token_file"`)
|
||||
require.Contains(t, resp.Command, "--proxmox-type "+posixShellQuote("pbs"))
|
||||
require.Contains(t, resp.Command, "--proxmox-type "+strings.ReplaceAll(posixShellQuote("pbs"), "'", `'"'"'`))
|
||||
|
||||
require.Regexp(t, regexp.MustCompile(`^[a-f0-9]{64}$`), resp.Token)
|
||||
|
||||
@@ -146,7 +146,7 @@ func TestGenerateHostedTenantAgentInstallCommandEnforcesHostedOrgBoundary(t *tes
|
||||
require.NotEmpty(t, result.Token)
|
||||
require.NotEmpty(t, result.TokenID)
|
||||
require.Contains(t, result.Command, "https://acme.cloud.example.com/install.sh")
|
||||
require.Contains(t, result.Command, "--proxmox-type "+posixShellQuote("pbs"))
|
||||
require.Contains(t, result.Command, "--proxmox-type "+strings.ReplaceAll(posixShellQuote("pbs"), "'", `'"'"'`))
|
||||
|
||||
tokens, err := persistence.LoadAPITokens()
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user