Skip to content

Retrieve SARIF errors and warnings correctly #4837

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

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2f839ea
Retrieve SARIF errors and warnings correctly
bdovaz Feb 23, 2025
9f9159d
wip
bdovaz Feb 23, 2025
597c4c8
wip
bdovaz Feb 23, 2025
3a33b1f
wip
bdovaz Feb 23, 2025
d6fdeee
wip
bdovaz Feb 23, 2025
f2cdf9b
[MegaLinter] Apply linters fixes
bdovaz Feb 23, 2025
60909d7
wip
bdovaz Mar 6, 2025
5a1d077
Merge remote-tracking branch 'origin/main' into retrieve-sarif-results
bdovaz Mar 6, 2025
f5f627f
wip
bdovaz Mar 6, 2025
afbfbe9
wip
bdovaz Mar 6, 2025
9ea473a
wip
bdovaz Mar 6, 2025
a0c7736
[MegaLinter] Apply linters fixes
bdovaz Mar 6, 2025
79e4b41
Merge branch 'main' into retrieve-sarif-results
bdovaz Mar 10, 2025
33a6003
Update golang_bad_01.go
bdovaz Mar 11, 2025
731d3e0
Update golang_bad_02.go
bdovaz Mar 11, 2025
92e53d1
Merge branch 'main' into retrieve-sarif-results
nvuillam Mar 21, 2025
3668365
[MegaLinter] Apply linters fixes
nvuillam Mar 21, 2025
8a5c3a2
Merge branch 'main' into retrieve-sarif-results
bdovaz Apr 29, 2025
c0d0423
Merge branch 'main' into retrieve-sarif-results
bdovaz Apr 29, 2025
c2f89dc
wip
bdovaz Apr 29, 2025
368bf84
wip
bdovaz May 1, 2025
93eeade
Merge branch 'main' into retrieve-sarif-results
bdovaz May 1, 2025
4465eb8
wip
bdovaz May 1, 2025
2e11d37
Merge remote-tracking branch 'origin/retrieve-sarif-results' into ret…
bdovaz May 1, 2025
a50875f
Merge branch 'main' into retrieve-sarif-results
bdovaz May 1, 2025
485dd6b
[MegaLinter] Apply linters fixes
bdovaz May 1, 2025
c63a0b7
wip
bdovaz May 1, 2025
90ae3b4
wip
bdovaz May 1, 2025
34ff1d6
Merge remote-tracking branch 'origin/retrieve-sarif-results' into ret…
bdovaz May 1, 2025
b71cf59
Merge branch 'retrieve-sarif-results' of github.com:oxsecurity/megali…
bdovaz May 1, 2025
ca2d1b0
[MegaLinter] Apply linters fixes
bdovaz May 1, 2025
8cd6cb4
wip
bdovaz May 13, 2025
5d59338
Merge branch 'main' into retrieve-sarif-results
bdovaz May 13, 2025
9b511d8
wip
bdovaz May 15, 2025
6e89c16
Merge branch 'main' into retrieve-sarif-results
bdovaz May 15, 2025
e7e2762
Merge branch 'main' into retrieve-sarif-results
nvuillam May 17, 2025
9571058
Merge branch 'main' into retrieve-sarif-results
nvuillam May 19, 2025
11260f9
Merge branch 'main' into retrieve-sarif-results
echoix May 27, 2025
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
9 changes: 9 additions & 0 deletions .automation/test/devskim/bad/example2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

curl http://test/path

curl http://test/path2

secret=111111111111111111111111111111

secret2=111111111111111111111111111111
4 changes: 2 additions & 2 deletions .automation/test/golang/bad/golang_bad_01.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
if len(in) == 0 {
return "", fmt.Errorf("Input is empty")
}
return "", fmt.Errorf("Input is empty")
}
4 changes: 2 additions & 2 deletions .automation/test/golang/bad/golang_bad_02.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
if len(in) == 0 {
return "", fmt.Errorf("Input is empty")
}
return "", fmt.Errorf("Input is empty")
}
3 changes: 3 additions & 0 deletions .automation/test/golang_revive/bad/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module megalinter.io/test-bad

go 1.21
7 changes: 7 additions & 0 deletions .automation/test/golang_revive/bad/golang_bad_01.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package bad

func _() {
if len(in) == 0 {
return "", fmt.Errorf("Input is empty")
}
}
7 changes: 7 additions & 0 deletions .automation/test/golang_revive/bad/golang_bad_02.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package bad

func _() {
if len(in) == 0 {
return "", fmt.Errorf("Input is empty")
}
}
3 changes: 3 additions & 0 deletions .automation/test/golang_revive/fix/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module megalinter.io/test-fix

