Giter Site home page Giter Site logo

cocoapods-privacy's Introduction

cocoapods-privacy

Apple 2024 will review the App's privacy manifests in the spring, and any apps that don't submit a privacy list may be called back. For now, the privacy list is broken down by component, to facilitate the maintenance of component privacy, cocoapods-privacy is developed for management. Click to view details on Apple

Introduction

As name as,cocoapods-privacy is a plugin for privacy manifests, and focus on cocoapods!

Installation

$ gem install cocoapods-privacy

Usage

init

First of all, you must set a json config to cocoapods-privacy, this is a defalut config.json

$ pod privacy config https://raw.githubusercontent.com/ymoyao/cocoapods-privacy/main/resources/config.json

There has 3 keys in defalut config, defalut rule is :To exclude retrieval a component that git source contains certain ‘github.com’ keywords

"source.white.list": [],
"source.black.list": ["github.com"], 
"api.template.url": "https://raw.githubusercontent.com/ymoyao/cocoapods-privacy/main/resources/NSPrivacyAccessedAPITypes.plist"
  • source.white.list : a white list of source, it effective in command 'pod privacy install' or 'pod install --privacy', will search white list for NSPrivacyAccessedAPITypes.
    • when the whitelist is an empty array, it means all components are whitelist(default config).
    • when the whitelist is not empty, it means only the components in the whitelist array are retrieved.
  • source.black.list : a black list of source, defalut is ‘github.com’, based on the whitelist, the components need to be excluded。 it effective in command 'pod privacy install' or 'pod install --privacy'.
  • api.template.url : its required, a template for search NSPrivacyAccessedAPITypes, you can use the provided by default。

If your needs are not met, you can custom! For example, there has some components,and it‘s your local config

"source.white.list": ["https://github.com/ReactiveCocoa/ReactiveObjC.git","git.yourserver.com","git.otherserver.com"],
"source.black.list": ["github.com","https://github.com/AFNetworking/AFNetworking.git"], 
"api.template.url": "https://raw.githubusercontent.com/ymoyao/cocoapods-privacy/main/resources/NSPrivacyAccessedAPITypes.plist"
https://github.com/AFNetworking/AFNetworking.git ❌ (it's in 'github.com' black list)
https://github.com/ReactiveCocoa/ReactiveObjC.git ❌ (it's in 'github.com' black list, although also on the white list,but the blacklist priority is high when conflict)
https://git.yourserver.com/xxx/xxxx.git ✅
https://git.yourserver.com/mmm/mmm.git ✅
https://git.otherserver.com/ssss/ssss.git ✅
https://git.yourserver.com/AFNetworking/AFNetworking.git ✅

After custom,you just update config by local like this

$ pod privacy config /yourfilepath/config.json

In a word, if you define both white and black lists ,final search range: white list minus black list, and empty white list means all!

To Component

$ pod privacy spec [podspec_file_path]

This command will auto create privacy file, and search the path of podspec' source_files' define relate to NSPrivacyAccessedAPITypes, finaly, write to PrivacyInfo.xcprivacy file. if your component has much subspec, all subspec that define ‘source_files’ will create PrivacyInfo.xcprivacy, and auto modify .podspec link .xcprivacy to 'resource_bundle' key. For example

  • origin podspec
Pod::Spec.new do |s|
  s.name             = 'Demo'
  ...
  s.source_files = 'xxxx'
  s.subspec 'idfa' do |sp|
      sp.source_files = 'xxxxx'
  end
  s.subspec 'noidfa' do |sp|
  end
end

  • podspec after commad 👇👇👇👇👇👇
Pod::Spec.new do |s|
  s.name             = 'Demo'
  ...
  s.source_files = 'xxxx'
  s.resource_bundle = {"Demo.privacy"=>"Pod/Privacy/Demo/PrivacyInfo.xcprivacy"}
  s.subspec 'idfa' do |sp|
      sp.source_files = 'xxxxx'
      sp.resource_bundle = {"Demo.idfa.privacy"=>"Pod/Privacy/Demo.idfa/PrivacyInfo.xcprivacy"}
  end
  s.subspec 'noidfa' do |sp|
  end
end
截屏2024-02-02 11 23 21

To Project

$ pod install --privacy
or
$ pod privacy install
截屏2024-02-02 10 59 59

After command, a PrivacyInfo.xcprivacy will create to you project Resources if empty.

