Skip to content

changes for the coming soon v2 - #90

Merged
livrasand merged 2 commits into
mainfrom
changes-for-the-coming-soon-v2
Jul 9, 2026
Merged

changes for the coming soon v2#90
livrasand merged 2 commits into
mainfrom
changes-for-the-coming-soon-v2

Conversation

@livrasand

@livrasand livrasand commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Implementados endpoints /api/search (búsqueda multi-provider con soporte para topics), /api/trending/:provider (repos trending/new de GitHub/GitLab), y /api/gl-notes/:owner/:repo/:number (proxy de comentarios de issues de GitLab sin requerir token del usuario). Actualizado CSP para permitir conexiones a APIs externas y recursos CDN. Agregado middleware localhostCORS para desarrollo local. Eliminados archivos HTML estáticos obsoletos (approach.html, guidelines.html, karma.html),

Summary by CodeRabbit

  • New Features

    • Added API endpoints for repository search, trending repositories, and issue notes proxying.
    • Search and trending results now support multiple providers with a shared response format.
  • Bug Fixes

    • Improved browser access during local development with relaxed CORS handling for localhost.
    • Expanded allowed security policy sources so external images and data connections load correctly.
  • Refactor

    • Removed several standalone informational pages and streamlined public routing.

…and GitLab issue notes proxy endpoints

Implementados endpoints /api/search (búsqueda multi-provider con soporte para topics), /api/trending/:provider (repos trending/new de GitHub/GitLab), y /api/gl-notes/:owner/:repo/:number (proxy de comentarios de issues de GitLab sin requerir token del usuario). Actualizado CSP para permitir conexiones a APIs externas y recursos CDN. Agregado middleware localhostCORS para desarrollo local. Eliminados archivos HTML estáticos obsoletos (approach.html, guidelines.html, karma.html),
@livrasand livrasand self-assigned this Jul 9, 2026
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@livrasand, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3fdc66ae-7eb0-4ba5-9c43-a94753579eeb

📥 Commits

Reviewing files that changed from the base of the PR and between 41f533a and 889f110.

📒 Files selected for processing (4)
  • internal/http/handlers.go
  • internal/http/router.go
  • web/index.html
  • web/repo.html
📝 Walkthrough

Walkthrough

Adds GitLab issue notes proxy, repository search, and trending repository handlers to the HTTP layer, registers corresponding routes, introduces a localhost CORS middleware, broadens the Content Security Policy, updates static routing to serve repo.html, and removes three static HTML pages (approach, guidelines, karma).

Changes

API endpoints and routing

