File tree Expand file tree Collapse file tree
packages/sim-cli/src/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -231,4 +231,30 @@ describe('whoami command', () => {
231231 expect ( output ) . not . toContain ( 'sim_super_secret_value' )
232232 expect ( output ) . not . toContain ( 'secret' )
233233 } )
234+
235+ it ( 'uses non-secret-shaped authentication metadata in machine output' , async ( ) => {
236+ mocks . profileFrom . mockReturnValue ( {
237+ name : 'default' ,
238+ endpoint : 'https://sim.ai' ,
239+ apiKey : 'sim_super_secret_value' ,
240+ workspaceId : 'ws_1' ,
241+ output : 'json' ,
242+ sources : {
243+ endpoint : 'default' ,
244+ apiKey : 'credentials' ,
245+ workspaceId : 'config' ,
246+ output : 'flag' ,
247+ } ,
248+ } )
249+
250+ await whoami ( )
251+
252+ const output = String ( vi . mocked ( console . log ) . mock . calls [ 0 ] [ 0 ] )
253+ expect ( JSON . parse ( output ) ) . toMatchObject ( {
254+ authenticated : true ,
255+ sources : { authentication : 'credentials' } ,
256+ } )
257+ expect ( output ) . not . toContain ( 'apiKey' )
258+ expect ( output ) . not . toContain ( 'sim_super_secret_value' )
259+ } )
234260} )
Original file line number Diff line number Diff line change @@ -236,7 +236,7 @@ export function whoamiCommand(): Command {
236236 authenticated : authentication . authenticated ,
237237 sources : {
238238 endpoint : sources . endpoint ,
239- apiKey : authentication . source ,
239+ authentication : authentication . source ,
240240 workspaceId : sources . workspaceId ,
241241 output : sources . output ,
242242 } ,
You can’t perform that action at this time.
0 commit comments