Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "TCC Database structure is unknown (f773496775)" on macOS 14.2.1 Intel #70

Closed
C-Duv opened this issue Jul 24, 2024 · 3 comments · Fixed by #72
Closed

Error "TCC Database structure is unknown (f773496775)" on macOS 14.2.1 Intel #70

C-Duv opened this issue Jul 24, 2024 · 3 comments · Fixed by #72

Comments

@C-Duv
Copy link
Contributor

C-Duv commented Jul 24, 2024

When I try to run tccutil (v1.4.0 512b611 version) to read/add/enable some rules I get:

TCC Database structure is unknown (f773496775)

Steps to reproduce:

tccutil --service kTCCServiceAccessibility --list

According to my (few) available machine it doesn't seems to be version related. But I only have issues on Intel (can't tell if it's a general rule though).

Affected setups:

  • macOS v14.4.1 (build 23E224), Intel CPU
  • macOS v14.2.1 (build 23C71), Intel CPU

Non affected setups:

  • macOS v14.2.1 (build 23C71), Apple M2 CPU
  • macOS v14.2.1 (build 23C71), Intel CPU
  • macOS v14.5 (build 23F79), Apple M2 CPU
@C-Duv
Copy link
Contributor Author

C-Duv commented Jul 25, 2024

Precision: I am not really using tccutil.py v1.4.0, I am using the 512b611 version.

How can I help debug? Provide some example file? SQL dumps?

@C-Duv
Copy link
Contributor Author

C-Duv commented Jul 25, 2024

I think I got it: you have a list of known hashes for whatever the SELECT sql FROM sqlite_master WHERE name='access' and type='table' query returns (cf. https://github.com/jacobsalmela/tccutil/blob/20c8a11a6520009aab8574a3bb8eb2dcd5970bc5/tccutil.py#L144C9-L144C26).

On functional setups the return is:

CREATE TABLE access (    service        TEXT        NOT NULL,     client         TEXT        NOT NULL,     client_type    INTEGER     NOT NULL,     auth_value     INTEGER     NOT NULL,     auth_reason    INTEGER     NOT NULL,     auth_version   INTEGER     NOT NULL,     csreq          BLOB,     policy_id      INTEGER,     indirect_object_identifier_type    INTEGER,     indirect_object_identifier         TEXT NOT NULL DEFAULT 'UNUSED',     indirect_object_code_identity      BLOB,     flags          INTEGER,     last_modified  INTEGER     NOT NULL DEFAULT (CAST(strftime('%s','now') AS INTEGER)), pid INTEGER, pid_version INTEGER, boot_uuid TEXT NOT NULL DEFAULT 'UNUSED', last_reminded INTEGER NOT NULL DEFAULT 0,     PRIMARY KEY (service, client, client_type, indirect_object_identifier),    FOREIGN KEY (policy_id) REFERENCES policies(id) ON DELETE CASCADE ON UPDATE CASCADE)

Where it fails it's:

CREATE TABLE "access" (    service        TEXT        NOT NULL,     client         TEXT        NOT NULL,     client_type    INTEGER     NOT NULL,     auth_value     INTEGER     NOT NULL,     auth_reason    INTEGER     NOT NULL,     auth_version   INTEGER     NOT NULL,     csreq          BLOB,     policy_id      INTEGER,     indirect_object_identifier_type    INTEGER,     indirect_object_identifier         TEXT NOT NULL DEFAULT 'UNUSED',     indirect_object_code_identity      BLOB,     flags          INTEGER,     last_modified  INTEGER     NOT NULL DEFAULT (CAST(strftime('%s','now') AS INTEGER)), pid INTEGER, pid_version INTEGER, boot_uuid TEXT NOT NULL DEFAULT 'UNUSED', last_reminded INTEGER NOT NULL DEFAULT 0,     PRIMARY KEY (service, client, client_type, indirect_object_identifier),    FOREIGN KEY (policy_id) REFERENCES policies(id) ON DELETE CASCADE ON UPDATE CASCADE)

The single difference between the 2 is the quotes around access:

  • Non working/unknown: CREATE TABLE access (…
  • Working/known: CREATE TABLE "access" (…

A quick solution would be to trust the f773496775 hash, I'll file PR for that (edit: here it is #72).

Other solution would be to link obtained SQL so that syntax/format changes does not results in a new hash. But I can't see how to do this without adding a new dependency to the project.

For those who need a quick fix, here is a sed command that adds the f773496775 hash to the list of trusted macOS v14.0 hashes:

sed -i '' 's/, "e3a2181c14"\]/, "e3a2181c14", "f773496775"]/' tccutil.py

C-Duv added a commit to C-Duv/tccutil that referenced this issue Jul 25, 2024
On some setups (in my case macOS v14.4.1 (build 23E224) and macOS v14.2.1 (build 23C71) with Intel CPU) the computed digest on the access table's structure was not part of the expected macOS 14.x digests.

By comparing working and non-working output of `SELECT sql FROM sqlite_master WHERE name='access' and type='table'` I've discovered the only difference is cosmetic: a double-quote around access in the `CREATE TABLE` part (got `CREATE TABLE "access"` where `CREATE TABLE access` would have been accepted

Before a possible better fix to handle such small syntax changes, this commit adds f773496775 to the list of trusted digests.

Issue: jacobsalmela#70
jacobsalmela pushed a commit that referenced this issue Jul 26, 2024
On some setups (in my case macOS v14.4.1 (build 23E224) and macOS v14.2.1 (build 23C71) with Intel CPU) the computed digest on the access table's structure was not part of the expected macOS 14.x digests.

By comparing working and non-working output of `SELECT sql FROM sqlite_master WHERE name='access' and type='table'` I've discovered the only difference is cosmetic: a double-quote around access in the `CREATE TABLE` part (got `CREATE TABLE "access"` where `CREATE TABLE access` would have been accepted

Before a possible better fix to handle such small syntax changes, this commit adds f773496775 to the list of trusted digests.

Issue: #70
@C-Duv
Copy link
Contributor Author

C-Duv commented Jul 26, 2024

Thank you :)

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 a pull request may close this issue.

1 participant