todays product advirories implemented

This commit is contained in:
master
2026-01-16 23:30:47 +02:00
parent 91ba600722
commit 77ff029205
174 changed files with 30173 additions and 1383 deletions

View File

@@ -24,16 +24,16 @@ public sealed class GitHubEventMapper : IScmEventMapper
_ => (ScmEventType.Unknown, (Func<JsonElement, (ScmEventType, string?, string?)>?)null)
};
if (extractor is null && scmEventType == ScmEventType.Unknown)
var repository = ExtractRepository(payload);
if (repository is null && scmEventType != ScmEventType.Unknown)
{
return null;
}
var repository = ExtractRepository(payload);
if (repository is null)
repository ??= new ScmRepository
{
return null;
}
FullName = "unknown"
};
string? commitSha = null;
string? refName = null;
@@ -196,13 +196,15 @@ public sealed class GitHubEventMapper : IScmEventMapper
return null;
}
var state = GetString(pr, "state") ?? GetString(payload, "action");
return new ScmPullRequest
{
Number = GetInt(pr, "number"),
Title = GetString(pr, "title"),
SourceBranch = GetNestedString(pr, "head", "ref"),
TargetBranch = GetNestedString(pr, "base", "ref"),
State = GetString(pr, "state"),
State = state,
Url = GetString(pr, "html_url")
};
}

View File

@@ -13,9 +13,9 @@ public sealed class GitLabEventMapper : IScmEventMapper
public NormalizedScmEvent? Map(string eventType, string deliveryId, JsonElement payload)
{
var objectKind = GetString(payload, "object_kind") ?? eventType;
var objectKind = NormalizeObjectKind(GetString(payload, "object_kind") ?? eventType);
var (scmEventType, commitSha, refName) = objectKind.ToLowerInvariant() switch
var (scmEventType, commitSha, refName) = objectKind switch
{
"push" => ExtractPushDetails(payload),
"merge_request" => ExtractMergeRequestDetails(payload),
@@ -211,6 +211,26 @@ public sealed class GitLabEventMapper : IScmEventMapper
};
}
private static string NormalizeObjectKind(string? value)
{
if (string.IsNullOrWhiteSpace(value))
{
return string.Empty;
}
var normalized = value.Trim().ToLowerInvariant();
return normalized switch
{
"push hook" => "push",
"tag push hook" => "tag_push",
"merge request hook" => "merge_request",
"pipeline hook" => "pipeline",
"job hook" => "job",
_ => normalized
};
}
private static ScmRelease? ExtractRelease(JsonElement payload)
{
if (GetString(payload, "object_kind") != "release")

View File

@@ -44,6 +44,17 @@ public sealed class GiteaWebhookValidator : IWebhookSignatureValidator
Encoding.UTF8.GetBytes(expectedSignature.ToLowerInvariant()));
}
// Accept raw SHA256 hex signatures without prefix (legacy Gitea format)
if (signature.Length == 64)
{
var computedHash = HMACSHA256.HashData(secretBytes, payload);
var computedSignature = Convert.ToHexStringLower(computedHash);
return CryptographicOperations.FixedTimeEquals(
Encoding.UTF8.GetBytes(computedSignature),
Encoding.UTF8.GetBytes(signature.ToLowerInvariant()));
}
return false;
}
}

View File

@@ -103,6 +103,9 @@ internal sealed class CallgraphIngestionService : ICallgraphIngestionService
IngestedAt = timeProvider.GetUtcNow()
};
document.Id = guidProvider.NewGuid().ToString("N");
document.ScanKey = document.Id;
document.Metadata ??= new Dictionary<string, string?>(StringComparer.OrdinalIgnoreCase);
document.Metadata["formatVersion"] = normalized.FormatVersion;
document.Metadata["schemaVersion"] = schemaVersion;