@@ -151,7 +151,6 @@ runFicus ficusConfig = do
151151 logDebugWithTime " Ficus binary extracted, building command..."
152152 cmd <- ficusCommand ficusConfig bin
153153 logDebugWithTime " Executing ficus (streaming)"
154- logDebug $ " Ficus command: " <> pretty (renderCommand cmd)
155154 logDebug $ " Working directory: " <> pretty (toFilePath $ ficusConfigRootDir ficusConfig)
156155
157156 logDebugWithTime " Creating process configuration..."
@@ -235,26 +234,41 @@ runFicus ficusConfig = do
235234
236235-- Run Ficus, passing config-based args as configuration.
237236-- Caveat! This hard-codes some flags currently which may later need to be set on a strategy-by-strategy basis.
238- ficusCommand :: Has Diagnostics sig m => FicusConfig -> BinaryPaths -> m Command
237+ ficusCommand :: ( Has Diagnostics sig m , Has Logger sig m ) => FicusConfig -> BinaryPaths -> m Command
239238ficusCommand ficusConfig bin = do
240239 endpoint <- case ficusConfigEndpoint ficusConfig of
241240 Just baseUri -> do
242241 proxyUri <- setPath [PathComponent " api" , PathComponent " proxy" , PathComponent " analysis" ] (TrailingSlash False ) baseUri
243242 pure $ render proxyUri
244243 Nothing -> pure " https://app.fossa.com/api/proxy/analysis"
245- pure $
246- Command
247- { cmdName = toText $ toPath bin
248- , cmdArgs = configArgs endpoint
249- , cmdAllowErr = Never
250- }
244+ let cmd =
245+ Command
246+ { cmdName = toText $ toPath bin
247+ , cmdArgs = configArgs endpoint
248+ , cmdAllowErr = Never
249+ }
250+ logDebug $ " Ficus command: " <> pretty (maskApiKeyInCommand $ renderCommand cmd)
251+ pure cmd
251252 where
252253 configArgs endpoint = [" analyze" , " --secret" , secret, " --endpoint" , endpoint, " --locator" , locator, " --set" , " all:skip-hidden-files" , " --set" , " all:gitignore" , " --exclude" , " .git" , " --exclude" , " .git/**" ] ++ configExcludes ++ [targetDir]
253254 targetDir = toText $ toFilePath $ ficusConfigRootDir ficusConfig
254255 secret = maybe " " (toText . unApiKey) $ ficusConfigSecret ficusConfig
255256 locator = renderLocator $ Locator " custom" (projectName $ ficusConfigRevision ficusConfig) (Just $ projectRevision $ ficusConfigRevision ficusConfig)
256257 configExcludes = unGlobFilter <$> ficusConfigExclude ficusConfig
257258
259+ maskApiKeyInCommand :: Text -> Text
260+ maskApiKeyInCommand cmdText =
261+ case Text. splitOn " --secret " cmdText of
262+ [before, after] ->
263+ case Text. words after of
264+ (_ : rest) ->
265+ before
266+ <> " --secret "
267+ <> " ******"
268+ <> if null rest then " " else " " <> Text. unwords rest
269+ [] -> cmdText
270+ _ -> cmdText
271+
258272-- add a FicusMessage to the corresponding entry of an empty FicusMessages
259273singletonFicusMessage :: FicusMessage -> FicusMessages
260274singletonFicusMessage message = case message of
0 commit comments