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

Fix!: setup gradle run and allow lists #42

Merged
merged 14 commits into from
Oct 15, 2024
Merged

Fix!: setup gradle run and allow lists #42

merged 14 commits into from
Oct 15, 2024

Conversation

cvaskinn
Copy link
Contributor

@cvaskinn cvaskinn commented Oct 10, 2024

  • Fixes bug with setup gradle running even when not supposed to.
  • Allowlist adhere to new spec.
  • Cleanup of documentation.
  • Added support for ARTIFACTORY_URL.
  • Added support for new artifactory token. Closes: API_KEY is deprecated, add ARTIFACTORY_AUTH_TOKEN #41
  • Only prints setup-gradle summary on failure

BREAKING CHANGES:

  • Old allowlists will stop working

@cvaskinn cvaskinn requested a review from a team as a code owner October 10, 2024 10:36
@cvaskinn cvaskinn changed the title Fix/setup gradle run and allow lists Fix: setup gradle run and allow lists Oct 10, 2024
@cvaskinn cvaskinn changed the title Fix: setup gradle run and allow lists Fix!: setup gradle run and allow lists Oct 11, 2024
'allowlist': {
'required' : False,
'type': 'list',
'minlength': 1,
Copy link
Contributor

Choose a reason for hiding this comment

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

'minlength': 1 kan fjernes. Allowlist vil nok endre seg over tid, så det kan hende at utviklere har satt en tom allowlist fra en tid til en annen.

run: |
python -c "
import yaml
from cerberus import Validator
import sys
import os

_config_file_names = ('dockerscan.yml', 'dockerscan.yaml')
_file_location = '.entur/security'

schema = {
'apiVersion': {'type': 'string', 'required': True},
Copy link
Contributor

Choose a reason for hiding this comment

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

Sett allowed values til entur.io/securitytools/v1 (https://docs.python-cerberus.org/validation-rules.html#allowed)


Some potential pitfalls and solutions with CodeQL

### Autobuild fails for Gradle projects because of JVM versions
Copy link
Contributor

Choose a reason for hiding this comment

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

### Autobuild fails for Gradle projects because of JVM versions
->
### Autobuild fails for Gradle projects because of JVM version mismatch

@@ -363,22 +370,28 @@ jobs:
import sys
import os

_config_file_names = ('codescan.yml', 'codescan.yaml')
_file_location = '.entur/security'

schema = {
'apiVersion': {'type': 'string', 'required': True},
Copy link
Contributor

Choose a reason for hiding this comment

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

Sett allowed values til entur.io/securitytools/v1 (https://docs.python-cerberus.org/validation-rules.html#allowed)

@@ -332,8 +339,8 @@ jobs:
'Authorization': f'token {external_token}'
}

for file_name in ('code_scan_config.yml', 'code_scan_config.yaml'):
response = requests.get(f'https://api.github.com/repos/entur/{external_repository}/contents/{file_name}', headers=headers)
for file_name in 'code_scan_config.yml', 'code_scan_config.yaml':
Copy link
Contributor

Choose a reason for hiding this comment

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

-> for file_name in _config_file_names:

@@ -158,7 +170,7 @@ jobs:
if os.getenv('GHA_SECURITY_DOCKER_SCAN_EXTERNAL_ALLOWLIST') == 'True':
data = ''
try:
with open('external_docker_scan_config.yml', 'r') as f:
with open(os.path.join(_file_location, 'external_docker_scan_config.yml'), 'r') as f:
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename filen til external_dockerscan.yml.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ikke noe problem, men hva er argumentasjonen for å bytte navnet når den har hatt det siden starten?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ikke noe annen grunn enn at det gir mer mening når man leser koden. I.e. det er enklere å skjønne at det er en kopi av codescan.yml som hentes eksternt.

allowlist = {}

try:
with open('external_docker_scan_config', 'r') as f:
with open(os.path.join(_file_location, 'external_docker_scan_config'), 'r') as f:
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename filen til external_dockerscan.yml. Er forsåvidt også en bug her i originalen (.yml extension mangler).

.github/workflows/code-scan.yml Show resolved Hide resolved
_config_file_names = ('dockerscan.yml', 'dockerscan.yaml')
_file_location = '.entur/security'

for file_name in :
Copy link
Contributor

Choose a reason for hiding this comment

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

Antar du mener for file_name in _config_file_names:

.github/workflows/docker-scan.yml Show resolved Hide resolved
@cvaskinn cvaskinn requested a review from EnturWilhelm October 15, 2024 07:58
@cvaskinn cvaskinn force-pushed the fix/setup_gradle_run branch from f207ced to 9a593d3 Compare October 15, 2024 08:13
Copy link
Contributor

@EnturWilhelm EnturWilhelm left a comment

Choose a reason for hiding this comment

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

Fix this then we good.

allowlist = {}

try:
with open('external_docker_scan_config', 'r') as f:
with open(os.path.join(_file_location, 'external_dockerscan'), 'r') as f:
Copy link
Contributor

Choose a reason for hiding this comment

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

Mangler .yml extension.

@cvaskinn cvaskinn merged commit 9039eed into main Oct 15, 2024
2 checks passed
@cvaskinn cvaskinn deleted the fix/setup_gradle_run branch October 15, 2024 08:32
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.

API_KEY is deprecated, add ARTIFACTORY_AUTH_TOKEN
2 participants