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

Default file permission misleading #147

Closed
1 task done
tibeer opened this issue Oct 8, 2022 · 4 comments
Closed
1 task done

Default file permission misleading #147

tibeer opened this issue Oct 8, 2022 · 4 comments
Labels

Comments

@tibeer
Copy link
Contributor

tibeer commented Oct 8, 2022

Terraform CLI and Provider Versions

Terraform v1.3.2
on darwin_arm64

  • provider registry.terraform.io/hashicorp/local v2.2.3

Terraform Configuration

resource "local_file" "dummy_file" {
  content  = "foobar"
  filename = "./dummy.txt"
}

Expected Behavior

File is created according to the default value for attribute file_permission (0777) which would mean:

tf@hashicorp example % ls -al dummy.txt
-rwxrwxrwx  1 tf  staff  6  8 Oct 16:02 dummy.txt

Actual Behavior

File is created with the default umask permissions.

tf@hashicorp example % ls -al dummy.txt
-rwxr-xr-x  1 tf  staff  6  8 Oct 16:02 dummy.txt

Steps to Reproduce

  1. terraform apply
  2. ls -al dummy.txt

How much impact is this issue causing?

Low

Logs

No response

Additional Information

As per the documentation, if no file_permission attribute is set, the default value would be used (0777). Happily this does not seem to be the case currently because it might be a security issue. The same issue is present for directory_permission. Might also be that the documentation is misleading here or I am mistaken :)

Code of Conduct

  • I agree to follow this project's Code of Conduct
@tibeer tibeer added the bug label Oct 8, 2022
@curx
Copy link

curx commented Oct 9, 2022

@tibeer what is the value of your umask?

@tibeer
Copy link
Contributor Author

tibeer commented Oct 10, 2022

022

@SBGoods
Copy link
Contributor

SBGoods commented Jan 12, 2023

Hi @tibeer,
Thank you for raising this issue. I've updated our documentation in #155 regarding the file_permission and directory_permission attributes to clarify that those are the values before the umask is applied.
Thanks again for bringing this to our attention and feel free to reach out with any questions/concerns!

@SBGoods SBGoods closed this as completed Jan 12, 2023
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants