Skip to content

Commit

Permalink
Merge pull request #67 from DeterminateSystems/allow-obliterating-id-…
Browse files Browse the repository at this point in the history
…token-privs

Allow obliterating id token privs
  • Loading branch information
grahamc authored Nov 6, 2024
2 parents d5db891 + 6175acb commit 4280bc9
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 3 deletions.
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

0 comments on commit 4280bc9

Please sign in to comment.