Validate portable workspace identifiers
This commit is contained in:
@@ -86,6 +86,9 @@ func LoadCurrentRunPointer(ctx context.Context, store storage.ObjectStore, curre
|
||||
if runID == "" {
|
||||
return "", fmt.Errorf("current run pointer %q is empty", key)
|
||||
}
|
||||
if err := ValidateRunIdentity(runID); err != nil {
|
||||
return "", fmt.Errorf("current run pointer %q contains an unsafe legacy run id; migrate remote state before use: %w", key, err)
|
||||
}
|
||||
return runID, nil
|
||||
}
|
||||
|
||||
@@ -163,6 +166,16 @@ func ValidateCurrentStateIdentity(state *CurrentState, validation CurrentStateVa
|
||||
manifestSessionID := strings.TrimSpace(state.Manifest.SessionID)
|
||||
manifestCampaign := strings.TrimSpace(state.Manifest.Campaign)
|
||||
manifestRunID := strings.TrimSpace(state.Manifest.RunID)
|
||||
if manifestCampaign != "" {
|
||||
if err := ValidateSessionIdentity(manifestCampaign, manifestSessionID); err != nil {
|
||||
return fmt.Errorf("current manifest contains unsafe legacy identities; migrate remote state before use: %w", err)
|
||||
}
|
||||
}
|
||||
if manifestRunID != "" {
|
||||
if err := ValidateRunIdentity(manifestRunID); err != nil {
|
||||
return fmt.Errorf("current manifest contains an unsafe legacy run id; migrate remote state before use: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if expectedSessionID != "" && manifestSessionID != expectedSessionID {
|
||||
return fmt.Errorf(
|
||||
|
||||
Reference in New Issue
Block a user