Skip to content

Commit cf1a288

Browse files
authored
Remove protocol prepending (#66)
This code is no longer needed. Instead, we will enforce users to add the protocol themselves.
1 parent 2792fed commit cf1a288

File tree

4 files changed

+1
-39
lines changed

4 files changed

+1
-39
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
if: ${{ matrix.auth == 'connect' }}
4040
uses: ./configure # 1password/load-secrets-action/configure@<version>
4141
with:
42-
connect-host: localhost:8080
42+
connect-host: http://localhost:8080
4343
connect-token: ${{ secrets.OP_CONNECT_TOKEN }}
4444
- name: Load secrets
4545
id: load_secrets

dist/index.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30086,15 +30086,6 @@ const validateAuth = () => {
3008630086
throw new Error(authErr);
3008730087
}
3008830088
const authType = isConnect ? "Connect" : "Service account";
30089-
// Adjust Connect host to have a protocol
30090-
if (process.env[envConnectHost] &&
30091-
// The following lint error is not an issue because we are checking for the presence of the `http://` prefix;
30092-
// we are not using it as an insecure connection protocol to link out to another resource.
30093-
// eslint-disable-next-line no-restricted-syntax
30094-
!process.env[envConnectHost].startsWith("http://") &&
30095-
!process.env[envConnectHost].startsWith("https://")) {
30096-
process.env[envConnectHost] = `http://${process.env[envConnectHost]}`;
30097-
}
3009830089
core.info(`Authenticated with ${authType}.`);
3009930090
};
3010030091
const extractSecret = (envName, shouldExportEnv) => {

src/utils.test.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,6 @@ describe("validateAuth", () => {
4747
expect(validateAuth).toThrowError(authErr);
4848
});
4949

50-
it("should append protocol if Connect host doesn't have it", () => {
51-
process.env[envConnectHost] = "localhost:8080";
52-
process.env[envConnectToken] = testConnectToken;
53-
expect(validateAuth).not.toThrowError(authErr);
54-
// The following lint error is not an issue because we are checking for the presence of the `http://` prefix;
55-
// we are not using it as an insecure connection protocol to link out to another resource.
56-
// eslint-disable-next-line no-restricted-syntax
57-
expect(process.env[envConnectHost]).toBe("http://localhost:8080");
58-
});
59-
60-
it("should not append protocol if Connect host has one", () => {
61-
process.env[envConnectHost] = testConnectHost;
62-
process.env[envConnectToken] = testConnectToken;
63-
expect(validateAuth).not.toThrowError(authErr);
64-
expect(process.env[envConnectHost]).toBe(testConnectHost);
65-
});
66-
6750
it("should be authenticated as a Connect client", () => {
6851
process.env[envConnectHost] = testConnectHost;
6952
process.env[envConnectToken] = testConnectToken;

src/utils.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,6 @@ export const validateAuth = (): void => {
2626

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

29-
// Adjust Connect host to have a protocol
30-
if (
31-
process.env[envConnectHost] &&
32-
// The following lint error is not an issue because we are checking for the presence of the `http://` prefix;
33-
// we are not using it as an insecure connection protocol to link out to another resource.
34-
// eslint-disable-next-line no-restricted-syntax
35-
!process.env[envConnectHost].startsWith("http://") &&
36-
!process.env[envConnectHost].startsWith("https://")
37-
) {
38-
process.env[envConnectHost] = `http://${process.env[envConnectHost]}`;
39-
}
40-
4129
core.info(`Authenticated with ${authType}.`);
4230
};
4331

0 commit comments

Comments
 (0)