mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-15 08:16:50 +00:00
fix: prevent default profile credential collision (#1628)
* fix: prevent default profile credential collision * fix: isolate default profile credential fallback
This commit is contained in:
1 parent
20df3445d9
commit
343899f6c1
4 files changed
+124
-17
No files matched your search
@@ -36,6 +36,7 @@ export const DEFAULT_ACCOUNT_CONTEXT_GROUP = 'default';
|
||||
export const DEFAULT_ACCOUNT_CONTINUITY_MODE: AccountContinuityMode = 'standard';
|
||||
export const MAX_CONTEXT_GROUP_LENGTH = 64;
|
||||
export const ACCOUNT_PROFILE_NAME_PATTERN = /^[a-zA-Z][a-zA-Z0-9_-]*$/;
|
||||
const RESERVED_ACCOUNT_PROFILE_NAMES = new Set(['default']);
|
||||
|
||||
const CONTEXT_GROUP_PATTERN = /^[a-zA-Z][a-zA-Z0-9_-]*$/;
|
||||
|
||||
@@ -57,7 +58,10 @@ export function isValidContextGroupName(value: string): boolean {
|
||||
* Validate account profile naming constraints.
|
||||
*/
|
||||
export function isValidAccountProfileName(value: string): boolean {
|
||||
return ACCOUNT_PROFILE_NAME_PATTERN.test(value);
|
||||
return (
|
||||
ACCOUNT_PROFILE_NAME_PATTERN.test(value) &&
|
||||
!RESERVED_ACCOUNT_PROFILE_NAMES.has(value.toLowerCase())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user