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

Allow obliterating id token privs #67

Merged
merged 3 commits into from
Nov 6, 2024
Merged
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
7 changes: 6 additions & 1 deletion dist/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { collectBacktraces } from "./backtrace.js";
import { CheckIn, Feature } from "./check-in.js";
import * as correlation from "./correlation.js";
import { IdsHost } from "./ids-host.js";
import { getBool, getStringOrNull } from "./inputs.js";
import { getBool, getBoolOrUndefined, getStringOrNull } from "./inputs.js";
import * as platform from "./platform.js";
import { SourceDef, constructSourceParameters } from "./sourcedef.js";
import * as actionsCache from "@actions/cache";
Expand Down Expand Up @@ -200,6 +200,15 @@ export abstract class DetSysAction {
this.nixStoreTrust = "unknown";
this.strictMode = getBool("_internal-strict-mode");

if (
getBoolOrUndefined(
"_internal-obliterate-actions-id-token-request-variables",
) === true
) {
process.env["ACTIONS_ID_TOKEN_REQUEST_URL"] = undefined;
process.env["ACTIONS_ID_TOKEN_REQUEST_TOKEN"] = undefined;
}

this.features = {};
this.featureEventMetadata = {};
this.events = [];
Expand Down
12 changes: 12 additions & 0 deletions src/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ const getBool = (name: string): boolean => {
return actionsCore.getBooleanInput(name);
};

/**
* Get a Boolean input from the Action's configuration by name, or undefined if it is unset.
*/
const getBoolOrUndefined = (name: string): boolean | undefined => {
if (getStringOrUndefined(name) === undefined) {
return undefined;
}

return actionsCore.getBooleanInput(name);
};

/**
* The character used to separate values in the input string.
*/
Expand Down Expand Up @@ -108,6 +119,7 @@ const getStringOrUndefined = (name: string): string | undefined => {

export {
getBool,
getBoolOrUndefined,
getArrayOfStrings,
getArrayOfStringsOrNull,
getMultilineStringOrNull,
Expand Down