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

scala repotests #184

Merged
merged 1 commit into from
Mar 9, 2025
Merged
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
29 changes: 22 additions & 7 deletions .github/workflows/container-tests.yml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
ruby-samples:
lang-container-tests:
strategy:
fail-fast: false
matrix:
@@ -16,8 +16,7 @@ jobs:
- uses: actions/checkout@v4
- name: setup paths
run: |
mkdir -p repotests
mkdir -p rubyresults
mkdir -p repotests rubyresults scalaresults
- uses: actions/checkout@v4
with:
repository: 'campsite/campsite'
@@ -33,7 +32,12 @@ jobs:
repository: 'OWASP/railsgoat'
path: 'repotests/railsgoat'
ref: 'c1e8ff1e3b24a1c48fcfc9fbee0f65dc296b49d9'
- name: generate usages sbom - bionomia
- uses: actions/checkout@v4
with:
repository: 'playframework/play-samples'
path: 'repotests/play-samples'
ref: '0dccba17856e89dbb5e457ab760efb14cc691395'
- name: generate usages - bionomia
run: |
mkdir -p $GITHUB_WORKSPACE/rubyresults/bionomia
cd repotests/bionomia
@@ -42,26 +46,37 @@ jobs:
docker run --rm -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/appthreat/atom:main atom usages -l ruby -o /app/app.atom -s /app/usages.slices.json /app
ls -lh
cp *.slices.json $GITHUB_WORKSPACE/rubyresults/bionomia
- name: generate usages sbom - railsgoat
- name: generate usages - railsgoat
run: |
mkdir -p $GITHUB_WORKSPACE/rubyresults/railsgoat
cd repotests/railsgoat
docker run --rm -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/appthreat/atom:main atom usages --extract-endpoints -l ruby -o /app/app.atom -s /app/usages.slices.json /app
ls -lh
cp *.slices.json $GITHUB_WORKSPACE/rubyresults/railsgoat
- name: generate usages sbom - campsite
- name: generate usages - campsite
run: |
mkdir -p $GITHUB_WORKSPACE/rubyresults/campsite
cd repotests/campsite/api
docker run --rm -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/appthreat/atom:main atom usages -l ruby -o /app/app.atom -s /app/usages.slices.json /app
ls -lh
cp *.slices.json $GITHUB_WORKSPACE/rubyresults/campsite
- name: generate usages - play-samples
run: |
mkdir -p $GITHUB_WORKSPACE/scalaresults/play-samples
cd repotests/play-samples/play-scala-rest-api-example
docker run --rm -v /tmp:/tmp -v $(pwd):/app:rw -w /app -t ghcr.io/appthreat/atom:main atom usages --extract-endpoints -l scala -o /app/app.atom -s /app/usages.slices.json /app
ls -lh
cp *.slices.json $GITHUB_WORKSPACE/scalaresults/play-samples
- uses: actions/upload-artifact@v4
with:
name: rubyresults
path: rubyresults
if: matrix.os == 'ubuntu-24.04'

- uses: actions/upload-artifact@v4
with:
name: scalaresults
path: scalaresults
if: matrix.os == 'ubuntu-24.04'
npm-latest-tests:
strategy:
fail-fast: false
12 changes: 12 additions & 0 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
@@ -34,6 +34,9 @@ jobs:
distribution: 'temurin'
java-version: '22'
- uses: sbt/setup-sbt@v1
- uses: coursier/setup-action@v1
with:
apps: scala3 scalac
- name: Use Node.js
uses: actions/setup-node@v4
with:
@@ -102,6 +105,9 @@ jobs:
distribution: 'temurin'
java-version: '22'
- uses: sbt/setup-sbt@v1
- uses: coursier/setup-action@v1
with:
apps: scala3 scalac
- name: Use Node.js
uses: actions/setup-node@v4
with:
@@ -201,6 +207,9 @@ jobs:
distribution: 'temurin'
java-version: '22'
- uses: sbt/setup-sbt@v1
- uses: coursier/setup-action@v1
with:
apps: scala3 scalac
- name: Use Node.js
uses: actions/setup-node@v4
with:
@@ -270,6 +279,9 @@ jobs:
distribution: 'temurin'
java-version: '22'
- uses: sbt/setup-sbt@v1
- uses: coursier/setup-action@v1
with:
apps: scala3 scalac
- name: Use Node.js
uses: actions/setup-node@v4
with:
24 changes: 24 additions & 0 deletions .github/workflows/nodejstests.yml
Original file line number Diff line number Diff line change
@@ -55,13 +55,21 @@ jobs:
repository: 'OWASP/railsgoat'
path: 'repotests/railsgoat'
ref: 'c1e8ff1e3b24a1c48fcfc9fbee0f65dc296b49d9'
- uses: actions/checkout@v4
with:
repository: 'playframework/play-samples'
path: 'repotests/play-samples'
ref: '0dccba17856e89dbb5e457ab760efb14cc691395'
- uses: coursier/cache-action@v6
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java-version }}
- uses: sbt/setup-sbt@v1
- uses: coursier/setup-action@v1
with:
apps: scala3 scalac
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
@@ -82,6 +90,7 @@ jobs:
if: runner.os == 'Linux'
- run: |
sbt stage createDistribution
python -m pip install atom-tools
cd wrapper/nodejs
bash build.sh
sudo npm install -g .
@@ -96,6 +105,7 @@ jobs:
atom -l c -o ${GITHUB_WORKSPACE}/repotests/libexpat/app.atom ${GITHUB_WORKSPACE}/repotests/libexpat
atom -o ${GITHUB_WORKSPACE}/repotests/railsgoat/app.atom -l ruby ${GITHUB_WORKSPACE}/repotests/railsgoat
atom -o ${GITHUB_WORKSPACE}/repotests/bionomia/app.atom -l ruby ${GITHUB_WORKSPACE}/repotests/bionomia
atom -o ${GITHUB_WORKSPACE}/repotests/play-samples/play-scala-rest-api-example/app.atom -l scala ${GITHUB_WORKSPACE}/repotests/play-samples/play-scala-rest-api-example
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
nodejs-testing-windows:
@@ -110,6 +120,10 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: actions/checkout@v4
with:
repository: 'ShiftLeftSecurity/shiftleft-java-example'
@@ -130,17 +144,26 @@ jobs:
with:
repository: 'HooliCorp/DjanGoat'
path: 'repotests/DjanGoat'
- uses: actions/checkout@v4
with:
repository: 'playframework/play-samples'
path: 'repotests/play-samples'
ref: '0dccba17856e89dbb5e457ab760efb14cc691395'
- uses: coursier/cache-action@v6
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java-version }}
- uses: sbt/setup-sbt@v1
- uses: coursier/setup-action@v1
with:
apps: scala3 scalac
- name: build
shell: pwsh
run: |
sbt stage createDistribution
python -m pip install atom-tools
cd wrapper\\nodejs
copy ..\..\target\atom.zip plugins\
Expand-Archive -Path ..\..\target\atom.zip -DestinationPath plugins\ -Force
@@ -161,6 +184,7 @@ jobs:
atom -l python --remove-atom -o $env:GITHUB_WORKSPACE\\repotests\\DjanGoat\\app.atom $env:GITHUB_WORKSPACE\\repotests\\DjanGoat
atom parsedeps --remove-atom -l python -o $env:GITHUB_WORKSPACE\\repotests\\DjanGoat\\app.atom $env:GITHUB_WORKSPACE\\repotests\\DjanGoat
atom -l c -o $env:GITHUB_WORKSPACE\\repotests\\libexpat\\app.atom $env:GITHUB_WORKSPACE\\repotests\\libexpat
atom -l scala -o $env:GITHUB_WORKSPACE\\repotests\\play-samples\\play-scala-rest-api-example\\app.atom $env:GITHUB_WORKSPACE\\repotests\\play-samples\\play-scala-rest-api-example
- name: test3
shell: cmd
run: |
3 changes: 3 additions & 0 deletions .github/workflows/npm-release.yml
Original file line number Diff line number Diff line change
@@ -31,6 +31,9 @@ jobs:
distribution: 'temurin'
java-version: '21'
- uses: sbt/setup-sbt@v1
- uses: coursier/setup-action@v1
with:
apps: scala3 scalac
- name: Build
run: |
sudo apt update -y
3 changes: 3 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -61,6 +61,9 @@ jobs:
native-image-job-reports: 'true'
cache: 'sbt'
- uses: sbt/setup-sbt@v1
- uses: coursier/setup-action@v1
with:
apps: scala3 scalac
- run: |
sbt stage createDistribution
cd wrapper/nodejs
9 changes: 9 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -73,6 +73,9 @@ jobs:
native-image-job-reports: 'true'
cache: 'sbt'
- uses: sbt/setup-sbt@v1
- uses: coursier/setup-action@v1
with:
apps: scala3 scalac
- uses: oras-project/setup-oras@v1
- run: |
wget https://github.com/upx/upx/releases/download/v5.0.0/upx-5.0.0-amd64_linux.tar.xz
@@ -145,6 +148,9 @@ jobs:
native-image-job-reports: 'true'
cache: 'sbt'
- uses: sbt/setup-sbt@v1
- uses: coursier/setup-action@v1
with:
apps: scala3 scalac
- uses: oras-project/setup-oras@v1
- run: |
wget https://github.com/upx/upx/releases/download/v5.0.0/upx-5.0.0-arm64_linux.tar.xz
@@ -199,6 +205,9 @@ jobs:
native-image-job-reports: 'true'
cache: 'sbt'
- uses: sbt/setup-sbt@v1
- uses: coursier/setup-action@v1
with:
apps: scala3 scalac
- uses: oras-project/setup-oras@v1
- run: |
brew install coreutils
17 changes: 16 additions & 1 deletion .github/workflows/repotests.yml
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ name: repotests
on:
push:
branches:
- main
- feature/*
workflow_dispatch:
concurrency:
@@ -70,13 +69,21 @@ jobs:
repository: 'OWASP/railsgoat'
path: 'repotests/railsgoat'
ref: 'c1e8ff1e3b24a1c48fcfc9fbee0f65dc296b49d9'
- uses: actions/checkout@v4
with:
repository: 'playframework/play-samples'
path: 'repotests/play-samples'
ref: '0dccba17856e89dbb5e457ab760efb14cc691395'
- uses: coursier/cache-action@v6
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java-version }}
- uses: sbt/setup-sbt@v1
- uses: coursier/setup-action@v1
with:
apps: scala3 scalac
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
@@ -135,6 +142,14 @@ jobs:
./atom.sh usages --extract-endpoints --remove-atom -o /tmp/railsgoat2.atom -l ruby $GITHUB_WORKSPACE/repotests/railsgoat -Dlog4j.configurationFile=log4j2.xml --slice-outfile /tmp/railsgoat2.usages.json
./atom.sh usages --remove-atom -o /tmp/bionomia2.atom -l ruby $GITHUB_WORKSPACE/repotests/bionomia -Dlog4j.configurationFile=log4j2.xml --slice-outfile /tmp/bionomia2.usages.json
./atom.sh --remove-atom -o /tmp/java-sec-code.atom -l java $GITHUB_WORKSPACE/repotests/java-sec-code -Dlog4j.configurationFile=log4j2.xml -x --export-dir gml_exports

./atom.sh --remove-atom -o /tmp/play-scala-slick-example.atom -l scala $GITHUB_WORKSPACE/repotests/play-samples/play-scala-slick-example
ls -lh $GITHUB_WORKSPACE/repotests/play-samples/play-scala-slick-example
./atom.sh --remove-atom -o /tmp/play-scala-rest-api-example.atom -l scala $GITHUB_WORKSPACE/repotests/play-samples/play-scala-rest-api-example
./atom.sh usages --extract-endpoints --remove-atom -o /tmp/play-scala-rest-api-example.atom -l scala $GITHUB_WORKSPACE/repotests/play-samples/play-scala-rest-api-example --slice-outfile /tmp/scala-rest.usages.json
ls -lh $GITHUB_WORKSPACE/repotests/play-samples/play-scala-rest-api-example
./atom.sh --remove-atom -o /tmp/play-scala-grpc-example.atom -l scala $GITHUB_WORKSPACE/repotests/play-samples/play-scala-grpc-example
ls -lh $GITHUB_WORKSPACE/repotests/play-samples/play-scala-grpc-example
ls -lh .
if: runner.os != 'Windows'
env:
2 changes: 2 additions & 0 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -114,4 +114,6 @@ RUN unzip -q atom.zip \
&& rbastgen --help \
&& microdnf clean all

WORKDIR /app

CMD ["/opt/bin/atom"]
2 changes: 2 additions & 0 deletions ci/Dockerfile.sle
Original file line number Diff line number Diff line change
@@ -96,4 +96,6 @@ RUN unzip -q atom.zip \
&& rbastgen --help \
&& zypper clean -a

WORKDIR /app

CMD ["/opt/bin/atom"]
13 changes: 10 additions & 3 deletions src/main/scala/io/appthreat/atom/Atom.scala
Original file line number Diff line number Diff line change
@@ -540,9 +540,16 @@ object Atom:
)
result match
case Success(_) =>
println(
s"Semantic slices file '${semanticSlicesFile}' created successfully."
)
if File(semanticSlicesFile).exists then
println(
s"Semantic slices file '${semanticSlicesFile}' created successfully."
)
else{
println(s"scalasem ${workDir} ${semanticSlicesFile}")
println(
s"scalasem command did not produce the semantic slices file."
)
}
case Failure(exception) =>
println(
s"Failed to run scalasem. Use the atom container image and re-run this command. Exception: ${exception.getMessage}"
6 changes: 1 addition & 5 deletions wrapper/nodejs/scalasem.js
Original file line number Diff line number Diff line change
@@ -15,14 +15,10 @@ import {
} from "node:fs";

function main(argvs) {
if (!detectScala()) {
if (!detectScala() && !detectScalac()) {
console.warn("Scala is not installed!");
return false;
}
if (!detectScalac()) {
console.warn("Scalac is not installed!");
return false;
}
let configFiles = getAllFiles(argvs[0], "routes");
configFiles = configFiles.concat(getAllFiles(argvs[0], ".conf"));
let tastyFiles = getAllFiles(argvs[0], ".tasty");