feat: add JFrog Xray vulnerability scanning module#410
Merged
DevelopmentCats merged 17 commits intomainfrom Mar 6, 2026
Merged
feat: add JFrog Xray vulnerability scanning module#410DevelopmentCats merged 17 commits intomainfrom
DevelopmentCats merged 17 commits intomainfrom
Conversation
Adds a Terraform module that integrates JFrog Xray vulnerability scanning results into Coder workspace metadata. The module: - Fetches vulnerability scan results from JFrog Xray - Displays vulnerability counts (Critical, High, Medium, Low) on workspace page - Supports flexible image path formats - Works with any workspace type using container images - Provides secure token handling Resolves coder/coder#12838 and addresses #65 Co-authored-by: matifali <10648092+matifali@users.noreply.github.com>
Fixes CI formatting checks for the JFrog Xray module.
Adds the required Terraform usage example immediately after the h1 heading to satisfy the README validation requirements.
Fixes remaining formatting issues in the README file.
The check_license argument is not supported by the JFrog Xray Terraform provider, causing test failures. Removing this argument fixes the Terraform validation.
Adds proper null handling for cases where xray scan results are null, which was causing Terraform validation failures. Uses try() function to gracefully handle null values and provide default vulnerability counts.
Fixes terraform formatting issue identified by CI checks.
Member
|
@jatcod3r can you help me test this if you have s setup ready? |
Collaborator
- Fix icon path to use ../../../../.icons/jfrog.svg (matching other modules) - Remove unused display_name and icon variables - Remove provider block anti-pattern, add skip_xray_version_check - Merge duplicate locals blocks into one - Use sec_issues.total from the API instead of manual sum - Add URL validation for xray_url and image format validation - Improve test with mock Xray server and actual assertions - Clean up README: remove maintainer_github, fix frontmatter, simplify
- Add dedicated jfrog-xray.svg icon based on official JFrog Xray eye/scan design - Remove Variables section from README per review feedback - Update all icon references to use jfrog-xray.svg
The module now outputs vulnerability counts instead of creating coder_metadata internally. This fixes two issues found during testing: 1. coder_metadata defined inside modules does not display in the Coder dashboard 2. Inline provider blocks prevent using count/for_each on the module The caller is now responsible for: - Configuring the xray provider - Creating coder_metadata with the module outputs This matches the pattern used by other registry modules.
matifali
reviewed
Mar 5, 2026
matifali
reviewed
Mar 5, 2026
- Introduced mock servers for local and remote repositories to simulate various scan results. - Added validation tests for required variables: xray_url, xray_token, and image. - Updated README to reflect changes in usage and configuration, including new `use_cache_repo` variable for remote scanning. - Enhanced output variables to include artifact name and policy violations detected. - Improved variable descriptions for clarity and consistency.
matifali
reviewed
Mar 5, 2026
matifali
reviewed
Mar 5, 2026
- Changed the tags in the README to better reflect the module's purpose. - Updated the image variable to use a dynamic reference instead of a hardcoded value. - Enhanced the metadata output to include all outputs for reference
Collaborator
|
I have tested this, and made the final updates we need for this. If you can take a last look I can get this merged and released for us |
- Changed `use_cache_repo` from string to boolean in tests for consistency. - Added provider configuration for `xray` in main.tf to streamline setup. - Removed outdated provider configuration examples from README for clarity.
matifali
approved these changes
Mar 6, 2026
Member
matifali
left a comment
There was a problem hiding this comment.
LGTM. Thanks for testing this extensively.
Collaborator
No Problem! Just for visibility in this PR, I went back to using the provider inside the module, but changed it so the metadata is defined outside the module using the outputs. It still seems to work fine, but you cant assign a count to the jfrog_xray module. Realistically this isn't an issue because all this does is query jfrog and return existing scan results. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a new Terraform module that fetches JFrog Xray vulnerability scanning results for container images stored in Artifactory.
Features
Design Decisions
During testing, we found two issues with the original approach of defining the
xrayprovider andcoder_metadatainside the module:coder_metadatadefined inside modules does not display in the Coder dashboard — this is a known limitationcount/for_eachon the module — which is needed when attaching metadata to resources likedocker_containerthat usestart_countThe module now outputs vulnerability counts instead, and the caller creates the
coder_metadataand configures thexrayprovider in their root template. This matches the pattern used by other registry modules.Usage
Related Issues
Tested with a JFrog Cloud trial instance using Docker remote repository and Xray scanning.