[Backport] Update topo {Get,Create}Keyspace to prevent invalid keyspace names (#12732)#12771
Conversation
…itessio#12732) * Update topo {Get,Create}Keyspace to prevent invalid keyspace names Signed-off-by: Andrew Mason <andrew@planetscale.com> * embarrassing Signed-off-by: Andrew Mason <andrew@planetscale.com> * docs, release notes Signed-off-by: Andrew Mason <andrew@planetscale.com> * only validate, do not correct Signed-off-by: Andrew Mason <andrew@planetscale.com> * broader restrictions via allow-list Signed-off-by: Andrew Mason <andrew@planetscale.com> * Revert "broader restrictions via allow-list" This reverts commit 5354d4f. Signed-off-by: Andrew Mason <andrew@planetscale.com> * tighten up release notes scope Signed-off-by: Andrew Mason <andrew@planetscale.com> * Update go/vt/topo/keyspace.go Co-authored-by: Florent Poinsard <35779988+frouioui@users.noreply.github.com> Signed-off-by: Andrew Mason <andrew@planetscale.com> --------- Signed-off-by: Andrew Mason <andrew@planetscale.com> Co-authored-by: Florent Poinsard <35779988+frouioui@users.noreply.github.com>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
If a new flag is being introduced:
If a workflow is added or modified:
Bug fixes
Non-trivial changes
New/Existing features
Backward compatibility
|
go/vt/topo/keyspace.go
Outdated
| // ValidateKeyspaceName checks if the provided name is a valid name for a | ||
| // keyspace. | ||
| // | ||
| // As of v17, "all invalid characters" is just the forward slash ("/"). |
There was a problem hiding this comment.
We should update this to v16.0.2, unless we want to make an exception for this one and get it into v16.0.1 (in code freeze now)?
There was a problem hiding this comment.
@frouioui and i were planning to get this into v16.0.1. will update
There was a problem hiding this comment.
Oh yeah, let's change this to v16.0.1
| if err := topo.ValidateKeyspaceName(keyspaceName); err != nil { | ||
| return nil, err | ||
| } |
There was a problem hiding this comment.
In the upstream PR we documented this as a breaking change. And here I can see that it could be. Do we really want to backport this? If so, don't we want the same release notes summary update?
There was a problem hiding this comment.
yes, we want the backport, i'll update the notes!
Signed-off-by: Andrew Mason <andrew@planetscale.com>
|
|
||
| // GetKeyspace reads the given keyspace and returns it | ||
| func (ts *Server) GetKeyspace(ctx context.Context, keyspace string) (*KeyspaceInfo, error) { | ||
| if err := ValidateKeyspaceName(keyspace); err != nil { |
There was a problem hiding this comment.
may be I am missing something here. What will happen to existing keyspaces with "/" ??
Backports #12732, had to do manually to not pick up #12525