Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Init scan action
uses: Traceableai/ast-action@main
uses: Traceableai/ast-action@test2
with:
step_name: 'init'
client_scan_token: ${{ secrets.CLIENT_SCAN_TOKEN }}
traffic_env: 'samarth-crapi'
client_scan_token: "${{ secrets.CLIENT_SCAN_TOKEN }}"
traffic_env: 'samarth-crapi11'
traceable_server: ${{ secrets.TRACEABLE_SERVER }}
traceable_cli_download_path: https://downloads.traceable.ai/cli/rc/latest/traceable-cli-latest-linux-x86_64.tar.gz
- name: Run a loop as functional test
Expand All @@ -30,7 +30,7 @@ jobs:
with:
step_name: 'run'
client_scan_token: ${{ secrets.CLIENT_SCAN_TOKEN }}
traffic_env: 'samarth-crapi'
traffic_env: 'samarth-crapi11'
cli_version: 'latest'
- name: Abort Scan
uses: Traceableai/ast-action@main
Expand Down
22 changes: 6 additions & 16 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,22 +184,17 @@ runs:
traceableCliBinaryLocation=${GITHUB_WORKSPACE}/traceable

scanInitCmd=$traceableCliBinaryLocation' ast scan initAndRun'
optionsArr=('--scan-name' '--traffic-env' '--token' '--plugins' '--exclude-url-regex' '--target-url' '--traceable-server' '--idle-timeout' '--scan-timeout' ' --reference-env' '--max-retries' '--openapi-spec-ids' '--openapi-spec-files' '--policy' '--postman-collection' '--postman-environment' '--include-endpoint-labels' '--exclude-endpoint-labels' '--include-endpoint-with-owner-attributes' '--include-endpoint-owners' '--loglevel')
optionsArr=('--scan-name' '--traffic-env' '--token' '--plugins' '--include-url-regex' '--exclude-url-regex' '--target-url' '--traceable-server' '--idle-timeout' '--scan-timeout' ' --reference-env' '--max-retries' '--openapi-spec-ids' '--openapi-spec-files' '--policy' '--postman-collection' '--postman-environment' '--include-endpoint-labels' '--exclude-endpoint-labels' '--include-endpoint-with-owner-attributes' '--include-endpoint-owners' '--loglevel')

#Iterating the options available from options array and filling them with the arguments received in order
iterator=0
for option in '${{ inputs.scan_name }}' '${{ inputs.traffic_env }}' '${{ inputs.client_scan_token }}' '${{ inputs.plugins }}' '${{ inputs.exclude_url_regex }}' '${{ inputs.target_url }}' '${{ inputs.traceable_server }}' '${{ inputs.idle_timeout }}' '${{ inputs.scan_timeout }}' '${{ inputs.reference_env }}' '${{ inputs.max_retries }}' '${{ inputs.openapi_spec_ids }}' '${{ inputs.openapi_spec_files }}' '${{ inputs.policy }}' '${{ inputs.postman_collection }}' '${{ inputs.postman_environment }}' '${{ inputs.include_endpoint_labels}}' '${{ inputs.exclude_endpoint_labels }}' '${{ inputs.include_endpoint_with_owner_attributes }}' '${{ inputs.include_endpoint_owners }}' '${{ inputs.log_level }}'
for option in '${{ inputs.scan_name }}' '${{ inputs.traffic_env }}' '${{ inputs.client_scan_token }}' '${{ inputs.plugins }}' '${{ inputs.include_url_regex }}' '${{ inputs.exclude_url_regex }}' '${{ inputs.target_url }}' '${{ inputs.traceable_server }}' '${{ inputs.idle_timeout }}' '${{ inputs.scan_timeout }}' '${{ inputs.reference_env }}' '${{ inputs.max_retries }}' '${{ inputs.openapi_spec_ids }}' '${{ inputs.openapi_spec_files }}' '${{ inputs.policy }}' '${{ inputs.postman_collection }}' '${{ inputs.postman_environment }}' '${{ inputs.include_endpoint_labels}}' '${{ inputs.exclude_endpoint_labels }}' '${{ inputs.include_endpoint_with_owner_attributes }}' '${{ inputs.include_endpoint_owners }}' '${{ inputs.log_level }}'
do
if [ -z "$option" ] || [ "$option" = "''" ] || [ "$option" = "NULL" ]
then
echo "${optionsArr[$iterator]}" is Null
else
if [ "${optionsArr[$iterator]}" = "--include-url-regex" ] || [ "${optionsArr[$iterator]}" = "--exclude-url-regex" ]
then
scanInitCmd=$scanInitCmd" "${optionsArr[$iterator]}" \"${option}\""
else
scanInitCmd=$scanInitCmd" "${optionsArr[$iterator]}" "${option}
fi
scanInitCmd=$scanInitCmd" "${optionsArr[$iterator]}" "${option}
fi
iterator=$(($iterator+1))
done
Expand Down Expand Up @@ -241,22 +236,17 @@ runs:
traceableCliBinaryLocation=${GITHUB_WORKSPACE}/traceable

