Skip to content

v2.0.x Chore - Consider enhancing Git reference validation. #273

Closed
@reactive-firewall

Description

@reactive-firewall

While the function works well, the regex pattern could be more restrictive to better match Git's reference naming rules:

References cannot begin with a dot or dash
References cannot contain consecutive dots

-	if not re.match(r'^[a-zA-Z0-9_\-./]+$', ref):
+	if not re.match(r'^[a-zA-Z0-9][a-zA-Z0-9_\-./]*$', ref) or '..' in ref:
 		raise ValueError(f"Invalid Git reference: {ref}")

Metadata

Metadata

Labels

ChoreMiscellaneous chores to maintain the projectConfigsImprovements or additions to configurationLinterAny linter tool or setting file enhancementsMulticastAny main project file changesTestingSomething can be verifieddocumentationImprovements or additions to documentation

Type

No type

Projects

Status

Archive Backlog

Relationships

None yet

Development

No branches or pull requests

Issue actions