RTECO-1536 - Add jf ruby command for native RubyGems/Bundler support - #3574
RTECO-1536 - Add jf ruby command for native RubyGems/Bundler support#3574agrasth wants to merge 39 commits into
Conversation
Wires the native RubyGems/Bundler support into the JFrog CLI: - Register `jf ruby` command in buildtools/cli.go with SkipFlagParsing - RubyCmd handler: extracts native tool, server-id, build details, delegates to RubyCommand via ExecWithPackageManager - Add Ruby flag set (BuildName, BuildNumber, module, Project, serverId) - Add docs/buildtools/rubycommand/help.go with usage examples - Route gem/bundle through `jf ruby` in packagealias/dispatch.go (Ghost Frog) - Add 5 integration tests (version passthrough, help bypass, error handling) Note: go.mod contains local replace directives for build-info-go and jfrog-cli-artifactory (development only, to be replaced at merge time). Co-authored-by: Cursor <cursoragent@cursor.com>
The --repo flag specifies an Artifactory repository name and lets jf construct the full gems API URL from the server config, so users do not need to pass full Artifactory URLs for gem install/push commands. Also updates help text with --repo examples and adds integration test. Co-authored-by: Cursor <cursoragent@cursor.com>
Integration tests for gem install/fetch/push, bundle install, build-info capture, checksums, scope classification, and round-trip flows. All tests auto-skip unless explicitly enabled with -test.ruby=true, so CI remains unaffected. Co-authored-by: Cursor <cursoragent@cursor.com>
Adds rubyTests.yml following the same pattern as nixTests/uvTests: - Sets up Ruby 3.2 via ruby/setup-ruby - Spins up local Artifactory - Runs `go test --test.ruby` - Supports external Artifactory via workflow_dispatch inputs Co-authored-by: Cursor <cursoragent@cursor.com>
…tive-support Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # go.sum # main_test.go # utils/tests/consts.go # utils/tests/utils.go
Points build-info-go and jfrog-cli-artifactory replace directives to their feature branch commits on GitHub, so CI can resolve dependencies without local checkouts. Co-authored-by: Cursor <cursoragent@cursor.com>
- ruby_integration_test.go: suppress G703 path traversal on test-only WriteFile (path always comes from CreateTempDir) - buildtools/cli.go: rewrite if-else chain to switch in extractRubyRepoFromArgs to satisfy gocritic Co-authored-by: Cursor <cursoragent@cursor.com>
Required by the CI static analysis check that verifies all registered commands expose AI-consumable descriptions via ResolveDescription. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Integration tests now call prepareHomeDir(t) via initRubyTest to ensure the JFrog server config is available (fixes "Invalid uri scheme" errors from missing ArtifactoryUrl). Also updates jfrog-cli-artifactory dependency to include the reference token auth fix. Co-authored-by: Cursor <cursoragent@cursor.com>
Integration tests now call prepareHomeDir(t) via initRubyTest to ensure the JFrog server config is available (fixes "Invalid uri scheme" errors from missing ArtifactoryUrl). Also updates jfrog-cli-artifactory dependency to include the reference token auth fix. Co-authored-by: Cursor <cursoragent@cursor.com>
Bundler lockfile fixtures caused "unreadable lockfile" errors in CI due to version mismatches and unpatched placeholder URLs. Removing them lets bundler generate a fresh lockfile during tests. Also updates jfrog-cli-artifactory dep to include the fix that errors on invalid --server-id instead of silently falling through. Co-authored-by: Cursor <cursoragent@cursor.com>
Bundler lockfile fixtures caused "unreadable lockfile" errors in CI due to version mismatches and unpatched placeholder URLs. Removing them lets bundler generate a fresh lockfile during tests. Also updates jfrog-cli-artifactory dep to include the fix that errors on invalid --server-id instead of silently falling through. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Bundler env var credential matching varies across versions and port handling. Embedding credentials directly in the source URL is the most reliable approach for CI, matching how gem install works. Co-authored-by: Cursor <cursoragent@cursor.com>
Bundler env var credential matching varies across versions and port handling. Embedding credentials directly in the source URL is the most reliable approach for CI, matching how gem install works. Co-authored-by: Cursor <cursoragent@cursor.com>
Generic jf rt upload doesn't trigger Artifactory gem index generation. Use jf ruby gem push which hits the RubyGems API endpoint (POST /api/gems/<repo>) and properly triggers specs.4.8.gz creation. Co-authored-by: Cursor <cursoragent@cursor.com>
Generic jf rt upload doesn't trigger Artifactory gem index generation. Use jf ruby gem push which hits the RubyGems API endpoint (POST /api/gems/<repo>) and properly triggers specs.4.8.gz creation. Co-authored-by: Cursor <cursoragent@cursor.com>
Artifactory generates specs.4.8.gz asynchronously after gem push API call. Add a wait to give it time to complete before bundle tests request the index. Co-authored-by: Cursor <cursoragent@cursor.com>
The virtual repo's specs.4.8.gz depends on both the local repo (gem push) AND the remote repo (lazy sync from rubygems.org). Replace the fixed 10s sleep with polling (up to 60s, 5s intervals) that verifies the index is actually available before proceeding with bundle tests. Co-authored-by: Cursor <cursoragent@cursor.com>
1. warmUpRubyVirtualRepo now uses sync.Once so the expensive polling (push gem + poll specs.4.8.gz) runs only once across all tests. Increased timeout to 120s for slow CI Artifactory instances. 2. TestRubyBuildFlags: name-only and number-only cases now correctly expect an error (CLI rejects partial build-name/build-number). Co-authored-by: Cursor <cursoragent@cursor.com>
The CI Artifactory instance does not generate specs.4.8.gz for virtual repos (confirmed after multiple attempts with polling up to 120s). This is an infrastructure limitation, not a code bug. Fix: Bundle tests now use the LOCAL repo directly with a self-contained 'warmup' gem. The local repo generates specs immediately on gem push. gem install/fetch tests still use the virtual repo (which works fine for individual gem operations that don't need specs.4.8.gz). Co-authored-by: Cursor <cursoragent@cursor.com>
…tive-support Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # ruby_integration_test.go
The artifactory pin was still at f58023d, which predated the checksum
provenance fix and every subsequent RubyGems change, so this branch built
`jf ruby` against known-broken behaviour.
Both replace directives are now plain requires. build-info-go no longer needs
one here at all: jfrog-cli-artifactory requires the version it needs directly,
so minimal version selection carries it, whereas a replace in a dependency is
ignored and silently resolved to an older commit.
Picks up, from jfrog-cli-artifactory:
- jf setup ruby writes a Bundler mirror, so an unmodified Gemfile resolves
through Artifactory with no edit
- bare `gem install` can authenticate at all, which previously failed 401
- Bundler credential keys correct for dashed and ported hosts
- Artifactory credentials no longer sent to unrelated gem hosts
- `gem push` no longer falls back to rubygems.org
- AQL enrichment no longer mixes a checksum and a path from different files
Picks up the RubyGems fixes verified against a live instance:
- plain `gem install` works at all: the ~/.gemrc source now ends in a slash,
without which RubyGems dropped the repository name from its index request
- https://rubygems.org no longer sits ahead of Artifactory in ~/.gemrc, so
setup actually takes effect for bare gem commands
- the Gemfile is resolved the way Bundler resolves it, honouring
$BUNDLE_GEMFILE and parent directories, so commands run from a subdirectory
no longer fail with a bare "exit status 16"
- module IDs come from the gemspec instead of the working directory name or
the subcommand, so they are stable across machines
- `gem build` records the dependencies it was built against, read from
Gemfile.lock
- artifact paths match where the gem actually landed
- global flags before the subcommand, and a "--" separator, no longer cause
auth and build-info to be skipped silently
- interrupting `gem push` no longer leaves the Artifactory token on disk
- empty dependency enrichment warns instead of passing for success
…tive-support # Conflicts: # buildtools/cli.go # go.mod # go.sum # main_test.go # utils/cliutils/commandsflags.go # utils/tests/consts.go # utils/tests/utils.go
Static Check and Go-Sec both flagged the repository warm-up helper. The request method and status code now use the http package constants rather than string and numeric literals, and the response body close is asserted instead of ignored. Also bumps jfrog-cli-artifactory to pick up the missing Ruby entry in packageManagerConfigs, without which the setup tests fail there.
The RubyGems FlexPack branch now contains build-info-go's main, so its pseudo-version is newer and an ordinary require selects it. The replace directive added to pin backwards is no longer needed.
📗 Scan Summary
📦 Vulnerable Dependencies
🔖 DetailsVulnerability Details
Multiple security vulnerabilities have been identified and addressed in grpc-go affecting the xDS RBAC authorization engine (internal/xds/rbac) and the HTTP/2 transport server implementation (internal/transport). These vulnerabilities could result in:
ImpactWhat kind of vulnerability is it? Who is impacted? xDS RBAC Authorization Bypass via
|
| Vulnerability | Qualitative Severity | Approximate CVSS v3.1 Score | Primary Impact |
|---|---|---|---|
| xDS RBAC Authorization Bypass | High | 8.2 |
Unauthorized Access / Fail-Open |
| HTTP/2 Rapid Reset DOS Bypass | High | 7.5 |
High CPU Consumption / Denial of Service |
| xDS RBAC Engine Server Panic | Medium | 5.9 |
Process Crash / Denial of Service |
at 🎯 Static Application Security Testing (SAST) VulnerabilityFull descriptionVulnerability Details
OverviewHardcoded credentials are usernames, passwords, API keys, or other secrets Vulnerable exampleIn this example, the database username and password for the frog pond are package main
import (
"database/sql"
"fmt"
"log"
_ "[github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)"
)
func main() {
// VULNERABLE: Hardcoded database credentials for the frog pond.
frogUser := "pond_admin"
frogPassword := "LeapFlog123!"
pondName := "lilypad_db"
connStr := fmt.Sprintf("%s:%s@tcp(127.0.0.1:3306)/%s",
frogUser, frogPassword, pondName)
lilypadDB, err := sql.Open("mysql", connStr)
if err != nil {
log.Fatalf("Error opening database: %v", err)
}
defer lilypadDB.Close()
err = lilypadDB.Ping()
if err != nil {
log.Fatalf("Error pinging database: %v", err)
}
fmt.Println("Successfully connected to the frog pond.")
}RemediationThe remediated code retrieves the database credentials from environment package main
import (
"database/sql"
"fmt"
"log"
"os"
_ "[github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)"
)
func main() {
// SECURE: Retrieve credentials from environment variables.
frogUser := os.Getenv("FROG_DB_USER")
frogPassword := os.Getenv("FROG_DB_PASS")
pondName := os.Getenv("FROG_DB_NAME")
if frogUser == "" || frogPassword == "" || pondName == "" {
log.Fatal("DB credentials are not set in environment variables.")
}
connStr := fmt.Sprintf("%s:%s@tcp(127.0.0.1:3306)/%s",
frogUser, frogPassword, pondName)
lilypadDB, err := sql.Open("mysql", connStr)
if err != nil {
log.Fatalf("Error opening database: %v", err)
}
defer lilypadDB.Close()
err = lilypadDB.Ping()
if err != nil {
log.Fatalf("Error pinging database: %v", err)
}
fmt.Println("Successfully connected to the frog pond.")
} |
at 🎯 Static Application Security Testing (SAST) VulnerabilityFull descriptionVulnerability Details
OverviewHardcoded credentials are usernames, passwords, API keys, or other secrets Vulnerable exampleIn this example, the database username and password for the frog pond are package main
import (
"database/sql"
"fmt"
"log"
_ "[github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)"
)
func main() {
// VULNERABLE: Hardcoded database credentials for the frog pond.
frogUser := "pond_admin"
frogPassword := "LeapFlog123!"
pondName := "lilypad_db"
connStr := fmt.Sprintf("%s:%s@tcp(127.0.0.1:3306)/%s",
frogUser, frogPassword, pondName)
lilypadDB, err := sql.Open("mysql", connStr)
if err != nil {
log.Fatalf("Error opening database: %v", err)
}
defer lilypadDB.Close()
err = lilypadDB.Ping()
if err != nil {
log.Fatalf("Error pinging database: %v", err)
}
fmt.Println("Successfully connected to the frog pond.")
}RemediationThe remediated code retrieves the database credentials from environment package main
import (
"database/sql"
"fmt"
"log"
"os"
_ "[github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)"
)
func main() {
// SECURE: Retrieve credentials from environment variables.
frogUser := os.Getenv("FROG_DB_USER")
frogPassword := os.Getenv("FROG_DB_PASS")
pondName := os.Getenv("FROG_DB_NAME")
if frogUser == "" || frogPassword == "" || pondName == "" {
log.Fatal("DB credentials are not set in environment variables.")
}
connStr := fmt.Sprintf("%s:%s@tcp(127.0.0.1:3306)/%s",
frogUser, frogPassword, pondName)
lilypadDB, err := sql.Open("mysql", connStr)
if err != nil {
log.Fatalf("Error opening database: %v", err)
}
defer lilypadDB.Close()
err = lilypadDB.Ping()
if err != nil {
log.Fatalf("Error pinging database: %v", err)
}
fmt.Println("Successfully connected to the frog pond.")
} |
at 🎯 Static Application Security Testing (SAST) VulnerabilityFull descriptionVulnerability Details
OverviewHardcoded credentials are usernames, passwords, API keys, or other secrets Vulnerable exampleIn this example, the database username and password for the frog pond are package main
import (
"database/sql"
"fmt"
"log"
_ "[github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)"
)
func main() {
// VULNERABLE: Hardcoded database credentials for the frog pond.
frogUser := "pond_admin"
frogPassword := "LeapFlog123!"
pondName := "lilypad_db"
connStr := fmt.Sprintf("%s:%s@tcp(127.0.0.1:3306)/%s",
frogUser, frogPassword, pondName)
lilypadDB, err := sql.Open("mysql", connStr)
if err != nil {
log.Fatalf("Error opening database: %v", err)
}
defer lilypadDB.Close()
err = lilypadDB.Ping()
if err != nil {
log.Fatalf("Error pinging database: %v", err)
}
fmt.Println("Successfully connected to the frog pond.")
}RemediationThe remediated code retrieves the database credentials from environment package main
import (
"database/sql"
"fmt"
"log"
"os"
_ "[github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)"
)
func main() {
// SECURE: Retrieve credentials from environment variables.
frogUser := os.Getenv("FROG_DB_USER")
frogPassword := os.Getenv("FROG_DB_PASS")
pondName := os.Getenv("FROG_DB_NAME")
if frogUser == "" || frogPassword == "" || pondName == "" {
log.Fatal("DB credentials are not set in environment variables.")
}
connStr := fmt.Sprintf("%s:%s@tcp(127.0.0.1:3306)/%s",
frogUser, frogPassword, pondName)
lilypadDB, err := sql.Open("mysql", connStr)
if err != nil {
log.Fatalf("Error opening database: %v", err)
}
defer lilypadDB.Close()
err = lilypadDB.Ping()
if err != nil {
log.Fatalf("Error pinging database: %v", err)
}
fmt.Println("Successfully connected to the frog pond.")
} |
…tive-support # Conflicts: # go.mod # go.sum
Picks up the fix for resolving the RubyGems and Bundler configuration home, which on Windows is $HOME rather than the %USERPROFILE% that os.UserHomeDir reports. Without it, jf setup ruby wrote ~/.gemrc and ~/.bundle/config where neither gem nor bundle reads them.



Summary
Registers the
jf ruby <gem|bundle>command in the JFrog CLI, wiring up the native RubyGems/Bundler support with full authentication, build-info collection, and Ghost Frog integration.Depends on: jfrog/jfrog-cli-artifactory#499
What is included in this PR
jf rubywithSkipFlagParsing: truefor transparent arg passthrough--server-id,--repo,--build-name,--build-number,--module,--projectconsumed by jf; everything else forwarded to native tool--repoflag: Specifies Artifactory repo name; jf constructs the full gems API URL from server config (no need to pass full URLs)gem/bundlealiases route throughjf ruby <tool>Usage examples
Test plan
go build ./...- compiles with local replacesgo test -run TestRuby)