scanInitCmd=$traceableCliBinaryLocation' ast scan init '
optionsArr=('--scan-name' '--traffic-env' '--token' '--plugins' '--exclude-url-regex' '--target-url' '--traceable-server' '--scan-timeout' ' --reference-env' '--openapi-spec-ids' '--openapi-spec-files' '--policy' '--include-endpoint-labels' '--exclude-endpoint-labels' '--include-endpoint-with-owner-attributes' '--include-endpoint-owners' '--loglevel')
optionsArr=('--scan-name' '--traffic-env' '--token' '--plugins' '--include-url-regex' '--exclude-url-regex' '--target-url' '--traceable-server' '--scan-timeout' ' --reference-env' '--openapi-spec-ids' '--openapi-spec-files' '--policy' '--include-endpoint-labels' '--exclude-endpoint-labels' '--include-endpoint-with-owner-attributes' '--include-endpoint-owners' '--loglevel')

#Iterating the options available from options array and filling them with the arguments received in order
iterator=0
for option in '${{ inputs.scan_name }}' '${{ inputs.traffic_env }}' '${{ inputs.client_scan_token }}' '${{ inputs.plugins }}' '${{ inputs.exclude_url_regex }}' '${{ inputs.target_url }}' '${{ inputs.traceable_server }}' '${{ inputs.scan_timeout }}' '${{ inputs.reference_env }}' '${{ inputs.openapi_spec_ids }}' '${{ inputs.openapi_spec_files }}' '${{ inputs.policy }}' '${{ inputs.include_endpoint_labels}}' '${{ inputs.exclude_endpoint_labels }}' '${{ inputs.include_endpoint_with_owner_attributes }}' '${{ inputs.include_endpoint_owners }}' '${{ inputs.log_level }}'
for option in '${{ inputs.scan_name }}' '${{ inputs.traffic_env }}' '${{ inputs.client_scan_token }}' '${{ inputs.plugins }}' '${{ inputs.include_url_regex }}' '${{ inputs.exclude_url_regex }}' '${{ inputs.target_url }}' '${{ inputs.traceable_server }}' '${{ inputs.scan_timeout }}' '${{ inputs.reference_env }}' '${{ inputs.openapi_spec_ids }}' '${{ inputs.openapi_spec_files }}' '${{ inputs.policy }}' '${{ inputs.include_endpoint_labels}}' '${{ inputs.exclude_endpoint_labels }}' '${{ inputs.include_endpoint_with_owner_attributes }}' '${{ inputs.include_endpoint_owners }}' '${{ inputs.log_level }}'
do
if [ -z "$option" ] || [ "$option" = "''" ] || [ "$option" = "NULL" ]
then
echo "${optionsArr[$iterator]}" is Null
else
if [ "${optionsArr[$iterator]}" = "--include-url-regex" ] || [ "${optionsArr[$iterator]}" = "--exclude-url-regex" ]
then
scanInitCmd=$scanInitCmd" "${optionsArr[$iterator]}" \"${option}\""
else
scanInitCmd=$scanInitCmd" "${optionsArr[$iterator]}" "${option}
fi
scanInitCmd=$scanInitCmd" "${optionsArr[$iterator]}" "${option}
fi
iterator=$(($iterator+1))
done
Expand Down