Skip to content

Commit 5768dc8

Browse files
author
Derek
committed
fix: Use ask instead of deny for sensitive file permissions in Claude Code
- Changed permissions from "deny" to "ask" so Claude prompts before accessing sensitive files rather than blocking access entirely - Added attribution settings to suppress commit and PR co-author messages - Moved managed-settings.json to a separate file for easier maintenance - Both Linux and macOS tasks now use the same src file
1 parent e105d34 commit 5768dc8

2 files changed

Lines changed: 30 additions & 49 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"env": {
3+
"DISABLE_TELEMETRY": "1",
4+
"DISABLE_ERROR_REPORTING": "1",
5+
"DISABLE_BUG_COMMAND": "1",
6+
"DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1"
7+
},
8+
"includeCoAuthoredBy": false,
9+
"attribution": {
10+
"commit": "",
11+
"pr": ""
12+
},
13+
"permissions": {
14+
"ask": [
15+
"Read(./.env)",
16+
"Read(./.env.*)",
17+
"Read(./secrets/**)",
18+
"Read(./**/*.pem)",
19+
"Read(./**/*.key)",
20+
"Read(./**/credentials*)",
21+
"Read(./**/*secret*)",
22+
"Read(~/.ssh/**)",
23+
"Read(~/.aws/**)",
24+
"Read(~/.gnupg/**)"
25+
]
26+
}
27+
}

ansible/roles/dfe_developer_core/tasks/claude.yml

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
# These settings apply to all users and cannot be overridden.
5353
# - Disables telemetry and error reporting
5454
# - Disables Co-Authored-By commit attribution
55-
# - Denies access to sensitive files (.env, secrets, keys, credentials)
55+
# - Prompts before accessing sensitive files (.env, secrets, keys, credentials)
5656

5757
- name: Create Claude Code managed settings directory (Linux)
5858
ansible.builtin.file:
@@ -74,64 +74,18 @@
7474

7575
- name: Install Claude Code managed settings (Linux)
7676
ansible.builtin.copy:
77+
src: managed-settings.json
7778
dest: /etc/claude-code/managed-settings.json
7879
mode: '0644'
7980
owner: root
8081
group: root
81-
content: |
82-
{
83-
"env": {
84-
"DISABLE_TELEMETRY": "1",
85-
"DISABLE_ERROR_REPORTING": "1",
86-
"DISABLE_BUG_COMMAND": "1",
87-
"DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1"
88-
},
89-
"includeCoAuthoredBy": false,
90-
"permissions": {
91-
"deny": [
92-
"Read(./.env)",
93-
"Read(./.env.*)",
94-
"Read(./secrets/**)",
95-
"Read(./**/*.pem)",
96-
"Read(./**/*.key)",
97-
"Read(./**/credentials*)",
98-
"Read(./**/*secret*)",
99-
"Read(~/.ssh/**)",
100-
"Read(~/.aws/**)",
101-
"Read(~/.gnupg/**)"
102-
]
103-
}
104-
}
10582
when: ansible_distribution in ['Fedora', 'Ubuntu']
10683

10784
- name: Install Claude Code managed settings (macOS)
10885
ansible.builtin.copy:
86+
src: managed-settings.json
10987
dest: /Library/Application Support/ClaudeCode/managed-settings.json
11088
mode: '0644'
11189
owner: root
11290
group: wheel
113-
content: |
114-
{
115-
"env": {
116-
"DISABLE_TELEMETRY": "1",
117-
"DISABLE_ERROR_REPORTING": "1",
118-
"DISABLE_BUG_COMMAND": "1",
119-
"DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1"
120-
},
121-
"includeCoAuthoredBy": false,
122-
"permissions": {
123-
"deny": [
124-
"Read(./.env)",
125-
"Read(./.env.*)",
126-
"Read(./secrets/**)",
127-
"Read(./**/*.pem)",
128-
"Read(./**/*.key)",
129-
"Read(./**/credentials*)",
130-
"Read(./**/*secret*)",
131-
"Read(~/.ssh/**)",
132-
"Read(~/.aws/**)",
133-
"Read(~/.gnupg/**)"
134-
]
135-
}
136-
}
13791
when: ansible_distribution == 'MacOSX'

0 commit comments

Comments
 (0)