Skip to content

Commit

Permalink
remove oauth provider from client package (#685)
Browse files Browse the repository at this point in the history
* remove oauth provider from client package

Signed-off-by: Brian DeHamer <bdehamer@github.com>

* Update .changeset/mighty-hornets-tan.md

Co-authored-by: Philip Harrison <philip@mailharrison.com>
Signed-off-by: Brian DeHamer <bdehamer@github.com>

---------

Signed-off-by: Brian DeHamer <bdehamer@github.com>
Co-authored-by: Philip Harrison <philip@mailharrison.com>
  • Loading branch information
bdehamer and feelepxyz committed Aug 15, 2023
1 parent 4455f7f commit d5060c0
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 566 deletions.
5 changes: 5 additions & 0 deletions .changeset/mighty-hornets-tan.md
@@ -0,0 +1,5 @@
---
'sigstore': major
---

Removes `oidcIssuer`, `oidcClient`, `oidcClientSecret`, and `oidcRedirectURL` from the options for the `sign` and `attest` functions. The OAuth identity provider that was associated with these options has been relocated to the `@sigstore/cli` package.
6 changes: 2 additions & 4 deletions package-lock.json

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

6 changes: 0 additions & 6 deletions packages/client/README.md
Expand Up @@ -218,12 +218,6 @@ for more details.
If the `SIGSTORE_ID_TOKEN` environment variable is set, it will use this to authenticate to Fulcio.
It is the callers responsibility to make sure that this token has the correct scopes.

### Interactive Flow

If sigstore-js cannot detect ambient credentials, then it will prompt the user to go through the
interactive flow.



[1]: https://github.com/sigstore/rekor
[2]: https://github.com/sigstore/protobuf-specs/blob/9b722b68a717778ba4f11543afa4ef93205ab502/protos/sigstore_bundle.proto#L63-L84
Expand Down
3 changes: 1 addition & 2 deletions packages/client/package.json
Expand Up @@ -37,8 +37,7 @@
"@sigstore/bundle": "^1.1.0",
"@sigstore/protobuf-specs": "^0.2.0",
"@sigstore/sign": "^1.0.0",
"@sigstore/tuf": "^1.0.3",
"make-fetch-happen": "^11.0.1"
"@sigstore/tuf": "^1.0.3"
},
"engines": {
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
Expand Down
13 changes: 1 addition & 12 deletions packages/client/src/__tests__/config.test.ts
Expand Up @@ -46,18 +46,7 @@ describe('createBundleBuilder', () => {
});
});

describe('when an OIDC issuer is provided', () => {
const options = {
oidcIssuer: 'https://example.com',
oidcClientID: 'abc',
};
it('returns a MessageSignatureBundleBuilder', () => {
const bundler = createBundleBuilder(bundleType, options);
expect(bundler).toBeInstanceOf(MessageSignatureBundleBuilder);
});
});

describe('when no OIDC options are provided', () => {
describe('when no OIDC token is provided', () => {
it('returns a MessageSignatureBundleBuilder', () => {
const bundler = createBundleBuilder(bundleType, {});
expect(bundler).toBeInstanceOf(MessageSignatureBundleBuilder);
Expand Down
65 changes: 0 additions & 65 deletions packages/client/src/__tests__/identity/issuer.test.ts

This file was deleted.

123 changes: 0 additions & 123 deletions packages/client/src/__tests__/identity/oauth.test.ts

This file was deleted.

15 changes: 1 addition & 14 deletions packages/client/src/config.ts
Expand Up @@ -26,7 +26,6 @@ import {
TSAWitness,
Witness,
} from '@sigstore/sign';
import identity from './identity';
import { CallbackSigner, SignerFunc } from './types/signature';
import * as sigstore from './types/sigstore';

Expand All @@ -43,10 +42,6 @@ export type SignOptions = {
fulcioURL?: string;
identityProvider?: IdentityProvider;
identityToken?: string;
oidcIssuer?: string;
oidcClientID?: string;
oidcClientSecret?: string;
oidcRedirectURL?: string;
rekorURL?: string;
signer?: SignerFunc;
tlogUpload?: boolean;
Expand Down Expand Up @@ -119,21 +114,13 @@ function initSigner(options: SignOptions): Signer {
}

// Instantiate an identity provider based on the supplied options. If an
// explicit identity token is provided, use that. Otherwise, if an OIDC issuer
// and client ID are provided, use the OIDC provider. Otherwise, use the CI
// explicit identity token is provided, use that. Otherwise, use the CI
// context provider.
function initIdentityProvider(options: SignOptions): IdentityProvider {
const token = options.identityToken;

if (token) {
return { getToken: () => Promise.resolve(token) };
} else if (options.oidcIssuer && options.oidcClientID) {
return identity.oauthProvider({
issuer: options.oidcIssuer,
clientID: options.oidcClientID,
clientSecret: options.oidcClientSecret,
redirectURL: options.oidcRedirectURL,
});
} else {
return new CIContextProvider('sigstore');
}
Expand Down
45 changes: 0 additions & 45 deletions packages/client/src/identity/index.ts

This file was deleted.

0 comments on commit d5060c0

Please sign in to comment.