Skip to content

fix: improve API endpoint regex [IDE-1896]#588

Open
rrama wants to merge 1 commit intomainfrom
fix/IDE-1896_improve-api-endpoint-regex
Open

fix: improve API endpoint regex [IDE-1896]#588
rrama wants to merge 1 commit intomainfrom
fix/IDE-1896_improve-api-endpoint-regex

Conversation

@rrama
Copy link
Copy Markdown
Contributor

@rrama rrama commented Apr 17, 2026

Description

Ensure the endpoint is restricted to Snyk domains.

Checklist

  • Tests added and all succeed (make test)
  • Regenerated mocks, etc. (make generate)
  • N/A
  • Linted (make lint)
  • Test your changes work for the CLI
    1. Clone / pull the latest CLI main.
    2. Run go get github.com/snyk/go-application-framework@YOUR_LATEST_GAF_COMMIT in the cliv2 directory.
      • Tip: for local testing, you can uncomment the line near the bottom of the CLI's go.mod to point to your local GAF code.
    3. Run go mod tidy in the cliv2 directory.
    4. Run the CLI tests and do any required manual testing.
    5. Open a PR in the CLI repo now with the go.mod and go.sum changes.

@snyk-io
Copy link
Copy Markdown

snyk-io Bot commented Apr 17, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@snyk-io
Copy link
Copy Markdown

snyk-io Bot commented Apr 17, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@rrama rrama force-pushed the fix/IDE-1896_improve-api-endpoint-regex branch from aaf19fb to dbfc791 Compare April 21, 2026 10:16
@rrama rrama marked this pull request as ready for review April 27, 2026 11:10
@rrama rrama requested review from a team as code owners April 27, 2026 11:10
@snyk-pr-review-bot
Copy link
Copy Markdown

PR Reviewer Guide 🔍

🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected
📚 Repository Context Analyzed

This review considered 7 relevant code sections from 7 files (average relevance: 0.75)

bastiandoetsch
bastiandoetsch previously approved these changes Apr 27, 2026
const SNYK_DOCS_URL = "https://docs.snyk.io"
const SNYK_DOCS_ERROR_CATALOG_PATH = "/scan-with-snyk/error-catalog"
const SNYK_DEFAULT_ALLOWED_HOST_REGEXP = `^(https?://)?api(\.(.+))?\.(snyk|snykgov)\.io$`
const SNYK_DEFAULT_ALLOWED_HOST_REGEXP = `^(https?:\/\/)?api(\.([a-z0-9._-]+))?\.(snyk|snykgov)\.io$`
Copy link
Copy Markdown
Contributor

@bastiandoetsch bastiandoetsch Apr 27, 2026

Choose a reason for hiding this comment

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

This would prevent snyk to use private cloud unicode URLs.

It would be better to update IsValidHost with url.Parse to extract the actual host. The function could be moved to its own package to prevent possible import cycles.

Copy link
Copy Markdown
Contributor

@bastiandoetsch bastiandoetsch left a comment

Choose a reason for hiding this comment

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

Added a comment for improvement

@bastiandoetsch bastiandoetsch dismissed their stale review April 27, 2026 15:53

because i can dismiss my own review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants