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

TheSafe: config ability to encrypt values using macros and vars #870

Closed
itadapter opened this issue May 25, 2023 · 6 comments
Closed

TheSafe: config ability to encrypt values using macros and vars #870

itadapter opened this issue May 25, 2023 · 6 comments
Assignees
Labels
- RTM - Released to manufacturing AREA-CONFIG Configuration AREA-SECURITY Security CONCEPT Needs conceptual design session CRITICAL Critical Issue affecting the whole system PROJECT A project which is comprised of multiple tasks

Comments

@itadapter
Copy link
Contributor

For example:

section
{
  pwd=$(/myvars/$var::decipher) //using var reference
  pwd_inplace=$(::decipher value="base64obfuscatedcipheredvalue") //password in place
}

We need to add process-wide secret, whihc is NOT "seen" in config context, probably use USER ENV var SKY_MACHINE_SECRET by default.
The algorithm must NOT rely on Azos.App.SecMan.Cryptography because it needs to configure secman, intead it should be a sinple AES256-based algorithm specifically designed for conf vars protection.

We need to add option to phash to cipher config values using a password phrase, e.g.:

$ ./sky phash protect -value "something to cipher" -key "use this AES key"
Value "something....." was protected into:
  hhfihsfTIUTy36753hjjhjhhhbase64Stringfshdufhshfusdf78787
@itadapter itadapter self-assigned this May 25, 2023
@itadapter itadapter added AREA-SECURITY Security AREA-CONFIG Configuration wip This is being worked on right now labels May 25, 2023
@itadapter
Copy link
Contributor Author

itadapter commented May 29, 2023

This works, as-is, meaning macro does not need a path to be called:

Console.WriteLine("$(::as-string value=\"123456789\" key=\"dodik\"), the value is $(/dont-exist::as-int dflt=\"-456\") OK?".EvaluateVars());
//123456789, the value is -456 OK?

we can add decrypt macro that will decipher value.
Consideration needs to be given to prevent un-inteded disclosure, for example via a an "eval" cmdlet.

Maybe add a "SecurityFlowScope" assertion to check for "AllowEncodedVariables".
Set this scope ONLY in -password reading code in Crypto algorithms.
In other places the scope is not set, and an attempt to read such variable results in SecurityException - AccessDenied

@itadapter itadapter added CRITICAL Critical Issue affecting the whole system CONCEPT Needs conceptual design session labels Jul 10, 2023
zhabis added a commit that referenced this issue Jul 11, 2023
zhabis added a commit that referenced this issue Jul 11, 2023
zhabis added a commit that referenced this issue Jul 12, 2023
zhabis added a commit that referenced this issue Jul 12, 2023
zhabis added a commit that referenced this issue Jul 12, 2023
zhabis added a commit that referenced this issue Jul 13, 2023
zhabis added a commit that referenced this issue Jul 13, 2023
zhabis added a commit that referenced this issue Jul 13, 2023
zhabis added a commit that referenced this issue Jul 14, 2023
zhabis added a commit that referenced this issue Jul 14, 2023
zhabis added a commit that referenced this issue Jul 15, 2023
zhabis added a commit that referenced this issue Jul 15, 2023
zhabis added a commit that referenced this issue Jul 15, 2023
zhabis added a commit that referenced this issue Jul 15, 2023
zhabis added a commit that referenced this issue Jul 15, 2023
zhabis added a commit that referenced this issue Jul 15, 2023
@itadapter
Copy link
Contributor Author

image

zhabis added a commit that referenced this issue Jul 15, 2023
@itadapter
Copy link
Contributor Author

image

@itadapter itadapter added the PROJECT A project which is comprised of multiple tasks label Jul 16, 2023
@itadapter itadapter changed the title Config ability to encrypt values using macros and vars TheSafe: Config ability to encrypt values using macros and vars Jul 16, 2023
zhabis added a commit that referenced this issue Jul 16, 2023
zhabis added a commit that referenced this issue Jul 16, 2023
@itadapter
Copy link
Contributor Author

NEED UNIT TESTS!!!!!!!!

zhabis added a commit that referenced this issue Jul 16, 2023
zhabis added a commit that referenced this issue Jul 16, 2023
zhabis added a commit that referenced this issue Jul 16, 2023
zhabis added a commit that referenced this issue Jul 17, 2023
zhabis added a commit that referenced this issue Jul 17, 2023
zhabis added a commit that referenced this issue Jul 17, 2023
zhabis added a commit that referenced this issue Jul 17, 2023
zhabis added a commit that referenced this issue Jul 17, 2023
zhabis added a commit that referenced this issue Jul 17, 2023
zhabis added a commit that referenced this issue Jul 17, 2023
zhabis added a commit that referenced this issue Jul 17, 2023
zhabis added a commit that referenced this issue Jul 17, 2023
zhabis added a commit that referenced this issue Jul 18, 2023
zhabis added a commit that referenced this issue Jul 20, 2023
@itadapter
Copy link
Contributor Author

itadapter commented Jul 20, 2023

::decipher should Throw if it cant get a value unless noerror=false is passed
because we had invalid key name and did not even know about it
this does not work : $(::decipher algo='dev.gen') becacuse algo is set to 'dev.gen' with single quotes (macro parser does not understand single quote)

@itadapter
Copy link
Contributor Author

DEPLOYED everywhere in G8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- RTM - Released to manufacturing AREA-CONFIG Configuration AREA-SECURITY Security CONCEPT Needs conceptual design session CRITICAL Critical Issue affecting the whole system PROJECT A project which is comprised of multiple tasks
Projects
None yet
Development

No branches or pull requests

1 participant