Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 9 additions & 1 deletion .github/workflows/cleanup-alpha-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,22 @@ on:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

permissions:
contents: read

env:
IMAGE_NAME: OpenAlprWebhookProcessor

jobs:
cleanup-alpha-releases:
runs-on: ubuntu-latest
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') && !contains(github.ref, 'alpha') && !contains(github.ref, 'beta') && !contains(github.ref, 'rc')

permissions:
# Deletes alpha releases and their git tags
contents: write
# Lists container package versions to find alpha Docker tags
packages: read

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
- develop
pull_request:

permissions:
contents: read

env:
IMAGE_NAME: OpenAlprWebhookProcessor

Expand Down Expand Up @@ -84,6 +87,9 @@ jobs:
windows-build-push:
runs-on: ubuntu-latest
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
permissions:
# Creates the GitHub release and uploads its artifact
contents: write
steps:
- name: Check out the repo
uses: actions/checkout@main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
[Route("api/webhook")]
public class WebhookController : ControllerBase
{
private const int MaxLoggedPayloadLength = 1000;

private readonly ILogger<WebhookController> _logger;
private readonly IMediator _mediator;

Expand Down Expand Up @@ -82,7 +84,15 @@
}
else
{
_logger.LogDebug("Unknown payload received, ignoring: {RawWebhook}", rawWebhook);
// The body is unauthenticated input: strip line breaks so it can't forge
// log entries, and cap its length so it can't flood the log.
var preview = rawWebhook.Length > MaxLoggedPayloadLength
? rawWebhook[..MaxLoggedPayloadLength]
: rawWebhook;
_logger.LogDebug(
"Unknown payload received ({Length} chars), ignoring: {RawWebhook}",
rawWebhook.Length,
preview.Replace("\r", string.Empty).Replace("\n", string.Empty));

Check warning on line 95 in OpenAlprWebhookProcessor.Server/Features/Webhooks/WebhookController.cs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Evaluation of this argument may be expensive and unnecessary if logging is disabled

See more on https://sonarcloud.io/project/issues?id=mlapaglia_OpenAlprWebhookProcessor&issues=AaHiE5DutvBvsV68k6up&open=AaHiE5DutvBvsV68k6up&pullRequest=454
}
}

Expand Down
Loading