encrypt private messages on disk - there are still a couple of places where the text is leaked in the logs during processing.

This commit is contained in:
friendica
2013-07-28 21:04:03 -07:00
parent 10f016841c
commit d002ff668a
4 changed files with 69 additions and 8 deletions
+30
View File
@@ -580,6 +580,19 @@ function item_post(&$a) {
}
if(array_key_exists('item_private',$datarray) && $datarray['item_private']) {
logger('Encrypting local storage');
$key = get_config('system','pubkey');
$datarray['item_flags'] = $datarray['item_flags'] | ITEM_OBSCURED;
if($datarray['title'])
$datarray['title'] = json_encode(aes_encapsulate($datarray['title'],$key));
if($datarray['body'])
$datarray['body'] = json_encode(aes_encapsulate($datarray['body'],$key));
}
if($orig_post) {
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `attach` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
dbesc($datarray['title']),
@@ -602,6 +615,23 @@ function item_post(&$a) {
);
if(count($post_tags)) {
foreach($post_tags as $tag) {
if(strlen(trim($tag['term']))) {
q("insert into term (uid,oid,otype,type,term,url) values (%d,%d,%d,%d,'%s','%s')",
intval($tag['uid']),
intval($post_id),
intval($tag['otype']),
intval($tag['type']),
dbesc(trim($tag['term'])),
dbesc(trim($tag['url']))
);
}
}
}
proc_run('php', "include/notifier.php", 'edit_post', $post_id);
if((x($_REQUEST,'return')) && strlen($return_path)) {
logger('return: ' . $return_path);