Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Removed /proc exceptions, added whitelist for /proc
Browse files Browse the repository at this point in the history
Refs #1375
  • Loading branch information
M66B committed Feb 21, 2014
1 parent 3a9dbfd commit a4312d2
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Changelog

* Localized whitelist names ([issue](/../../issues/1375))
* Sorted whitelist entries ([issue](/../../issues/1375))
* Removed /proc exceptions, except */proc/self/cmdline*
* Added whitelist for /proc
* Updated Dutch translation

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)
Expand Down
1 change: 1 addition & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ however it is impossible to guarantee it will work flawlessly on each and every
<string name="whitelist_filename" tools:ignore="UnusedResources">File names</string>
<string name="whitelist_command" tools:ignore="UnusedResources">Shell commands</string>
<string name="whitelist_url" tools:ignore="UnusedResources">URLs</string>
<string name="whitelist_proc" translatable="false" tools:ignore="UnusedResources">/proc</string>
<string name="title_restrict">Check to restrict:</string>
<string name="title_check_whitelist">Check to allow</string>
<string name="title_fused">Filter on data usage</string>
Expand Down
2 changes: 1 addition & 1 deletion src/biz/bokhorst/xprivacy/ActivityApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ protected void onPostExecute(Object result) {

final List<String> localizedType = new ArrayList<String>();
for (String type : mListWhitelist.keySet()) {
String name = type.toLowerCase().replace(".", "_");
String name = type.toLowerCase().replace(".", "_").replace("/", "");
int id = getResources().getIdentifier(name, "string", ActivityApp.this.getPackageName());
localizedType.add(getResources().getString(id));
}
Expand Down
3 changes: 2 additions & 1 deletion src/biz/bokhorst/xprivacy/Meta.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class Meta {
public final static String cWhitelistFilename = "Whitelist.Filename";
public final static String cWhitelistCommand = "Whitelist.Command";
public final static String cWhitelistUrl = "Whitelist.Url";
public final static String cWhitelistProc = "Whitelist.Proc";

public static final String cWhitelistTypes[] = new String[] { cWhitelistIPAddress, cWhitelistLibrary,
cWhitelistFilename, cWhitelistCommand, cWhitelistUrl };
Expand Down Expand Up @@ -81,7 +82,7 @@ public static List<Hook> get() {
mListHook.add(new Hook("identification", "%macaddr", "", 1, null, null));
mListHook.add(new Hook("identification", "%serialno", "", 1, null, null));
mListHook.add(new Hook("identification", "%cid", "", 1, null, null));
mListHook.add(new Hook("identification", "/proc", "", 1, "1.7", null).dangerous());
mListHook.add(new Hook("identification", "/proc", "", 1, "1.7", null).dangerous().whitelist(cWhitelistProc));
mListHook.add(new Hook("identification", "/system/build.prop", "", 1, "1.9.9", null).dangerous());
mListHook.add(new Hook("identification", "/sys/block/.../cid", "", 1, null, null));
mListHook.add(new Hook("identification", "/sys/class/.../cid", "", 1, null, null));
Expand Down
10 changes: 1 addition & 9 deletions src/biz/bokhorst/xprivacy/XIoBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.net.InetAddress;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import android.annotation.SuppressLint;
Expand All @@ -15,13 +14,6 @@ public class XIoBridge extends XHook {
private Methods mMethod;
private String mFileName;

// @formatter:off
public static List<String> cProcWhiteList = Arrays.asList(new String[] {
"/proc/meminfo",
"/proc/self/cmdline"
});
// @formatter:on

private XIoBridge(Methods method, String restrictionName) {
super(restrictionName, method.name(), null);
mMethod = method;
Expand Down Expand Up @@ -96,7 +88,7 @@ protected void before(XParam param) throws Throwable {

// Proc white list
if (mFileName.equals("/proc"))
if (cProcWhiteList.contains(fileName))
if ("/proc/self/cmdline".equals(fileName))
return;

// Check if restricted
Expand Down
2 changes: 1 addition & 1 deletion tools/addstring.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#grep -RIl "\<string name=\"msg_no_restrictions" res | xargs sed -i -e "/msg_no_restrictions/a \
#\ \ \ \ <string name=\"msg_no_whitelists\">No whitelists found for this application</string>"
#\ \ \ \ <string name=\"whitelist_proc\">/proc</string>"

grep -RIl "\<string name=\"title_categories" res | xargs sed -i -e '/title_categories/d'
#grep -RIl "\<string name=\"title_whitelist" res | xargs sed -i -e 's/">Whitelist /">Remember /g'

0 comments on commit a4312d2

Please sign in to comment.