{"id":17960292,"url":"https://github.com/cketti/safecontentresolver","last_synced_at":"2025-09-01T12:06:18.266Z","repository":{"id":57730323,"uuid":"52766503","full_name":"cketti/SafeContentResolver","owner":"cketti","description":"A replacement for Android's ContentResolver that protects against the Surreptitious Sharing attack","archived":false,"fork":false,"pushed_at":"2020-06-24T01:04:27.000Z","size":176,"stargazers_count":40,"open_issues_count":2,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-26T19:42:16.056Z","etag":null,"topics":["android","contentprovider","contentresolver","library","security"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cketti.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-29T05:32:31.000Z","updated_at":"2024-08-17T10:14:09.000Z","dependencies_parsed_at":"2022-09-26T22:01:22.556Z","dependency_job_id":null,"html_url":"https://github.com/cketti/SafeContentResolver","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/cketti/SafeContentResolver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cketti%2FSafeContentResolver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cketti%2FSafeContentResolver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cketti%2FSafeContentResolver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cketti%2FSafeContentResolver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cketti","download_url":"https://codeload.github.com/cketti/SafeContentResolver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cketti%2FSafeContentResolver/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270099310,"owners_count":24527028,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","contentprovider","contentresolver","library","security"],"created_at":"2024-10-29T11:06:01.614Z","updated_at":"2025-08-12T16:40:27.688Z","avatar_url":"https://github.com/cketti.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SafeContentResolver\n\nA replacement for Android's [`ContentResolver`](https://developer.android.com/reference/android/content/ContentResolver.html)\nthat protects against the *Surreptitious Sharing* attack.\n\n## Surreptitious Sharing\n\nRead all about it in the [corresponding blog post](https://www.ibr.cs.tu-bs.de/news/ibr/surreptitious-sharing-2016-04-04.xml).\n\n## Usage\n\nReplace all occurrences of [`ContentResolver.openInputStream()`](https://developer.android.com/reference/android/content/ContentResolver.html#openInputStream(android.net.Uri))\nwhere URIs provided by other apps are opened with `SafeContentResolver.openInputStream()`.\n\n`SafeContentResolver` will refuse to open `file://` URIs pointing to files belonging to your app and `content://` URIs\nbelonging to content providers of your app.  \nIf you wish to allow access to certain content providers, add the following `\u003cmeta-data\u003e` element to the appropriate\n`\u003cprovider\u003e` entries in your manifest:\n```xml\n\u003cprovider … \u003e\n    \u003cmeta-data\n        android:name=\"de.cketti.safecontentresolver.ALLOW_INTERNAL_ACCESS\"\n        android:value=\"true\" /\u003e\n\u003c/provider\u003e\n```\n\nThe library comes in two flavors `safe-content-resolver-v14` and `safe-content-resolver-v21`. The former includes\nnative code to be able to invoke the `fstat` system call that is used to retrieve the owner of a file. Starting with\nLollipop (API 21) the framework includes the class [`Os`](https://developer.android.com/reference/android/system/Os.html)\nto access this functionality. So `safe-content-resolver-v21` is free of native code and thus much smaller.\n\nTo retrieve an instance of `SafeContentResolver` use:\n```java\nSafeContentResolver safeContentResolver = SafeContentResolverCompat.newInstance(context);\n```\n\nIf your `minSdkVersion` is 21 or higher you only need to include `safe-content-resolver-v21` and use the following code:\n```java\nSafeContentResolver safeContentResolver = SafeContentResolver.newInstance(context);\n```\n\n## Include the library\n\n```groovy\nimplementation 'de.cketti.safecontentresolver:safe-content-resolver-v14:1.0.0'\n```\n\nOr, if you're using `minSdkVersion` 21 or higher:\n\n```groovy\nimplementation 'de.cketti.safecontentresolver:safe-content-resolver-v21:1.0.0'\n```\n\n## Native code\n\n`safe-content-resolver-v14` contains native code for the following ABIs:\n* armeabi-v7a\n* arm64-v8a\n* x86\n* x86_64\n\nIf you don't want to include all of them in your APK you might want to look into\n[ABIs Splits](https://developer.android.com/studio/build/configure-apk-splits.html#configure-abi-split).\n\n\n## License\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcketti%2Fsafecontentresolver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcketti%2Fsafecontentresolver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcketti%2Fsafecontentresolver/lists"}