Issue
Describe the bug
When Semaphore fetches a Git repository for a task, it stores the commit_message in the database. If the commit message exceeds the allowed column length, the Go backend truncates it. However, the truncation appears to be done using byte-wise slicing (e.g., msg[:200]) instead of rune-wise slicing.
If the truncation boundary falls exactly in the middle of a multi-byte UTF-8 character (e.g., Czech characters with diacritics like í, ž, á), it generates an invalid UTF-8 byte sequence. PostgreSQL strictly validates UTF-8 and immediately aborts the transaction.
This causes the Runner to silently fail with the UI logs showing:
Already up to date.
Get current commit hash
Get current commit message
Failed to update task commit
Failed to update TaskRunner status
And PostgreSQL logs throwing a critical error:
ERROR: invalid byte sequence for encoding "UTF8": 0xc3
CONTEXT: unnamed portal parameter $5
STATEMENT: update task set status=$1, start=$2, "end"=$3, commit_hash=$4, commit_message=$5, runner_id=$6 where id=$7
To Reproduce
-
Connect Semaphore to a PostgreSQL database.
-
Push a Git commit where the message length hits the exact database truncation limit, and place a multi-byte UTF-8 character exactly on the boundary.
-
Trigger the task.
-
The task fails immediately when trying to update the task status in the DB.
Expected behavior
String truncation for database insertion should be UTF-8 aware to prevent database transaction abortions.
Environment:
Impact
Database
Installation method
Docker
Database
Postgres
Browser
Microsoft Edge
Semaphore Version
2.17.33
Ansible Version
Logs & errors
No response
Manual installation - system information
No response
Configuration
No response
Additional information
No response
Issue
Describe the bug
When Semaphore fetches a Git repository for a task, it stores the
commit_messagein the database. If the commit message exceeds the allowed column length, the Go backend truncates it. However, the truncation appears to be done using byte-wise slicing (e.g.,msg[:200]) instead of rune-wise slicing.If the truncation boundary falls exactly in the middle of a multi-byte UTF-8 character (e.g., Czech characters with diacritics like
í,ž,á), it generates an invalid UTF-8 byte sequence. PostgreSQL strictly validates UTF-8 and immediately aborts the transaction.This causes the Runner to silently fail with the UI logs showing:
And PostgreSQL logs throwing a critical error:
To Reproduce
Connect Semaphore to a PostgreSQL database.
Push a Git commit where the message length hits the exact database truncation limit, and place a multi-byte UTF-8 character exactly on the boundary.
Trigger the task.
The task fails immediately when trying to update the task status in the DB.
Expected behavior
String truncation for database insertion should be UTF-8 aware to prevent database transaction abortions.
Environment:
Semaphore UI Version: 2.17.33
Database backend: PostgreSQL
Impact
Database
Installation method
Docker
Database
Postgres
Browser
Microsoft Edge
Semaphore Version
2.17.33
Ansible Version
Logs & errors
No response
Manual installation - system information
No response
Configuration
No response
Additional information
No response