Repository navigation
feat(core): expose S3_REGION env var for S3-compatible backends (Garage/MinIO/Ceph) - #483
Merged
Merged
Conversation
Add Plugin.S3_region mapped to ${S3_REGION} in s3.envars.json so the S3
region can be set via environment variable.
misp-core only exposed S3_BUCKET/S3_ENDPOINT/S3_ACCESS_KEY/S3_SECRET_KEY;
the region stayed hardcoded to 'eu-west-1' in AWSS3Client.php and could
only be changed through the Plugin.S3_region DB setting. This breaks
S3-compatible self-hosted backends (Garage, MinIO, Ceph) that require a
specific region: the AWS SigV4 signature embeds the region in the credential
scope, so the server rejects requests with:
AuthorizationHeaderMalformed: unexpected scope '.../eu-west-1/s3/aws4_request',
expected '.../garage/s3/aws4_request'
-> attachment download fails with 'could not load attachment' even though the
object exists and the key is correct. Reproduced on Garage with misp-core 2.5.x.
With this change, S3_REGION=garage (or minio/us-east-1/etc.) can be set in
.env alongside S3_ENDPOINT, keeping all S3 config consistent via env vars.
Note: also add '# S3_REGION=' to template.env under the S3 block (docs).
ostefano
requested changes
Oct 26, 2026
ostefano
left a comment
Collaborator
There was a problem hiding this comment.
Is this var initialized anywhere?
ostefano
approved these changes
Oct 27, 2026
Collaborator
|
LGTM |
ostefano
approved these changes
Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
misp-coreexposesS3_BUCKET,S3_ENDPOINT,S3_ACCESS_KEY,S3_SECRET_KEYas environment variables (core/files/etc/misp-docker/s3.envars.json), but not the region. The region stays hardcoded toeu-west-1inapp/Lib/Tools/AWSS3Client.phpand can only be changed via thePlugin.S3_regionDB setting.This breaks S3-compatible self-hosted backends (Garage, MinIO, Ceph) that require a specific region. AWS SigV4 embeds the region in the credential scope, so the server rejects requests:
Result: attachment downloads fail with "Something went wrong - could not load attachment" even though
Plugin.S3_aws_compatible=true, the object exists and the key is correct.Reproduced on misp-core 2.5.x with attachments stored in Garage (
attachments_dir=s3://). Verified the backend error via the cake shell (getAttachmentFile→NotFoundException: Could not download object ... AuthorizationHeaderMalformed). SettingPlugin.S3_regionto the backend's region fixes it immediately.Fix
Add
Plugin.S3_region→${S3_REGION}tos3.envars.json, so the region can be set via env var alongside the other S3 settings:One-line addition, no behaviour change for AWS users (if
S3_REGIONis unset, the existingeu-west-1default inAWSS3Client.phpstill applies).Follow-up (docs)
Please also add
# S3_REGION=under the S3 block intemplate.env(I kept this PR to the functional change; happy to include the doc line here if preferred):