Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions crates/vt_graph/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,9 @@ pub const DEFAULT_UNTRACKED_ENV: &[&str] = &[
// GitHub Actions
"GITHUB_*",
"RUNNER_*",
// https://docs.github.com/en/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-cloud-providers#using-custom-actions
// ACTIONS_ID_TOKEN_REQUEST_TOKEN is covered by *_TOKEN below.
"ACTIONS_ID_TOKEN_REQUEST_URL",
// Windows specific
"APPDATA",
// Node's compile cache uses LOCALAPPDATA to pick its cache directory
Expand Down
19 changes: 19 additions & 0 deletions crates/vt_plan/src/envs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ fn resolve_envs_with_patterns<'a>(

#[cfg(test)]
mod tests {
use vt_graph::config::DEFAULT_UNTRACKED_ENV;

use super::*;

fn create_test_envs(pairs: Vec<(&str, &str)>) -> FxHashMap<Arc<OsStr>, Arc<OsStr>> {
Expand Down Expand Up @@ -558,4 +560,21 @@ mod tests {
// Non-matching env should be filtered out
assert!(!envs.contains_key(OsStr::new("OTHER_VAR")));
}

#[test]
fn test_github_actions_oidc_env_untracked() {
let env_config = create_env_config(&[], DEFAULT_UNTRACKED_ENV);

let mut envs = create_test_envs(vec![
("ACTIONS_ID_TOKEN_REQUEST_URL", "https://example.com/id-token"),
("ACTIONS_ID_TOKEN_REQUEST_TOKEN", "request-token"),
("ACTIONS_UNRELATED", "should-be-filtered"),
]);

let _result = EnvFingerprints::resolve(&mut envs, &env_config).unwrap();

assert!(envs.contains_key(OsStr::new("ACTIONS_ID_TOKEN_REQUEST_URL")));
assert!(envs.contains_key(OsStr::new("ACTIONS_ID_TOKEN_REQUEST_TOKEN")));
assert!(!envs.contains_key(OsStr::new("ACTIONS_UNRELATED")));
}
}
Loading