Skip to content

fix(setup): sanitize repo keys for Gradle property names + clearer SSR placeholder (#362, partial)#388

Merged
brandonrc merged 1 commit intomainfrom
fix/362-setup-guide-hardening
May 9, 2026
Merged

fix(setup): sanitize repo keys for Gradle property names + clearer SSR placeholder (#362, partial)#388
brandonrc merged 1 commit intomainfrom
fix/362-setup-guide-hardening

Conversation

@brandonrc
Copy link
Copy Markdown
Contributor

Summary

Closes #362 partially. Tackles two of the five fixes from the issue:

  1. Sanitize repo keys for Gradle/SBT property names. Pre-fix my-jvm-repo emitted my-jvm-repoUsername=... — legal in gradle.properties but looks broken. New repoKeyToGradleId camelCases kebab/dot/underscore separators. URLs and <id> slots keep the raw key.
  2. SSR fallback placeholder. Replace https://artifacts.example.com with __REPLACE_WITH_REGISTRY_URL__ so the prerendered HTML doesn't ship a real-looking domain users could copy.

Deferred

  • repo_type filter (proxy/virtual hide publish steps) — needs per-step "scope" tags
  • is_public anonymous mode — substantial credential-block refactor
  • Empty repo key guard — backend-forbidden; defensive only

These will be filed as follow-ups.

Test plan

  • npm test — 2094/2094 (6 new in setup/page.test.tsx)
  • npm run lint — 0 errors
  • npm run build — succeeds
  • coverage on changed lines: 86% (above 80% gate)

🤖 Generated with Claude Code

…R placeholder (#362, partial)

Two of the five fixes from #362:

1. Sanitize repo keys for Gradle/SBT property names. Pre-fix a hyphenated
   repo key (`my-jvm-repo`) would emit `my-jvm-repoUsername=...` in
   gradle.properties — technically legal but looks broken to readers
   who assume identifier rules apply. Added `repoKeyToGradleId` that
   camelCases kebab/dot/underscore separators and strips remaining
   non-alphanumerics. URLs and `<id>` slots keep the raw key.

2. SSR fallback placeholder. Pre-fix `REGISTRY_URL` fell back to
   `https://artifacts.example.com` when window was undefined (SSR
   prerender). That string would briefly appear in prerendered HTML
   before client hydration — risk of users copying it. Replace with
   `__REPLACE_WITH_REGISTRY_URL__` (and same for the host) so the
   placeholder is obviously non-functional.

Tests:
  + repoKeyToGradleId unit tests: kebab → camel, dot → camel, underscore
    → camel, symbol stripping, empty-string fallback.
  + Integration tests: Gradle snippet uses sanitized property names
    (myJvmRepoUsername) but URL paths still contain the raw key
    (/maven/my-jvm-repo/).

Deferred to follow-ups:
  - repo_type filter (proxy/virtual repos hide publish steps)
  - is_public (anonymous-access snippet, no credentials)
  - empty repo key guard (forbidden by backend; defensive only)

CHANGELOG entry under [Unreleased] / Fixed.

Closes #362 (partial — items 3 and 5 from the issue body).
@brandonrc brandonrc requested a review from a team as a code owner May 9, 2026 21:49
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@brandonrc brandonrc merged commit b034eac into main May 9, 2026
18 checks passed
@brandonrc brandonrc deleted the fix/362-setup-guide-hardening branch May 9, 2026 21:59
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.

Setup Guide: snippet correctness for proxy/virtual/public repos and special-char keys

1 participant