Skip to content

Conversation

@cx-ben-alvo
Copy link
Collaborator

@cx-ben-alvo cx-ben-alvo commented Nov 28, 2024

By submitting a PR to this repository, you agree to the terms within the Checkmarx Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.

Description

When PACKAGE_ENFORCEMENT_ENABLED FF is off, we don't need to check the license, but return true.

References

https://checkmarx.atlassian.net/browse/AST-76112

Testing

Added unit test

Checklist

  • I have added documentation for new/changed functionality in this PR (if applicable).
  • I have updated the CLI help for new/changed functionality in this PR (if applicable).
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used

…bled is set to false because that means that user has license for everything
@OrShamirCM OrShamirCM requested a review from a team November 28, 2024 11:01
@github-actions github-actions bot added bug Something isn't working fix labels Nov 28, 2024
@cx-ben-alvo cx-ben-alvo changed the title Change IsAllowedEngine func to return true when packageEnforcementEnabled is set to false because that means that user has license for everything Change IsAllowedEngine func to return true when packageEnforcementEnabled is false Nov 28, 2024
@github-actions
Copy link

github-actions bot commented Nov 28, 2024

Logo
Checkmarx One – Scan Summary & Detailse20d0900-241b-4a89-8e22-7e09e4d8aa65

No New Or Fixed Issues Found

@cx-ben-alvo cx-ben-alvo changed the title Change IsAllowedEngine func to return true when packageEnforcementEnabled is false Change IsAllowedEngine func to return true when packageEnforcementEnabled is false (AST-76112) Dec 1, 2024
_ = wrapperParams.ASCAWrapper.ShutDown()
}

func TestCreateASCAScanRequest_CheckLicenseWhenPackageEnforcementFFOff_SuccessWithNilError(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

rename to use the key words when, should

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But this test name is obvious and according to our conventions

Copy link
Contributor

Choose a reason for hiding this comment

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

should be something like:
TestCreateASCAScanRequest_whenCheckLicenseWithPackageEnforcementFFOff_shouldSuccess

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe return
if !flagResponse.Status {
return true, nil
}
jwtStruct, err := getJwtStruct()...

Early return if the feature flag is disabled, to avoid unnecessary nested logic

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good idea!

@cx-ben-alvo
Copy link
Collaborator Author

Test are not passing because stability issue in IAC-Security engine

@cx-ben-alvo cx-ben-alvo merged commit 4847d70 into main Dec 3, 2024
8 of 9 checks passed
@cx-ben-alvo cx-ben-alvo deleted the fix/benalvo/true-for-no-package-enforcement branch December 3, 2024 14:41
cx-anjali-deore pushed a commit that referenced this pull request Jul 3, 2025
…bled is false (AST-76112) (#951)

* Change IsAllowedEngine func to return true when packageEnforcementEnabled is set to false because that means that user has license for everything

* remove unneeded feature flag call to package enforcement enabled

* revert las commit

* add the fix prefix to branch name as valid prefix in the pr linter

* add unitest

* code owners

* change test name

* resolve conversation

* resolve conversation

* fix bfl test

---------

Co-authored-by: AlvoBen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants