Skip to content

Commit

Permalink
fixes the casing for detections and mime-types (#399)
Browse files Browse the repository at this point in the history
* fixes the casing for detections and mime-types

* update java github actions

* gradle/gradle-build-action@v3 v4 does not exist

* updates python ci action

* replace rust toolchain action

* add path to go.mod file

* add path to go.sum

* only use the go-version-file parameter

* the rust-cache action has no parameter working-directory

---------

Co-authored-by: PT-ATA No One <[email protected]>
  • Loading branch information
unglaublicherdude and ata-no-one authored Mar 14, 2024
1 parent dadea1b commit 70e6e53
Show file tree
Hide file tree
Showing 28 changed files with 80 additions and 72 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci-dotnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ on:
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{secrets.CLIENT_SECRET}}
VAAS_URL: 'wss://gateway.production.vaas.gdatasecurity.de'
TOKEN_URL: 'https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token'
VAAS_URL: "wss://gateway.production.vaas.gdatasecurity.de"
TOKEN_URL: "https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token"
VAAS_CLIENT_ID: ${{ secrets.VAAS_CLIENT_ID }}
VAAS_USER_NAME: ${{ secrets.VAAS_USER_NAME }}
VAAS_PASSWORD: ${{secrets.VAAS_PASSWORD}}
Expand All @@ -43,8 +43,8 @@ jobs:
dotnet-version: ["8.0.x"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: set staging environment
if: (inputs.environment == 'staging' || (startsWith(github.ref, 'refs/tags/cs') && endsWith(github.ref, '-beta')))
run: |
Expand Down Expand Up @@ -105,9 +105,9 @@ jobs:
run: dotnet run UrlScan
working-directory: dotnet/examples/VaasExample

- name: Run example HashsumScan
- name: Run example HashsumScan
run: dotnet run HashsumScan
working-directory: dotnet/examples/VaasExample
working-directory: dotnet/examples/VaasExample

- name: Pack
if: startsWith(github.ref, 'refs/tags/cs')
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/ci-java-legacy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: set staging environment
if: (inputs.environment == 'staging' || (startsWith(github.ref, 'refs/tags/java') && endsWith(github.ref, '-beta')))
Expand All @@ -66,18 +66,18 @@ jobs:
echo "VAAS_PASSWORD=${{ secrets.DEVELOP_VAAS_PASSWORD }}" >> $GITHUB_ENV
- name: install Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: "11"
distribution: "temurin"

- name: setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
gradle-version: "8.1"

- name: run tests
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
arguments: test
gradle-version: "8.1"
Expand All @@ -86,14 +86,14 @@ jobs:
#- name: run examples for file
# env:
# SCAN_PATH: "src/main/java/de/gdata/vaasexample/Main.java"
# uses: gradle/gradle-build-action@v2
# uses: gradle/gradle-build-action@v3
# with:
# arguments: fileScan
# gradle-version: "8.1"
# build-root-directory: java/examples/VaasExample

#- name: run examples for url
# uses: gradle/gradle-build-action@v2
# uses: gradle/gradle-build-action@v3
# with:
# arguments: urlScan
# gradle-version: "8.1"
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
ORG_GRADLE_PROJECT_password: ${{ secrets.ORG_GRADLE_PROJECT_PASSWORD }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
arguments: publish
gradle-version: "8.1"
Expand All @@ -133,7 +133,7 @@ jobs:
env:
ORG_GRADLE_PROJECT_username: ${{ secrets.ORG_GRADLE_PROJECT_USERNAME }}
ORG_GRADLE_PROJECT_password: ${{ secrets.ORG_GRADLE_PROJECT_PASSWORD }}
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
arguments: closeAndReleaseRepository
gradle-version: "8.1"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-java.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: set staging environment
if: (inputs.environment == 'staging' || (startsWith(github.ref, 'refs/tags/java') && endsWith(github.ref, '-beta')))
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci-php.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
version: ["8.1", "8.2", "8.3"]
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: set staging environment
if: (inputs.environment == 'staging' || (startsWith(github.ref, 'refs/tags/php') && endsWith(github.ref, '-beta')))
Expand All @@ -65,7 +65,7 @@ jobs:
echo "TOKEN_URL=https://account-staging.gdata.de/realms/vaas-develop/protocol/openid-connect/token" >> $GITHUB_ENV
echo "VAAS_CLIENT_ID=${{ secrets.DEVELOP_VAAS_CLIENT_ID }}" >> $GITHUB_ENV
echo "VAAS_USER_NAME=${{ secrets.DEVELOP_VAAS_USER_NAME }}" >> $GITHUB_ENV
echo "VAAS_PASSWORD=${{ secrets.DEVELOP_VAAS_PASSWORD }}" >> $GITHUB_ENV
echo "VAAS_PASSWORD=${{ secrets.DEVELOP_VAAS_PASSWORD }}" >> $GITHUB_ENV
- name: setup PHP with PECL extension
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
- name: checkout
if: startsWith(github.ref, 'refs/tags/php')
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: publish on site repo
if: startsWith(github.ref, 'refs/tags/php')
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: set staging environment
if: (inputs.environment == 'staging' || (startsWith(github.ref, 'refs/tags/py') && endsWith(github.ref, '-beta')))
Expand All @@ -65,7 +65,7 @@ jobs:
echo "VAAS_PASSWORD=${{ secrets.DEVELOP_VAAS_PASSWORD }}" >> $GITHUB_ENV
- name: set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-ruby.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1" # Not needed with a .ruby-version file
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci-rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: set staging environment
if: (inputs.environment == 'staging' || (startsWith(github.ref, 'refs/tags/rs') && endsWith(github.ref, '-beta')))
Expand All @@ -63,16 +63,16 @@ jobs:
echo "TOKEN_URL=https://account-staging.gdata.de/realms/vaas-develop/protocol/openid-connect/token" >> $GITHUB_ENV
echo "VAAS_CLIENT_ID=${{ secrets.DEVELOP_VAAS_CLIENT_ID }}" >> $GITHUB_ENV
echo "VAAS_USER_NAME=${{ secrets.DEVELOP_VAAS_USER_NAME }}" >> $GITHUB_ENV
echo "VAAS_PASSWORD=${{ secrets.DEVELOP_VAAS_PASSWORD }}" >> $GITHUB_ENV
echo "VAAS_PASSWORD=${{ secrets.DEVELOP_VAAS_PASSWORD }}" >> $GITHUB_ENV
- name: install Rust stable
uses: actions-rs/toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- uses: Swatinem/rust-cache@v2
with:
working-directory: rust
workspaces: rust

- name: run tests
run: cargo test
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci-typescript.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ on:
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{secrets.CLIENT_SECRET}}
VAAS_URL: 'wss://gateway.production.vaas.gdatasecurity.de'
TOKEN_URL: 'https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token'
VAAS_URL: "wss://gateway.production.vaas.gdatasecurity.de"
TOKEN_URL: "https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token"
VAAS_CLIENT_ID: ${{ secrets.VAAS_CLIENT_ID }}
VAAS_USER_NAME: ${{ secrets.VAAS_USER_NAME }}
VAAS_PASSWORD: ${{secrets.VAAS_PASSWORD}}
Expand All @@ -41,7 +41,7 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: set staging environment
if: (inputs.environment == 'staging' || (startsWith(github.ref, 'refs/tags/ts') && endsWith(github.ref, '-beta')))
Expand All @@ -63,7 +63,7 @@ jobs:
echo "TOKEN_URL=https://account-staging.gdata.de/realms/vaas-develop/protocol/openid-connect/token" >> $GITHUB_ENV
echo "VAAS_CLIENT_ID=${{ secrets.DEVELOP_VAAS_CLIENT_ID }}" >> $GITHUB_ENV
echo "VAAS_USER_NAME=${{ secrets.DEVELOP_VAAS_USER_NAME }}" >> $GITHUB_ENV
echo "VAAS_PASSWORD=${{ secrets.DEVELOP_VAAS_PASSWORD }}" >> $GITHUB_ENV
echo "VAAS_PASSWORD=${{ secrets.DEVELOP_VAAS_PASSWORD }}" >> $GITHUB_ENV
- uses: pnpm/action-setup@v3
name: install pnpm
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/image-retention.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.0
go-version-file: ./github-actions/cleanup-packages/go.mod
cache-dependency-path: ./github-actions/cleanup-packages/go.sum

- name: Verify dependencies
run: go mod verify
Expand Down
6 changes: 3 additions & 3 deletions dotnet/Vaas/src/Vaas/Messages/Detection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ public class Detection
{
[JsonPropertyName("engine")]
public int? Engine { get; init; }
[JsonPropertyName("fileName")]

[JsonPropertyName("file_name")]
public string FileName { get; init; }

Check warning on line 11 in dotnet/Vaas/src/Vaas/Messages/Detection.cs

View workflow job for this annotation

GitHub Actions / Build & Test C# SDK (8.0.x)

Non-nullable property 'FileName' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 11 in dotnet/Vaas/src/Vaas/Messages/Detection.cs

View workflow job for this annotation

GitHub Actions / Build & Test C# SDK (8.0.x)

Non-nullable property 'FileName' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

[JsonPropertyName("virus")]
public string Virus { get; init; }

Check warning on line 14 in dotnet/Vaas/src/Vaas/Messages/Detection.cs

View workflow job for this annotation

GitHub Actions / Build & Test C# SDK (8.0.x)

Non-nullable property 'Virus' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 14 in dotnet/Vaas/src/Vaas/Messages/Detection.cs

View workflow job for this annotation

GitHub Actions / Build & Test C# SDK (8.0.x)

Non-nullable property 'Virus' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}
6 changes: 3 additions & 3 deletions dotnet/Vaas/src/Vaas/Messages/LibMagic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ namespace Vaas.Messages;

public class LibMagic
{
[JsonPropertyName("fileType")]
[JsonPropertyName("file_type")]
public string FileType { get; init; }

Check warning on line 8 in dotnet/Vaas/src/Vaas/Messages/LibMagic.cs

View workflow job for this annotation

GitHub Actions / Build & Test C# SDK (8.0.x)

Non-nullable property 'FileType' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 8 in dotnet/Vaas/src/Vaas/Messages/LibMagic.cs

View workflow job for this annotation

GitHub Actions / Build & Test C# SDK (8.0.x)

Non-nullable property 'FileType' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 8 in dotnet/Vaas/src/Vaas/Messages/LibMagic.cs

View workflow job for this annotation

GitHub Actions / Build & Test C# SDK (8.0.x)

Non-nullable property 'FileType' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 8 in dotnet/Vaas/src/Vaas/Messages/LibMagic.cs

View workflow job for this annotation

GitHub Actions / Build & Test C# SDK (8.0.x)

Non-nullable property 'FileType' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
[JsonPropertyName("mimeType")]

[JsonPropertyName("mime_type")]
public string MimeType { get; init; }

Check warning on line 11 in dotnet/Vaas/src/Vaas/Messages/LibMagic.cs

View workflow job for this annotation

GitHub Actions / Build & Test C# SDK (8.0.x)

Non-nullable property 'MimeType' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 11 in dotnet/Vaas/src/Vaas/Messages/LibMagic.cs

View workflow job for this annotation

GitHub Actions / Build & Test C# SDK (8.0.x)

Non-nullable property 'MimeType' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 11 in dotnet/Vaas/src/Vaas/Messages/LibMagic.cs

View workflow job for this annotation

GitHub Actions / Build & Test C# SDK (8.0.x)

Non-nullable property 'MimeType' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 11 in dotnet/Vaas/src/Vaas/Messages/LibMagic.cs

View workflow job for this annotation

GitHub Actions / Build & Test C# SDK (8.0.x)

Non-nullable property 'MimeType' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}
8 changes: 4 additions & 4 deletions dotnet/Vaas/src/Vaas/Messages/VerdictResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public VerdictResponse(string sha256, Verdict verdict)
Sha256 = sha256;
Verdict = verdict;
}

