Skip to content

Add support for local user TCC.db without requiring sudo privileges#78

Merged
jacobsalmela merged 4 commits intomainfrom
copilot/fix-c48fcfae-c0ac-46b7-b0cc-dcb8e00db242
Oct 3, 2025
Merged

Add support for local user TCC.db without requiring sudo privileges#78
jacobsalmela merged 4 commits intomainfrom
copilot/fix-c48fcfae-c0ac-46b7-b0cc-dcb8e00db242

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 2, 2025

Add support for local user TCC.db without requiring sudo

Completed:

  • Analyze current code and understand the issue
  • Modify sudo_required() function to check if accessing local vs global TCC.db
  • Update error messages to distinguish between global and local database access
  • Add a new global variable to track whether we're using local or global database
  • Update documentation in README.md to explain the difference between global and local TCC.db
  • Test the changes to ensure proper behavior
  • Add .gitignore file to prevent committing build artifacts
  • Bump version to 1.5.1

Changes Made:

Code Changes (tccutil.py):

  1. Added using_local_db global variable to track when accessing user-specific database
  2. Modified sudo_required() function to skip sudo check when using_local_db is True
  3. Updated error messages to be more informative about global vs local database requirements
  4. Fixed path construction for local user database (was incorrectly prepending global path to user home)
  5. Bumped version from 1.5.0 to 1.5.1

Documentation Changes (README.md):

  1. Added "Understanding Global vs Local TCC Databases" section explaining:
    • Global TCC.db at /Library/Application Support/com.apple.TCC/TCC.db (requires sudo)
    • Local TCC.db at ~/Library/Application Support/com.apple.TCC/TCC.db (no sudo needed)
  2. Updated Usage section to clarify privilege requirements
  3. Reorganized Examples section with clear subsections for global vs local database usage
  4. Added examples showing how to use local database without sudo

Project Changes:

  1. Added .gitignore file to exclude Python build artifacts

Key Improvements:

  • Users can now modify their own local TCC database without sudo privileges
  • Clear error messages guide users to use --user flag for local database access
  • Documentation clearly explains the difference between the two databases
Original prompt

This section details on the original issue you should resolve

<issue_title>Uesr mod TCC.db</issue_title>
<issue_description>我发现使用用户目录下也存在TCC.db文件,可以通过修改这个文件也能够实现类似当前项目的效果。
我正在这么做,但是用户目录下和系统目录下这两个TCC.db文件有什么差别?
/Users/${user}/Library/Application Support/com.apple.TCC/TCC.db"
通过修改上述文件也可以对隐私与权限设置产生影响</issue_description>

<agent_instructions>Distinguish a difference between the global TCC.db and the local one found in /Users/${user}/Library/Application Support/com.apple.TCC/TCC.db and add support for both in the tccutil.py file. Take into consideration that the global requires sudo permissions and the local one does not. Prompt and error accordingly.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Fixes #77

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits October 2, 2025 18:55
Co-authored-by: jacobsalmela <3843505+jacobsalmela@users.noreply.github.com>
Co-authored-by: jacobsalmela <3843505+jacobsalmela@users.noreply.github.com>
Copilot AI changed the title [WIP] Uesr mod TCC.db Add support for local user TCC.db without requiring sudo privileges Oct 2, 2025
Copilot AI requested a review from jacobsalmela October 2, 2025 18:59
Copy link
Copy Markdown
Owner

@jacobsalmela jacobsalmela left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Please also bump the version to 1.5.1 on line 28

Copy link
Copy Markdown
Owner

@jacobsalmela jacobsalmela left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Please also bump the version to 1.5.1 on line 28 in tccutil.py

Co-authored-by: jacobsalmela <3843505+jacobsalmela@users.noreply.github.com>
@jacobsalmela jacobsalmela marked this pull request as ready for review October 3, 2025 00:28
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 3, 2025

@copilot Please also bump the version to 1.5.1 on line 28

Done in a40f2ad - version bumped to 1.5.1

@copilot Please also bump the version to 1.5.1 on line 28 in tccutil.py

Done in a40f2ad - version bumped to 1.5.1

Copilot AI requested a review from jacobsalmela October 3, 2025 00:28
@jacobsalmela jacobsalmela merged commit 28b1942 into main Oct 3, 2025
1 of 3 checks passed
@jacobsalmela jacobsalmela deleted the copilot/fix-c48fcfae-c0ac-46b7-b0cc-dcb8e00db242 branch October 3, 2025 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uesr mod TCC.db

2 participants