Skip to content

Configure App.config

Nathan Leach edited this page Dec 18, 2020 · 13 revisions

An example XML configuration file is shown below. The configuration element contains sub-elements that contain the configuration attributes. These sections are described below:

  • configSections: This is a .Net internal configuration that should not be modified.
  • CxConnection: The server connection configuration.
  • CxCredentials: Credentials used when connecting the the web api.
  • CxAnalyticsService: Controls how the program executes.
  • CxLogOutput: Configuration for the Logging Output component.
  • CxMongoOutput: Configuration for the MongoDB Output component.
  • CxDB: Configuration for the CxSAST audit database connection.
  • CxAuditTrailRecords: The audit trail record name mapping for logger definitions or Mongo collections.
  • CxAuditTrailSupressions: Configuration to suppress crawling of selected audit records.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="CxCredentials" type="CxAnalytix.Configuration.CxCredentials, Configuration" />
    <section name="CxConnection" type="CxAnalytix.Configuration.CxConnection, Configuration" />
    <section name="CxAnalyticsService" type="CxAnalytix.Configuration.CxAnalyticsService, Configuration" />
    <section name="CxLogOutput" type="CxAnalytix.Out.Log4NetOutput.LogOutputConfig, Log4NetOutput" />
    <section name="CxMongoOutput" type="CxAnalytix.Out.MongoDBOutput.MongoOutConfig, MongoDBOutput" />
    <section name="CxMongoConnection" type="CxAnalytix.Out.MongoDBOutput.MongoConnectionConfig, MongoDBOutput" />
    <section name="CxDB" type="CxAnalytix.CxAuditTrails.DB.Config.CxAuditDBConnection, CxAuditTrailsDB"/>
    <section name="CxAuditTrailSupressions" type="CxAnalytix.AuditTrails.Crawler.Config.CxAuditTrailSupressions, CxAuditTrailsCrawler"/>
    <section name="CxAuditTrailRecords" type="CxAnalytix.AuditTrails.Crawler.Config.CxAuditTrailRecordNameMap, CxAuditTrailsCrawler"/>
  </configSections>

  <!-- Common config parameters -->
  <CxConnection URL="http://localhost"
                mnoURL="http://localhost:8080"
                TimeoutSeconds="600" ValidateCertificates="true" />
  <CxCredentials Username="foo" Password ="bar" />
  <CxAnalyticsService ConcurrentThreads="2" StateDataStoragePath=".\"
                      ProcessPeriodMinutes="120"
                      OutputFactoryClassPath="CxAnalytix.Out.Log4NetOutput.LoggerOutFactory, Log4NetOutput"
                      SASTScanSummaryRecordName="RECORD_SAST_Scan_Summary"
                      SASTScanDetailRecordName="RECORD_SAST_Scan_Detail"
                      SCAScanSummaryRecordName="RECORD_SCA_Scan_Summary"
                      SCAScanDetailRecordName="RECORD_SCA_Scan_Detail"
                      ProjectInfoRecordName="RECORD_Project_Info"
                      PolicyViolationsRecordName="RECORD_Policy_Violations"
                      />

  
  <!-- Specific output method configuration parameters -->
  <CxLogOutput DataRetentionDays="14" OutputRoot="logs\">
    <PurgeSpecs>
      <spec MatchSpec="*.log.*" />
    </PurgeSpecs>
  </CxLogOutput>

  <CxMongoConnection ConnectionString="mongodb://%COMPUTERNAME%:27017/<your DB name goes here>" />

  <CxMongoOutput>
    <!-- This section is optional -->
    <GeneratedShardKeys>
      <!-- Each of these are optional -->
      <Spec KeyName="pkey" CollectionName="SAST_Scan_Summary" FormatSpec="{ScanType}-{ScanFinished:yyyy-dddd}"  />
      <Spec KeyName="pkey" CollectionName="SAST_Scan_Detail" FormatSpec="{ScanType}-{QueryGroup}-{ScanFinished:yyyy-dddd}" />
    </GeneratedShardKeys>
  </CxMongoOutput>


  <CxDB ConnectionString="server=127.0.0.1\SQLEXPRESS,1433;User Id=foo;Password=bar" />

  <CxAuditTrailRecords
    CxDB.accesscontrol.AuditTrail="RECORD_CxDBaccesscontrolAuditTrail"
    CxActivity.dbo.AuditTrail="RECORD_CxActivitydboAuditTrail"
    CxActivity.dbo.Audit_DataRetention="RECORD_CxActivitydboAuditDataRetention"
    CxActivity.dbo.Audit_Logins="RECORD_CxActivitydboAuditLogins"
    CxActivity.dbo.Audit_Presets="RECORD_CxActivitydboAuditPresets"
    CxActivity.dbo.Audit_Projects="RECORD_CxActivitydboAuditProjects"
    CxActivity.dbo.Audit_Queries="RECORD_CxActivitydboAuditQueries"
    CxActivity.dbo.Audit_QueriesActions="RECORD_CxActivitydboAuditQueriesActions"
    CxActivity.dbo.Audit_Reports="RECORD_CxActivitydboAuditReports"
    CxActivity.dbo.Audit_ScanRequests="RECORD_CxActivitydboAuditScanRequests"
    CxActivity.dbo.Audit_Scans="RECORD_CxActivitydboAuditScans"
    CxActivity.dbo.Audit_Users="RECORD_CxActivitydboAuditUsers"
    />


  <CxAuditTrailSupressions
    CxDB.accesscontrol.AuditTrail="false"
    CxActivity.dbo.AuditTrail="false"
    CxActivity.dbo.Audit_DataRetention="false"
    CxActivity.dbo.Audit_Logins="false"
    CxActivity.dbo.Audit_Presets="false"
    CxActivity.dbo.Audit_Projects="false"
    CxActivity.dbo.Audit_Queries="false"
    CxActivity.dbo.Audit_QueriesActions="false"
    CxActivity.dbo.Audit_Reports="false"
    CxActivity.dbo.Audit_ScanRequests="false"
    CxActivity.dbo.Audit_Scans="false"
    CxActivity.dbo.Audit_Users="false"
    />


</configuration>