Claude code inherits from the environment shell. So it could create a python program (or whatever language) to read the file:
# get_info.py
with open('~/.claude/secrets.env', 'r') as file:
content = file.read()
print(content)
And then run `python get_info.py`.While this inheritance is convenient for testing code, it is difficult to isolate Claude in a way that you can run/test your application without giving up access to secrets.
If you can, IP whitelisting your secrets so if they are leaked is not a problem is an approach I recommend.