additional_message_headers.php: support CALLABLE/callback via config#9755
Open
jb4z wants to merge 6 commits intoroundcube:masterfrom
Open
additional_message_headers.php: support CALLABLE/callback via config#9755jb4z wants to merge 6 commits intoroundcube:masterfrom
jb4z wants to merge 6 commits intoroundcube:masterfrom
Conversation
…ack via config
The purpose of this patch is to have Roundcube execute a callback function during runtime, as defined in config.inc.php for more complex tasks.
For example, one could configure something like this:
$config['additional_message_headers']['X-Sender'] = null;
$config['additional_message_headers']['X-RC-USR'] = (function() {
$d = json_encode(['u' => rcube::get_instance()->get_user_name(), 'r' => $_SERVER['REMOTE_ADDR'], 'a' => empty($_SERVER['HTTP_USER_AGENT']) ? '-' : $_SERVER['HTTP_USER_AGENT'], 't' => $_SERVER['REQUEST_TIME'] ]);
return base64_encode($d); # should also be encrypted ;)
});
In this example,
a) disables the cleartext X-Sender header;
b) adds a dynamic header X-RC-USR in base64-JSON-encoded form, which could later be used for compliance purposes. If this header is automatically processed by the mail gateway, further analysis could aid in detecting abuse patterns, while not directly exposing this sensitive information as human-readable text; if properly encrypted (out of this scope), this could eliminate privacy concerns.
One of the ideas behind this is that using Roundcube (or any other webmailer) usually masquerades the original user's IP address by the webmailer's server IP address to the SMTP server; this is not the case when a user talks to the SMTP server directly.
With tight integration into your setup, you will never again have to sift through different logs/correlate IP address information just to find the guy who sent this message which the person behind the user's login denies having sent.
This patch also reduces two arrays ($search, $replace) into one ($map) for maintainability.
Missed something while creating initial patch
3 times' a charm
Member
|
Thanks. Please, fix the coding style issue. Also, it would be good to add some note to the config.inc.php.dist file, with some simple example. |
Author
|
Thanks for considering this. Fixed the whitespace issue as requested and updated the config.inc.php.sample, hoping it's not too verbose (and not too opinionated 😬) |
… wording for $config['skin'] (roundcube#9755)
alecpl
reviewed
Feb 16, 2025
| // Specify Roundcube's Default Skin, equal to the folder name beneath skins/ | ||
| $config['skin'] = 'elastic'; | ||
|
|
||
| // Optional config of the additional_message_headers plugin (Issue #9755; Feb 2025) |
Member
There was a problem hiding this comment.
The sample should be in plugins/additional_message_headers/config.inc.php.dist
Member
There was a problem hiding this comment.
@jb4z would you mind fixing the last issue I mentioned? It's almost ready to be merged.
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.
Good day all,
The purpose of this patch is to have Roundcube execute a callback function during runtime, as defined in config.inc.php, for more complex tasks going beyond static strings or their replacements.
For example, one could configure something like this:
In this example,
a) disables the cleartext X-Sender header;
b) adds a dynamic header X-RC-USR in base64-JSON-encoded form, which could later be used for compliance purposes. If this header is automatically processed by the mail gateway, further analysis could aid in detecting abuse patterns, while not directly exposing this sensitive information as human-readable text; if properly encrypted (out of this scope), this could eliminate privacy concerns.
One of the ideas behind this is that using Roundcube (or any other webmailer) usually masquerades the original user's IP address by the webmailer's server IP address to the SMTP server; this is not the case when a user talks to the SMTP server directly.
With tight integration into your setup, you will never again have to sift through different logs/correlate IP address information just to find the guy who sent this message which the person behind the user's login denies having sent.
This patch also reduces two arrays ($search, $replace) into one ($map) for maintainability.