Layer / File(s) Summary
GitLab issue notes proxy
internal/http/handlers.go
Adds net/url import and GitLabIssueNotesProxyHandler, which forwards issue notes requests to the GitLab API, optionally authenticating with GITLAB_TOKEN, and relays the upstream status/body or maps failures to 500/502.
Repository search handler
internal/http/handlers.go
Adds SearchHandler and GitHub/GitLab search helpers that validate q/topic parameters, query one or both providers based on provider, and return aggregated normalized results.
Trending repositories handler
internal/http/handlers.go
Adds TrendingHandler and helpers that route by provider/sort, fetch trending data from GitHub/GitLab search endpoints, and normalize results into a common schema.
Router wiring, CORS, and CSP
internal/http/router.go, web/approach.html, web/guidelines.html, web/karma.html
Adds localhostCORS middleware, broadens CSP img-src/connect-src directives, replaces static routes for approach.html, guidelines.html, and karma.html (now removed) with /repo.html, and registers /api/search, /api/trending/:provider, and /api/gl-notes/:owner/:repo/:number routes.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Router
  participant SearchHandler
  participant TrendingHandler
  participant GitHubAPI
  participant GitLabAPI

  Client->>Router: GET /api/search?q=...
  Router->>SearchHandler: route request
  SearchHandler->>GitHubAPI: query search endpoint
  SearchHandler->>GitLabAPI: query search endpoint
  SearchHandler-->>Client: aggregated normalized results

  Client->>Router: GET /api/trending/:provider
  Router->>TrendingHandler: route request
  TrendingHandler->>GitHubAPI: fetch trending repos
  TrendingHandler->>GitLabAPI: fetch trending repos
  TrendingHandler-->>Client: aggregated normalized results
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is too vague to describe the actual backend, security, and routing changes in this PR. Use a specific title like “Add search/trending APIs, GitLab notes proxy, and CSP/local CORS updates”.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch changes-for-the-coming-soon-v2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/http/handlers.go`:
- Around line 2304-2308: The repository search in the URL-building logic is
using stale hardcoded created-date thresholds, so the “new” and “trending”
queries no longer reflect recency. Update the URL selection in the relevant
handler to compute the date cutoff dynamically at runtime instead of embedding
fixed dates. Use the existing sort branch in the search logic to derive relative
thresholds from the current time (for example, a longer window for trending and
a shorter one for new), and keep the rest of the GitHub search URL construction
unchanged.
- Line 2150: The repository search URL in the GitHub handler is built from a raw
query string, which can break multi-word searches and allow parameter injection.
Update the logic in the handler that constructs the GitHub search request to
URL-encode the user query with url.QueryEscape before interpolating it. Since
the local variable currently named url shadows the imported net/url package,
rename that variable (for example, apiURL) so the code can call url.QueryEscape
cleanly.
- Line 1197: The GitLab request in the handler still uses http.DefaultClient,
which can block indefinitely; update the request path in the relevant handler to
use a bounded http.Client with a timeout, matching the existing search/trending
helpers that already use a 10 second timeout. Locate the call site around the
GitLab fetch logic in the handler and swap the client used for Do(req) so the
request cannot hang goroutines under slow or stalled upstream responses.
- Around line 1181-1185: Validate the issue `number` before building the GitLab
API request in `internal/http/handlers.go`; unlike `owner` and `repo`, `number`
is currently interpolated raw into `apiURL`. Update the handler that reads
`c.Param("number")` to enforce a numeric-only value (reject anything else)
before `fmt.Sprintf` constructs the upstream URL, so `number` cannot alter the
query string.

In `@internal/http/router.go`:
- Line 43: The img-src policy in router.go is overly broad because the https:
scheme already allows images from any HTTPS origin, making the explicit host
entries redundant. Update the CSP string in the router setup to either keep
https: and remove the specific allowlist hosts, or remove https: and retain only
the intended hosts such as the amazonaws, s3, and cdn.simpleicons.org entries.
- Around line 17-26: The CORS middleware in SetupRouter is too permissive
because the Origin check uses strings.HasPrefix, which can reflect
attacker-controlled domains. Update the origin validation in the middleware near
the Origin header handling to parse the value and only allow exact
localhost/127.0.0.1 hosts with optional ports, ideally via a dedicated helper
such as isLocalhostOrigin. Also consider gating this CORS block behind a
dev-mode flag so it does not run unconditionally in production.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 381e43e6-d8dd-4c88-abeb-b59f894ea6b4

📥 Commits

Reviewing files that changed from the base of the PR and between eca910b and 41f533a.

⛔ Files ignored due to path filters (1)
  • web/assets/logos/gitgost-logo.svg is excluded by !**/*.svg
📒 Files selected for processing (7)
  • internal/http/handlers.go
  • internal/http/router.go
  • web/approach.html
  • web/guidelines.html
  • web/index.html
  • web/karma.html
  • web/repo.html
💤 Files with no reviewable changes (3)
  • web/karma.html
  • web/approach.html
  • web/guidelines.html

Comment thread internal/http/handlers.go
Comment thread internal/http/handlers.go Outdated
Comment thread internal/http/handlers.go Outdated
Comment thread internal/http/handlers.go
Comment thread internal/http/router.go
Comment thread internal/http/router.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 41f533ab19

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread web/repo.html
Comment thread internal/http/handlers.go
Comment thread web/index.html
Comment thread web/index.html
Comment thread web/index.html
…d fix trending date filters

Agregado banner de suspensión visible en index.html y repo.html que consulta /api/status para mostrar advertencia cuando panic_mode está activo. Implementada validación de dígitos en GitLabIssueNotesProxyHandler para prevenir inyección en número de issue. Añadido timeout de 10s en cliente HTTP de proxy GitLab. Mejorada validación de origen localhost en middleware CORS usando url.Parse en lugar de strings.HasPrefix
@livrasand
livrasand merged commit ea6c273 into main Jul 9, 2026
4 checks passed
@livrasand
livrasand deleted the changes-for-the-coming-soon-v2 branch July 9, 2026 02:23
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