Skip to content

Commit

Permalink
Update projectId processing
Browse files Browse the repository at this point in the history
With `PROJECTID_PATTERN = re.compile(r'^[a-z][a-z0-9-]{4,99}[a-z0-9]$')`, the max projectid length is 101

Delete debugging prints
  • Loading branch information
taers232c committed Dec 4, 2024
1 parent ff3f31c commit 25fdd76
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/gam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11472,7 +11472,6 @@ def _generateProjectSvcAcctId(prefix):
return f'{prefix}-{"".join(random.choice(LOWERNUMERIC_CHARS) for _ in range(5))}'

def _getLoginHintProjectInfo(createCmd):
print('a')
login_hint = None
create_key = True
appInfo = {'applicationTitle': '', 'supportEmail': ''}
Expand All @@ -11485,9 +11484,7 @@ def _getLoginHintProjectInfo(createCmd):
if login_hint and login_hint.find('@') == -1:
Cmd.Backup()
login_hint = None
print(1)
projectInfo['projectId'] = getString(Cmd.OB_STRING, optional=True, minLen=6, maxLen=999999).strip()
print(2)
projectInfo['projectId'] = getString(Cmd.OB_STRING, optional=True, minLen=6, maxLen=101).strip()
if projectInfo['projectId']:
_checkProjectId(projectInfo['projectId'])
checkForExtraneousArguments()
Expand All @@ -11499,7 +11496,7 @@ def _getLoginHintProjectInfo(createCmd):
elif myarg == 'nokey':
create_key = False
elif myarg == 'project':
projectInfo['projectId'] = getString(Cmd.OB_STRING, minLen=6, maxLen=9999)
projectInfo['projectId'] = getString(Cmd.OB_STRING, minLen=6, maxLen=101)
_checkProjectId(projectInfo['projectId'])
elif createCmd and myarg == 'parent':
projectInfo['parent'] = getString(Cmd.OB_STRING)
Expand All @@ -11515,7 +11512,6 @@ def _getLoginHintProjectInfo(createCmd):
break
else:
unknownArgumentExit()
print(4)
if not projectInfo['projectId']:
if createCmd:
projectInfo['projectId'] = _generateProjectSvcAcctId('gam-project')
Expand Down

1 comment on commit 25fdd76

@jay0lee
Copy link
Member

@jay0lee jay0lee commented on 25fdd76 Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad, was trying to allow repro of the warning and meant to only commit the warning suppression.

FYI, I reverted back to 30 like it was previously. I think Google will accept longer project IDs but no one has ever complained here and I do worry that cryptography might eventually enforce the CN length stuff and cause us further headaches so we should limit how often that can happen.

Please sign in to comment.