Skip to content

flowey: make values secret, not variables #1338

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

Merged
merged 6 commits into from
May 16, 2025
Merged

Conversation

jstarks
Copy link
Member

@jstarks jstarks commented May 11, 2025

Currently, a ReadVar/WriteVar pair can be marked as secret, in which case flowey is careful never to display its value in logs. To mark a variable as such, the user must remember to create the variable pair with new_secret_var(), and the user must ensure that users of the variable to do not rewrite its contents into some other, non-secret variable. This is hard to do accurately, especially as we change the code to create more variables implicitly (via <foo>v-style methods such as reqv and emit_rust_stepv).

Change the model so that variables are not secret but their values can be--when any variable is written to, the caller can specify that the value is secret. Propagate this to readers of the variable, even if this variable is converted into and back from a CI environment variable.

By default, be conservative in marking values as secret: once a Rust step reads a secret value from a variable, mark all future values written by that step as secret. Add specific write_secret and write_non_secret methods for overriding this default.

@jstarks jstarks requested review from a team as code owners May 11, 2025 21:07
@daniel5151
Copy link
Contributor

Nice! Pushing secrecy to the value level seems like it should work better than having it at the variable level. My thinking was to lift secrecy to the type system (similar to claimed/not-claimed), but wrangling that extra type param would be far more annoying than this approach.

Also, glad to see some the cleanup in/around some of the more gnarly bits of internal plumbing!

@jstarks
Copy link
Member Author

jstarks commented May 12, 2025

Yeah, I had thought about putting it into the type system so that callers were aware they were using something that (might be) secret. But I think that makes it hard to auto-propagate the secret marker without playing lots of type system games or making everything extremely explicit. This approach seems the cleanest.

@jstarks jstarks requested a review from benhillis May 14, 2025 00:10
jstarks added 5 commits May 16, 2025 18:19
Currently, a `ReadVar`/`WriteVar` pair can be marked as secret, in which
case flowey is careful never to display it in logs. To mark a variable,
the user must remember to create the variable pair with `new_secret_var()`,
and the user must ensure that users of the variable to do not rewrite
its contents into some other, non-secret variable. This is hard to do
accurately, especially as we change the code to create more variables
implicitly.

Change the model so that _variables_ are not secret but their _values_
can be--when any variable is written to, the caller can specify that the
value is secret. Propagate this to readers of the variable, even if this
variable is converted into and back from a CI environment variable.

By default, be conservative: once a Rust step reads a secret from a
variable, treat all future values written as secret. Add specific
`write_secret` and `write_non_secret` methods for overriding this
default.
benhillis
benhillis previously approved these changes May 16, 2025
Copy link
Member

@benhillis benhillis left a comment

Choose a reason for hiding this comment

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

:shipit:

@jstarks jstarks disabled auto-merge May 16, 2025 18:44
@jstarks jstarks merged commit 7873452 into microsoft:main May 16, 2025
28 checks passed
@jstarks jstarks deleted the auto_secret branch May 16, 2025 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants