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

Remove protocol prepending #66

Merged
merged 2 commits into from
Feb 21, 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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
if: ${{ matrix.auth == 'connect' }}
uses: ./configure # 1password/load-secrets-action/configure@<version>
with:
connect-host: localhost:8080
connect-host: http://localhost:8080
connect-token: ${{ secrets.OP_CONNECT_TOKEN }}
- name: Load secrets
id: load_secrets
Expand Down
9 changes: 0 additions & 9 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30086,15 +30086,6 @@ const validateAuth = () => {
throw new Error(authErr);
}
const authType = isConnect ? "Connect" : "Service account";
// Adjust Connect host to have a protocol
if (process.env[envConnectHost] &&
// The following lint error is not an issue because we are checking for the presence of the `http://` prefix;
// we are not using it as an insecure connection protocol to link out to another resource.
// eslint-disable-next-line no-restricted-syntax
!process.env[envConnectHost].startsWith("http://") &&
!process.env[envConnectHost].startsWith("https://")) {
process.env[envConnectHost] = `http://${process.env[envConnectHost]}`;
}
core.info(`Authenticated with ${authType}.`);
};
const extractSecret = (envName, shouldExportEnv) => {
Expand Down
17 changes: 0 additions & 17 deletions src/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,6 @@ describe("validateAuth", () => {
expect(validateAuth).toThrowError(authErr);
});

it("should append protocol if Connect host doesn't have it", () => {
process.env[envConnectHost] = "localhost:8080";
process.env[envConnectToken] = testConnectToken;
expect(validateAuth).not.toThrowError(authErr);
// The following lint error is not an issue because we are checking for the presence of the `http://` prefix;
// we are not using it as an insecure connection protocol to link out to another resource.
// eslint-disable-next-line no-restricted-syntax
expect(process.env[envConnectHost]).toBe("http://localhost:8080");
});

it("should not append protocol if Connect host has one", () => {
process.env[envConnectHost] = testConnectHost;
process.env[envConnectToken] = testConnectToken;
expect(validateAuth).not.toThrowError(authErr);
expect(process.env[envConnectHost]).toBe(testConnectHost);
});

it("should be authenticated as a Connect client", () => {
process.env[envConnectHost] = testConnectHost;
process.env[envConnectToken] = testConnectToken;
Expand Down
12 changes: 0 additions & 12 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,6 @@ export const validateAuth = (): void => {

const authType = isConnect ? "Connect" : "Service account";

// Adjust Connect host to have a protocol
if (
process.env[envConnectHost] &&
// The following lint error is not an issue because we are checking for the presence of the `http://` prefix;
// we are not using it as an insecure connection protocol to link out to another resource.
// eslint-disable-next-line no-restricted-syntax
!process.env[envConnectHost].startsWith("http://") &&
!process.env[envConnectHost].startsWith("https://")
) {
process.env[envConnectHost] = `http://${process.env[envConnectHost]}`;
}

core.info(`Authenticated with ${authType}.`);
};

Expand Down
Loading