[JsonPropertyName("kind")]
public string Kind { get; init; } = "VerdictResponse";

Expand All @@ -33,11 +33,11 @@ public VerdictResponse(string sha256, Verdict verdict)

[JsonPropertyName("upload_token")]
public string? UploadToken { get; init; }

[JsonPropertyName("detections")]
public List<Detection>? Detections { get; init; }
[JsonPropertyName("libMagic")]

[JsonPropertyName("lib_magic")]
public LibMagic? LibMagic { get; init; }

[MemberNotNullWhen(true, nameof(Sha256), nameof(Guid))]
Expand Down
2 changes: 1 addition & 1 deletion golang/vaas/pkg/messages/detection.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ package messages
// TokenResponse represents a response containing an access token.
type Detection struct {
Engine int `json:"engine"`
FileName string `json:"fileName"`
FileName string `json:"file_name"`
Virus string `json:"virus"`
}
4 changes: 2 additions & 2 deletions golang/vaas/pkg/messages/lib_magic.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ package messages

// TokenResponse represents a response containing an access token.
type LibMagic struct {
FileType string `json:"fileType"`
MimeType string `json:"mimeType"`
FileType string `json:"file_type"`
MimeType string `json:"mime_type"`
}
2 changes: 1 addition & 1 deletion golang/vaas/pkg/messages/verdict_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type VerdictResponse struct {
URL string `json:"url"`
UploadToken string `json:"upload_token"`
Detections []Detection `json:"detections"`
LibMagic LibMagic `json:"libMagic"`
LibMagic LibMagic `json:"lib_magic"`
}

