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

feat(analyzer & parser): decrypt Ansible Vault file on the fly #4976

Merged
merged 2 commits into from
Mar 14, 2022

Conversation

rafaela-soares
Copy link
Contributor

Closes #4417

Proposed Changes

  • Decrypt Ansible Vault file on the fly
  • Now, KICS can decrypt Ansible Vault files on the fly. For that, the user needs to define the environment variable ANSIBLE_VAULT_PASSWORD_FILE.

I submit this contribution under the Apache-2.0 license.

@rafaela-soares rafaela-soares added the feature request Community: new feature request label Mar 14, 2022
@rafaela-soares rafaela-soares self-assigned this Mar 14, 2022
Copy link
Collaborator

@joaoReigota1 joaoReigota1 left a comment

Choose a reason for hiding this comment

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

Other than some changes looks good to me


// DecryptAnsibleVault verifies if the fileContent is encrypted by ansible-vault. If yes, the function decrypts it
func DecryptAnsibleVault(fileContent []byte, secret string) []byte {
match, _ := regexp.MatchString(`^\s*\$ANSIBLE_VAULT.*`, string(fileContent))
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should check this error

pkg/utils/ansible_vault.go Show resolved Hide resolved
Copy link
Collaborator

@joaoReigota1 joaoReigota1 left a comment

Choose a reason for hiding this comment

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

LGTM

@joaoReigota1 joaoReigota1 merged commit e580338 into master Mar 14, 2022
@joaoReigota1 joaoReigota1 deleted the feat/decrypt_vault_files_on_the_fly branch March 14, 2022 11:45
@rafaela-soares rafaela-soares added go Pull requests that update Go code feature New feature and removed feature request Community: new feature request labels Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Decrypt ansible vault files on the fly
2 participants