Components that meet all of the following items will be processed.

  • do not have their own privacy manifest file components
  • in white list and not in black list components
  • source code components(binary components please deal with command pod privacy spec

Notice

The plugin is focus on NSPrivacyAccessedAPITypes and automatically search and create workflow. you should manager NSPrivacyCollectedDataTypes by yourself!

Could you please consider giving our repository a star🌟🌟🌟? It would mean a lot to us and help our project gain more visibility. Thank you!

cocoapods-privacy's People

Contributors

ymoyao avatar

Stargazers

Hamdan Ali M avatar  avatar 乘风破浪 avatar gh.guo avatar  avatar kewen avatar yuyangkk avatar Ezreal avatar jaykon avatar god~long avatar superchun avatar 李尚 avatar 波波 avatar VincentLee avatar  avatar  avatar Elvison avatar  avatar Adam Wienconek avatar Json avatar 研磨时光 avatar Glen Altenburg avatar  avatar TmouCanaan avatar Agalaba Ifeanyi Precious avatar Julien Di Marco avatar yangjw avatar  avatar FrokingMonkey avatar GodTwoChen avatar Josscii avatar Liloupar avatar Ben Getsug avatar 开水白菜 avatar Pan Yin avatar  avatar Jeremiah Ogbomo avatar Yvan avatar jeruik avatar win avatar Nico avatar Homero Oliveira avatar KEL avatar Felix Krause avatar jimmy avatar  avatar jnbt avatar  avatar actionsLjx avatar  avatar sjc avatar  avatar  avatar He Peng avatar moren_jojo avatar icc avatar Jochen Holzer avatar  avatar wzhao avatar Fearless avatar jhl avatar Gentle Kwan avatar JmoVxia avatar Liam Johnson avatar Andrei Rozhkov avatar  avatar huweiwei avatar RonCoding avatar ONG_J avatar Joseph avatar Mortal avatar  avatar Gabriel avatar  avatar  avatar HolyShit avatar 李言 avatar  avatar coderyi avatar  avatar leleyinhangjia avatar LeoLu avatar AllenLau avatar HJ avatar cocat avatar Lian avatar JasonY avatar Xia Zhou avatar Jon avatar MonkeyZ avatar Monkey·D·Luffy avatar BinBear avatar hyq avatar Adriano Souza Costa avatar Christos Koninis avatar  avatar sssdeng avatar 袁小荣 avatar jiang avatar  avatar

Watchers

 avatar  avatar

cocoapods-privacy's Issues

多target的问题

多target的工程,xcprivacy文件是否只会加到第一个target?

安装成功后,找不到指令

% pod privacy config https://raw.githubusercontent.com/ymoyao/cocoapods-privacy/main/resources/config.json
[!] Unknown command: privacy

好不容易升级了 Ruby 后安装
% sudo gem install cocoapods-privacy
Password:
Fetching cocoapods-privacy-0.5.0.gem
Successfully installed cocoapods-privacy-0.5.0
Parsing documentation for cocoapods-privacy-0.5.0
Installing ri documentation for cocoapods-privacy-0.5.0
Done installing documentation for cocoapods-privacy after 3 seconds
1 gem installed

ruby-3.0.0 , cocapods-1.15 版本报错 ~

TypeError - no implicit conversion of nil into String
/Users/XXXXXX/.rvm/gems/ruby-3.0.0/gems/cocoapods-privacy-0.5.3/lib/cocoapods-privacy/privacy/PrivacyUtils.rb:30:in extname' /Users/XXXXXX/.rvm/gems/ruby-3.0.0/gems/cocoapods-privacy-0.5.3/lib/cocoapods-privacy/privacy/PrivacyUtils.rb:30:in project_code_fold'
/Users/XXXXXX/.rvm/gems/ruby-3.0.0/gems/cocoapods-privacy-0.5.3/lib/cocoapods-privacy/privacy/privacy_installer_hook.rb:127:in privacy_handle' /Users/XXXXXX/.rvm/gems/ruby-3.0.0/gems/cocoapods-privacy-0.5.3/lib/cocoapods-privacy/privacy/privacy_installer_hook.rb:72:in install!'
/Users/XXXXXX/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.15.0/lib/cocoapods/command/install.rb:52:in run' /Users/XXXXXX/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/claide-1.1.0/lib/claide/command.rb:334:in run'
/Users/XXXXXX/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.15.0/lib/cocoapods/command.rb:52:in run' /Users/XXXXXX/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.15.0/bin/pod:55:in <top (required)>'
/Users/XXXXXX/.rvm/rubies/ruby-3.0.0/bin/pod:25:in load' /Users/XXXXXX/.rvm/rubies/ruby-3.0.0/bin/pod:25:in

'
/Users/XXXXXX/.rvm/gems/ruby-3.0.0/bin/ruby_executable_hooks:22:in eval' /Users/XXXXXX/.rvm/gems/ruby-3.0.0/bin/ruby_executable_hooks:22:in '

Encoding::CompatibilityError - invalid byte sequence in UTF-8

Encoding::CompatibilityError - invalid byte sequence in UTF-8
/Users/xxx/.rvm/gems/ruby-3.3.0/gems/cocoapods-privacy-0.5.1/lib/cocoapods-privacy/privacy/PrivacyHunter.rb:214:in `strip'
/Users/xxx/.rvm/gems/ruby-3.3.0/gems/cocoapods-privacy-0.5.1/lib/cocoapods-privacy/privacy/PrivacyHunter.rb:214:in `block in contains_apis_ignore_line_comment'
/Users/xxx/.rvm/gems/ruby-3.3.0/gems/cocoapods-privacy-0.5.1/lib/cocoapods-privacy/privacy/PrivacyHunter.rb:213:in `each'
/Users/xxx/.rvm/gems/ruby-3.3.0/gems/cocoapods-privacy-0.5.1/lib/cocoapods-privacy/privacy/PrivacyHunter.rb:213:in `contains_apis_ignore_line_comment'
/Users/xxx/.rvm/gems/ruby-3.3.0/gems/cocoapods-privacy-0.5.1/lib/cocoapods-privacy/privacy/PrivacyHunter.rb:203:in `contains_apis?'
/Users/xxx/.rvm/gems/ruby-3.3.0/gems/cocoapods-privacy-0.5.1/lib/cocoapods-privacy/privacy/PrivacyHunter.rb:340:in `block in search_files'
/Users/xxx/.rvm/gems/ruby-3.3.0/gems/cocoapods-privacy-0.5.1/lib/cocoapods-privacy/privacy/PrivacyHunter.rb:339:in `each'
/Users/xxx/.rvm/gems/ruby-3.3.0/gems/cocoapods-privacy-0.5.1/lib/cocoapods-privacy/privacy/PrivacyHunter.rb:339:in `each_with_index'
/Users/xxx/.rvm/gems/ruby-3.3.0/gems/cocoapods-privacy-0.5.1/lib/cocoapods-privacy/privacy/PrivacyHunter.rb:339:in `search_files'
/Users/xxx/.rvm/gems/ruby-3.3.0/gems/cocoapods-privacy-0.5.1/lib/cocoapods-privacy/privacy/PrivacyHunter.rb:44:in `search_pricacy_apis'
/Users/xxx/.rvm/gems/ruby-3.3.0/gems/cocoapods-privacy-0.5.1/lib/cocoapods-privacy/privacy/PrivacyModule.rb:240:in `load_project'
/Users/xxx/.rvm/gems/ruby-3.3.0/gems/cocoapods-privacy-0.5.1/lib/cocoapods-privacy/privacy/privacy_installer_hook.rb:135:in `privacy_handle'
/Users/xxx/.rvm/gems/ruby-3.3.0/gems/cocoapods-privacy-0.5.1/lib/cocoapods-privacy/privacy/privacy_installer_hook.rb:72:in `install!'
/Users/xxx/.rvm/rubies/ruby-3.3.0/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/command/install.rb:52:in `run'
/Users/xxx/.rvm/rubies/ruby-3.3.0/lib/ruby/gems/3.3.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Users/xxx/.rvm/rubies/ruby-3.3.0/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/command.rb:52:in `run'
/Users/xxx/.rvm/rubies/ruby-3.3.0/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/bin/pod:55:in `<top (required)>'
/Users/xxx/.rvm/rubies/ruby-3.3.0/bin/pod:25:in `load'
/Users/xxx/.rvm/rubies/ruby-3.3.0/bin/pod:25:in `<main>'
/Users/xxx/.rvm/gems/ruby-3.3.0/bin/ruby_executable_hooks:22:in `eval'
/Users/xxx/.rvm/gems/ruby-3.3.0/bin/ruby_executable_hooks:22:in `<main>'

podfile里面的依赖库是怎样处理的

想问下,项目podfile中,以下几种情况的依赖库是怎样处理的
1.源码倚赖,依赖库本身已经提供xcprivacy文件
2.源码倚赖,依赖库本身没有提供xcprivacy文件
3.二进制倚赖

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.