Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New XSC analytics metrics capabilities #1165

Merged
merged 90 commits into from
Apr 3, 2024

Conversation

gailazar300
Copy link
Contributor

@gailazar300 gailazar300 commented Mar 31, 2024

  • All tests passed. If this feature is not already covered by the tests, I added new tests.
  • All static analysis checks passed.
  • This pull request is on the dev branch.
  • I used gofmt for formatting the code before submitting the pull request.

  1. Add XscAuthConfig.
  2. Add XSCmock server.
  3. Add technology to language mapping.

depends on: jfrog/jfrog-client-go#928

omerzi and others added 30 commits April 5, 2023 10:15
* Improve UI for scan command (jfrog#706)

* Upgrade go version in go.mod to 1.20 (jfrog#732)

* Fix lint issues found (jfrog#733)

* Config transfer - ensure target not older than source (jfrog#721)

* Update tests environment - nuget and dotnet to version 6  (jfrog#734)

* Flatten audit graph (jfrog#736)

* Use gradle-dep-tree with Audit (jfrog#719)

---------

Co-authored-by: Sara Omari <[email protected]>
Co-authored-by: Eyal Ben Moshe <[email protected]>
Co-authored-by: Michael Sverdlov <[email protected]>
Co-authored-by: Yahav Itzhak <[email protected]>
# Conflicts:
#	.github/workflows/analysis.yml
#	go.mod
#	go.sum
#	xray/audit/java/gradle.go
#	xray/commands/audit/generic/auditmanager.go
@gailazar300 gailazar300 changed the base branch from master to dev March 31, 2024 07:06
Copy link
Contributor

@attiasas attiasas left a comment

Choose a reason for hiding this comment

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

Update the PR name to fit the changes better.
Add at the description the changes that were made.

utils/config/config.go Outdated Show resolved Hide resolved
utils/config/config.go Outdated Show resolved Hide resolved
utils/config/config.go Outdated Show resolved Hide resolved
utils/coreutils/techutils.go Outdated Show resolved Hide resolved
utils/coreutils/techutils.go Outdated Show resolved Hide resolved
Copy link
Contributor

@attiasas attiasas left a comment

Choose a reason for hiding this comment

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

Add tests to check connection of language and tech at techutils_test.go

@gailazar300 gailazar300 changed the title Add XSC authentication config Add XSC analytics metrics capabilities Mar 31, 2024
Comment on lines 78 to 86

func CreateXscRestsMockServer(t *testing.T, testHandler restsTestHandler) (*httptest.Server, *config.ServerDetails, artifactory.ArtifactoryServicesManager) {
testServer := CreateRestsMockServer(testHandler)
serverDetails := &config.ServerDetails{Url: testServer.URL + "/", XrayUrl: testServer.URL + "/xray/"}

serviceManager, err := utils.CreateServiceManager(serverDetails, -1, 0, false)
assert.NoError(t, err)
return testServer, serverDetails, serviceManager
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be created at: jfrog/jfrog-cli-security#47
where it is used. We probably will only use mocks for Xray in our repository
added to tests/utils/test_utils.go / tests/utils/test_config.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

all other mocks are there, so it makes sense that they will all be together in the same place.

@@ -572,6 +573,7 @@ type ServerDetails struct {
ArtifactoryUrl string `json:"artifactoryUrl,omitempty"`
DistributionUrl string `json:"distributionUrl,omitempty"`
XrayUrl string `json:"xrayUrl,omitempty"`
XscUrl string `json:"xscUrl,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you add that if it is never used?
at client-go you are using GetUrl() and you are setings using the value at XrayUrl

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we use this field for logic in security-cli

Comment on lines 40 to 55
func TechnologyToLanguage(technology Technology) CodeLanguage {
languageMap := map[Technology]CodeLanguage{
Npm: JavaScript,
Pip: Python,
Poetry: Python,
Pipenv: Python,
Go: GoLang,
Maven: Java,
Gradle: Java,
Nuget: CSharp,
Dotnet: CSharp,
Yarn: JavaScript,
Pnpm: JavaScript,
}
return languageMap[technology]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of this func, you can attach the value directly to the TechData as new attribute Language CodeLanguage

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't understand your comment, but what is wrong with this implementation?

@attiasas attiasas added improvement Automatically generated release notes new feature Automatically generated release notes and removed improvement Automatically generated release notes labels Apr 2, 2024
@eyalbe4 eyalbe4 changed the title Add XSC analytics metrics capabilities New XSC analytics metrics capabilities Apr 2, 2024
@eyalbe4 eyalbe4 added improvement Automatically generated release notes and removed new feature Automatically generated release notes labels Apr 2, 2024
Copy link
Contributor

@eyalbe4 eyalbe4 left a comment

Choose a reason for hiding this comment

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

The code introduced in this PR should be added to the jfrog-cli-security project.

Copy link
Contributor

github-actions bot commented Apr 3, 2024

👍 Frogbot scanned this pull request and did not find any new security issues.


@eyalbe4 eyalbe4 merged commit 65190e6 into jfrog:dev Apr 3, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Automatically generated release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.