go 1.21
9 changes: 9 additions & 0 deletions .automation/test/golang_revive/fix/golang_fix_01.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This is a package comment
package main

import "fmt"

func main() {
fmt.Println("hello world")
nicolas()
}
8 changes: 8 additions & 0 deletions .automation/test/golang_revive/fix/golang_fix_02.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This is a package comment
package main

import "fmt"

func nicolas() {
fmt.Println("hello world")
}
3 changes: 3 additions & 0 deletions .automation/test/golang_revive/good/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module megalinter.io/test-good

go 1.21
9 changes: 9 additions & 0 deletions .automation/test/golang_revive/good/golang_good_01.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This is a package comment
package main

import "fmt"

func main() {
fmt.Println("hello world")
nicolas()
}
8 changes: 8 additions & 0 deletions .automation/test/golang_revive/good/golang_good_02.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This is a package comment
package main

import "fmt"

func nicolas() {
fmt.Println("hello world")
}
2 changes: 2 additions & 0 deletions .automation/test/golang_revive/revive_bad.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[rule.package-comments]
severity = "error"
1 change: 1 addition & 0 deletions .automation/test/java/java_bad_2.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
public class Application {
int my_Field = 1;

/**
* main.
Expand Down
6 changes: 6 additions & 0 deletions .automation/test/kotlin_detekt/bad/Kotlin_bad_1.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ abstract internal class A {
}

class B : A() {
public fun test() {
System.gc()
Runtime.getRuntime().gc()
System.runFinalization()
}

override public val v = ""
override suspend fun f(v: Any): Any = ""
override tailrec fun findFixPoint(x: Double): Double
Expand Down
11 changes: 11 additions & 0 deletions .automation/test/kotlin_detekt/bad/detekt-config_bad.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
potential-bugs:
active: true
ExplicitGarbageCollectionCall:
active: true
severity: error

style:
active: true
ModifierOrder:
active: true
severity: warning
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imageRepositoryAllowList": [],
"publicRegistries": [],
"untrustedRegistries": ["k8s.gcr.io/pause"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Pod
metadata:
name: privileged
spec:
containers:
- name: pause
image: k8s.gcr.io/pause
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: grafana
name: grafana
spec:
selector:
matchLabels:
app: grafana
template:
metadata:
labels:
app: grafana
spec:
securityContext:
fsGroup: 472
supplementalGroups:
- 0
containers:
- name: grafana
image: grafana/grafana:9.2.1
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3000
name: http-grafana
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /robots.txt
port: 3000
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 2
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 3000
timeoutSeconds: 1
resources:
requests:
cpu: 250m
memory: 750Mi
volumeMounts:
- mountPath: /var/lib/grafana
name: grafana-pv
volumes:
- name: grafana-pv
persistentVolumeClaim:
claimName: grafana-pvc
8 changes: 4 additions & 4 deletions .automation/test/python_bandit/python_bad_1.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
try:
pass
except:
pass
from flask import Flask

app = Flask(__name__)
app.run(debug=True)
5 changes: 5 additions & 0 deletions .automation/test/python_bandit/python_bad_2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
from flask import Flask

try:
app = Flask(__name__)
app.run(debug=True)

pass
except:
pass
12 changes: 12 additions & 0 deletions .automation/test/repository_kics/bad/bad_1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Install Apache from an MSI
hosts: all

tasks:
- name: Create (or update) Firewall Rule1
azure_rm_sqlfirewallrule:
resource_group: myResourceGroup1
server_name: firewallrulecrudtest-6285
name: firewallrulecrudtest-5370
start_ip_address: 0.0.0.0
end_ip_address: 172.28.11.138
12 changes: 12 additions & 0 deletions .automation/test/repository_kics/bad/bad_2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Install Apache from an MSI
hosts: all

tasks:
- name: Create (or update) Firewall Rule1
azure_rm_sqlfirewallrule:
resource_group: myResourceGroup1
server_name: firewallrulecrudtest-6285
name: firewallrulecrudtest-5370
start_ip_address: 0.0.0.0
end_ip_address: 172.28.11.138
14 changes: 14 additions & 0 deletions .automation/test/repository_semgrep/bad/Test.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Security.Cryptography;

public class Program
{
public void GenerateBadKey() {
var rng = new System.Random();
byte[] key = new byte[16];
rng.NextBytes(key);
SymmetricAlgorithm cipher = Aes.Create();
// ruleid: deeptodoruleid: use_weak_rng_for_keygeneration
cipher.Key = key;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource "aws_instance" "instanceWithNoVpc" {
resource "aws_instance" "instanceWithNoVpc2" {
ami = "some-id"
instance_type = "t2.micro"

Expand Down
Loading
Loading