Skip to content

Commit 352bd80

Browse files
mbachorikclaude
andcommitted
Address Copilot review feedback
- Fix localhost URL check to use parsed.hostname instead of netloc.startswith() This correctly handles URLs with ports like localhost:8080 - Fix YAML indentation error in config-template.yml (line 57) - Fix double space typo in example.md (line 172) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 6d4c6f5 commit 352bd80

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎extensions/template/commands/example.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ cp .specify/extensions/my-extension/config-template.yml \
169169
<!-- CUSTOMIZE: Add helpful notes and tips -->
170170

171171
- This command requires an active connection to the external service
172-
- Results are cached for performance
172+
- Results are cached for performance
173173
- Re-run the command to refresh data
174174

175175
## Examples

‎extensions/template/config-template.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ advanced:
5454
timeout: 30
5555

5656
# Retry attempts
57-
retry_count: 3
57+
retry_count: 3
5858

5959
# Cache duration in seconds
6060
cache_duration: 3600

‎src/specify_cli/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,7 @@ def extension_add(
14801480

14811481
# Validate URL
14821482
parsed = urlparse(from_url)
1483-
is_localhost = parsed.netloc.startswith("localhost") or parsed.netloc.startswith("127.0.0.1")
1483+
is_localhost = parsed.hostname in ("localhost", "127.0.0.1", "::1")
14841484

14851485
if parsed.scheme != "https" and not (parsed.scheme == "http" and is_localhost):
14861486
console.print("[red]Error:[/red] URL must use HTTPS for security.")

‎src/specify_cli/extensions.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ def get_catalog_url(self) -> str:
970970

971971
# Require HTTPS for security (prevent man-in-the-middle attacks)
972972
# Allow http://localhost for local development/testing
973-
is_localhost = parsed.netloc.startswith("localhost") or parsed.netloc.startswith("127.0.0.1")
973+
is_localhost = parsed.hostname in ("localhost", "127.0.0.1", "::1")
974974
if parsed.scheme != "https" and not (parsed.scheme == "http" and is_localhost):
975975
raise ValidationError(
976976
f"Invalid SPECKIT_CATALOG_URL: must use HTTPS (got {parsed.scheme}://). "

0 commit comments

Comments
 (0)