// IsValid checks if the VerdictResponse is valid.
Expand Down
5 changes: 4 additions & 1 deletion java/src/main/java/de/gdata/vaas/messages/Detection.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package de.gdata.vaas.messages;

import com.google.gson.annotations.SerializedName;

import lombok.Getter;
import lombok.NonNull;

Expand All @@ -8,8 +10,9 @@ public class Detection {
int engine;

@NonNull
@SerializedName("file_name")
String fileName;

@NonNull
String virus;
}
6 changes: 5 additions & 1 deletion java/src/main/java/de/gdata/vaas/messages/LibMagic.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package de.gdata.vaas.messages;

import com.google.gson.annotations.SerializedName;

import lombok.Getter;
import lombok.NonNull;

@Getter
public class LibMagic {
@NonNull
@SerializedName("file_type")
String fileType;

@NonNull
@SerializedName("mime_type")
String mimeType;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class VerdictResponse extends MessageType {
@SerializedName("detections")
ArrayList<Detection> detections;
@Getter
@SerializedName("libMagic")
@SerializedName("lib_magic")
LibMagic libMagic;

private VerdictResponse() {
Expand Down
2 changes: 1 addition & 1 deletion php/src/vaas/Message/Detection.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
class Detection
{
public ?int $engine;
public string $fileName;
public string $file_name;
public string $virus;
}
4 changes: 2 additions & 2 deletions php/src/vaas/Message/LibMagic.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

class LibMagic
{
public string $fileType;
public string $mimeType;
public string $file_type;
public string $mime_type;
}
2 changes: 1 addition & 1 deletion php/src/vaas/Message/VaasVerdict.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public function __construct(VerdictResponse $verdictResponse)
$this->Sha256 = $verdictResponse->sha256 ?? "";
$this->Verdict = $verdictResponse->verdict ?? Verdict::UNKNOWN;
$this->Guid = $verdictResponse->guid ?? "";
$this->LibMagic = $verdictResponse->libMagic ?? null;
$this->LibMagic = $verdictResponse->lib_magic ?? null;
$this->Detections = $verdictResponse->detections ?? null;
}

Expand Down
2 changes: 1 addition & 1 deletion php/src/vaas/Message/VerdictResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ class VerdictResponse extends BaseMessage
public string $guid;
public string $sha256;
public ?string $upload_token;
public ?LibMagic $libMagic;
public ?LibMagic $lib_magic;
public ?array $detections;
}
Loading

0 comments on commit 70e6e53

Please sign in to comment.