Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
0f26941
Add Lint & format workflows.
Einswilli Sep 6, 2025
40e02aa
Merge branch 'AllDotPy:master' into master
Einswilli Sep 6, 2025
b9913ca
Add Code of Conduct.
Einswilli Sep 6, 2025
b6bd262
Add Contributions guide.
Einswilli Sep 6, 2025
f9dfa45
Merge branch 'master' of https://github.com/Einswilli/Valkyrie
Einswilli Sep 6, 2025
1afc3a0
Update CONTRUBUTING.md and Pyproject.toml files.
Einswilli Sep 6, 2025
30d578c
Update CONTRUBUTING.md and Pyproject.toml files.
Einswilli Sep 6, 2025
f1b4428
remove main.py file form the root dir.
Einswilli Sep 6, 2025
850e5d7
Merge branch 'AllDotPy:master' into master
Einswilli Sep 6, 2025
d6e7800
valkyrie.core: Add Scanner engine and types modules.
Einswilli Sep 6, 2025
dbaee48
feat(core): Add Scanner Configuration types and Scanner Engine.
Einswilli Sep 6, 2025
7df00ad
Merge branch 'AllDotPy:master' into master
Einswilli Sep 6, 2025
6c125cf
valkyrie.plugins: Add Security Rules Base class Secrets detector Plugin.
Einswilli Sep 7, 2025
b6c7d6c
__ # Merge branch 'master' of https://github.com/Einswilli/Valkyrie i…
Einswilli Sep 7, 2025
1ba0352
valkyrie.plugins: Add Plugin manager.
Einswilli Sep 7, 2025
d023343
valkyrie.plugins: Add Plugin manager.
Einswilli Sep 7, 2025
a2fef8b
valkyrie.plugins: Add Plugin manager.
Einswilli Sep 7, 2025
e90ba68
Merge branch 'AllDotPy:master' into master
Einswilli Sep 7, 2025
73474ef
valkyrie.plugins: Add Plugin manager.
Einswilli Sep 7, 2025
e1238c4
valkyrie.plugins: Add Plugin manager.
Einswilli Sep 7, 2025
4bfa0fa
Merge branch 'AllDotPy:master' into master
Einswilli Sep 7, 2025
e3b808a
Merge branch 'AllDotPy:master' into feat.plugins
Einswilli Sep 7, 2025
ae14c1d
Feat (plugins): Add Plugin manager
Einswilli Sep 7, 2025
f0310b4
refractor: valkyrie.plugins.secrets.
Einswilli Sep 8, 2025
ebb3a38
Merge branch 'AllDotPy:master' into master
Einswilli Sep 8, 2025
d9677d4
Merge branch 'AllDotPy:master' into feat.plugins
Einswilli Sep 8, 2025
a49198d
Merge branch 'master' into feat.plugins
Einswilli Sep 8, 2025
cf596f8
Merge branch into feat.plugins
Einswilli Sep 8, 2025
e071c5f
Merge branch 'master' into feat.plugins
Einswilli Sep 8, 2025
ce522fa
Refractor: Refractor secrets plugin to make it more cleanner.
Einswilli Sep 8, 2025
d716401
Merge branch 'AllDotPy:master' into master
Einswilli Sep 8, 2025
f405674
valkyrie,plugins: add vulnera vulnerablity scanner plugin
Einswilli Sep 11, 2025
bdc5a04
valkyrie,plugins: Fix typo in Vulnera.parser
Einswilli Sep 11, 2025
a35a54e
Merge branch 'AllDotPy:master' into master
Einswilli Sep 11, 2025
fd7fb9f
valkkyrie.plugins: Add iamx plugin foor IAM configuration Scanning
Einswilli Sep 12, 2025
46c4453
valkkyrie.plugins: Add iamx plugin foor IAM configuration Scanning
Einswilli Sep 12, 2025
a288bae
Valkyrie.core: Add Scann Result Formatters base class and SARIF Formm…
Einswilli Sep 13, 2025
a97b666
Merge branch 'AllDotPy:master' into master
Einswilli Sep 13, 2025
1e6b5b9
Merge branch 'master' of https://github.com/Einswilli/Valkyrie into f…
Einswilli Sep 13, 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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,4 @@ __marimo__/
docs/*
rules/*
tests/*
# valkyrie/*
valkyrie/repositories/*
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ maintainers = [{ name = "#Einswilli", email = "einswilligoeh@email.com" }]
requires-python = ">=3.10"
keywords = [
"valkyrie", "CI/CD", "security scaner", "guardian",
"pipelines"
"pipelines", "iam", "secrets"
]
dependencies = [
"toml>=0.10.2",
"tomli>=2.2.1",
"yamllib>=0.0.1",
]
dependencies = []

[project.optional-dependencies]
dev = [
Expand All @@ -38,4 +42,4 @@ packages = ["valkyrie"]

[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
build-backend = "setuptools.build_meta"
14 changes: 14 additions & 0 deletions valkyrie/core/formatters/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from abc import ABC, abstractmethod

from valkyrie.core.types import ScanResult

####
## SCAN RESULT FORMATTERS BASE CLASS
#####
class ResultFormatter(ABC):
"""Abstract base class for result formatting"""

@abstractmethod
def format(self, result: ScanResult) -> str:
"""Format scan result to string"""
pass
128 changes: 128 additions & 0 deletions valkyrie/core/formatters/sarif.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
"""
Valkyrie - SARIF Scan result Foormatter
"""

import json
from typing import List, Dict, Any
from valkyrie.core.types import (
ScanResult, ScanStatus, SecurityFinding,
SeverityLevel
)
from .base import ResultFormatter


####
## SARIF SCAN RESUT FORMATTER
#####
class SARIFFormatter(ResultFormatter):
"""SARIF (Static Analysis Results Interchange Format) formatter"""

def format(self, result: ScanResult) -> str:
"""Format results as SARIF JSON"""

sarif_report = {
"version": "2.1.0",
"$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0.json",
"runs": [
{
"tool": {
"driver": {
"name": "Valkyrie",
"version": "1.0.0",
"informationUri": "https://github.com/valkyrie-scanner/valkyrie",
"rules": self._generate_rules(result.findings)
}
},
"results": self._generate_results(result.findings),
"invocations": [
{
"executionSuccessful": result.status == ScanStatus.COMPLETED,
"startTimeUtc": result.timestamp.isoformat() + "Z",
"endTimeUtc": result.timestamp.isoformat() + "Z"
}
]
}
]
}

return json.dumps(sarif_report, indent=2)

def _generate_rules(
self,
findings: List[SecurityFinding]
) -> List[Dict[str, Any]]:
"""Generate SARIF rules from findings"""

rules = {}

for finding in findings:
if finding.rule_id not in rules:
rules[finding.rule_id] = {
"id": finding.rule_id,
"shortDescription": {"text": finding.title},
"fullDescription": {"text": finding.description},
"help": {
"text": finding.remediation_advice or "Review and fix the security issue"
},
"properties": {
"security-severity": self._severity_to_score(finding.severity)
}
}

return list(rules.values())

def _generate_results(
self,
findings: List[SecurityFinding]
) -> List[Dict[str, Any]]:
"""Generate SARIF results from findings"""

results = []

for finding in findings:
result = {
"ruleId": finding.rule_id,
"message": {"text": finding.description},
"level": self._severity_to_level(finding.severity),
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": str(finding.location.file_path)
},
"region": {
"startLine": finding.location.line_number,
"startColumn": finding.location.column_start,
"endColumn": finding.location.column_end
}
}
}
]
}
results.append(result)

return results

def _severity_to_level(self, severity: SeverityLevel) -> str:
"""Convert severity to SARIF level"""

mapping = {
SeverityLevel.CRITICAL: "error",
SeverityLevel.HIGH: "error",
SeverityLevel.MEDIUM: "warning",
SeverityLevel.LOW: "note",
SeverityLevel.INFO: "note"
}
return mapping.get(severity, "note")

def _severity_to_score(self, severity: SeverityLevel) -> str:
"""Convert severity to security score"""

mapping = {
SeverityLevel.CRITICAL: "9.0",
SeverityLevel.HIGH: "7.0",
SeverityLevel.MEDIUM: "5.0",
SeverityLevel.LOW: "3.0",
SeverityLevel.INFO: "1.0"
}
return mapping.get(severity, "1.0")
1 change: 1 addition & 0 deletions valkyrie/plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""
Valkyrie - Plugin module.
"""
from pathlib import Path
from typing import List, Set, Dict, Any, Optional
Expand Down