diff --git a/.github/workflows/trivy.yml b/.github/workflows/trivy.yml index 476e0ae2..d21fc7f6 100644 --- a/.github/workflows/trivy.yml +++ b/.github/workflows/trivy.yml @@ -12,12 +12,13 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 - - name: Build an image from Dockerfile run: | docker build -t docker.io/gisaia/arlas-wui-builder:${{ github.sha }} . - name: Run Trivy vulnerability scanner uses: aquasecurity/trivy-action@master + env: + TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db:2 with: image-ref: "docker.io/gisaia/arlas-wui-builder:${{ github.sha }}" format: "table" diff --git a/src/app/components/landing-page/landing-page-dialog.component.ts b/src/app/components/landing-page/landing-page-dialog.component.ts index 23afe099..d9bc8cdc 100644 --- a/src/app/components/landing-page/landing-page-dialog.component.ts +++ b/src/app/components/landing-page/landing-page-dialog.component.ts @@ -64,7 +64,6 @@ export class LandingPageDialogComponent implements OnInit, OnDestroy { private http: HttpClient, private logger: NGXLogger, public startupService: StartupService, - private configDescritor: ArlasConfigurationDescriptor, private translate: TranslateService, private mainFormManager: MainFormManagerService, private collectionService: CollectionService, @@ -129,11 +128,12 @@ export class LandingPageDialogComponent implements OnInit, OnDestroy { () => { this.landingPageService.getServerCollections(url).then( () => { - this.urlCollectionsSubscription = this.configDescritor.getAllCollections().subscribe( - collections => { - this.availablesCollections = collections; - this.collectionService.setCollections(collections); - this.collectionService.getCollectionsReferenceDescription().subscribe(cdrs => this.collectionService.setCollectionsRef(cdrs)); + this.urlCollectionsSubscription = this.collectionService.getCollectionsReferenceDescription().subscribe( + cdrs => { + const collectionsNames = cdrs.map(c => c.collection_name); + this.availablesCollections = collectionsNames; + this.collectionService.setCollections(collectionsNames); + this.collectionService.setCollectionsRef(cdrs); }, error => { this.logger.error(this.translate.instant('Unable to access the server. Please, verify the url.')); @@ -180,7 +180,7 @@ export class LandingPageDialogComponent implements OnInit, OnDestroy { ]).then(values => { const configJson = values[0] as Config; // Delete existing previewID to avoid right access problem on erase existing resource - if(!!configJson.resources?.previewId){ + if (!!configJson.resources?.previewId) { delete configJson.resources.previewId; } const configMapJson = values[1] as MapConfig; diff --git a/src/app/services/landing-page/landing-page.service.ts b/src/app/services/landing-page/landing-page.service.ts index eb9ada19..cc416982 100644 --- a/src/app/services/landing-page/landing-page.service.ts +++ b/src/app/services/landing-page/landing-page.service.ts @@ -30,6 +30,7 @@ import { ArlasConfigService, ArlasConfigurationDescriptor, ArlasSettingsService import { NGXLogger } from 'ngx-logger'; import { NgxSpinnerService } from 'ngx-spinner'; import { Observable, Subject, Subscription, takeUntil } from 'rxjs'; +import { CollectionReferenceDescription } from 'arlas-api'; @Injectable({ @@ -48,7 +49,6 @@ export class LandingPageService implements OnDestroy { private logger: NGXLogger, private translate: TranslateService, private configService: ArlasConfigService, - private configDescritor: ArlasConfigurationDescriptor, private defaultValuesService: DefaultValuesService, private collectionService: CollectionService, private arlasSettingsService: ArlasSettingsService, @@ -69,9 +69,9 @@ export class LandingPageService implements OnDestroy { public initWithConfig(configJson: Config, configMapJson: MapConfig, configId?: string, configName?: string, isRetry?: boolean) { this.spinner.show('importconfig'); this.getServerCollections(configJson.arlas.server.url).then(() => { - this.configDescritor.getAllCollections().pipe(takeUntil(this._onDestroy$)).subscribe({ - next: collections => { - this.initCollections(collections, configJson, configMapJson, configId, configName); + this.collectionService.getCollectionsReferenceDescription().pipe(takeUntil(this._onDestroy$)).subscribe({ + next: cdrs => { + this.initCollections(cdrs, configJson, configMapJson, configId, configName); }, error: () => { this.spinner.hide('importconfig'); @@ -89,46 +89,44 @@ export class LandingPageService implements OnDestroy { }); } - public initCollections(collections: string[], configJson: Config, configMapJson: MapConfig, configId?: string, configName?: string) { + private initCollections(cdrs: CollectionReferenceDescription[], configJson: Config, + configMapJson: MapConfig, configId?: string, configName?: string) { + const collections = cdrs.map(c => c.collection_name); this.collectionService.setCollections(collections); - this.collectionService.getCollectionsReferenceDescription().subscribe(cdrs => { - this.collectionService.setCollectionsRef(cdrs); - const collection = (collections.find(c => c === configJson.arlas.server.collection.name)); - if (!collection) { - this.spinner.hide('importconfig'); - this.logger.error( - this.translate.instant('Collection ') - + configJson.arlas.server.collection.name - + this.translate.instant(' unknown. Available collections: ') - + collections.join(', ')); - + this.collectionService.setCollectionsRef(cdrs); + const collection = (collections.find(c => c === configJson.arlas.server.collection.name)); + if (!collection) { + this.spinner.hide('importconfig'); + this.logger.error( + this.translate.instant('Collection ') + + configJson.arlas.server.collection.name + + this.translate.instant(' unknown. Available collections: ') + + collections.join(', ')); + } else { + if (this.arlasSettingsService.settings['use_time_filter']) { + this.startupService.getTimeFilter(collection, configJson.arlas.server.url, this.collectionService, this.arlasSettingsService) + .subscribe(timeFilter => { + this.startupService.applyArlasInterceptor(collection, timeFilter); + setTimeout(() => { + this.mainFormManager.doImport(configJson, configMapJson); + this.startEventSource.next(null); + this.spinner.hide('importconfig'); + }, 100); + }); + /** hack in order to trigger the spinner 'importconfig' + * otherwise, we will think the application is not loading + */ } else { - if (this.arlasSettingsService.settings['use_time_filter']) { - this.startupService.getTimeFilter(collection, configJson.arlas.server.url, this.collectionService, this.arlasSettingsService) - .subscribe(timeFilter => { - this.startupService.applyArlasInterceptor(collection, timeFilter); - setTimeout(() => { - this.mainFormManager.doImport(configJson, configMapJson); - this.startEventSource.next(null); - this.spinner.hide('importconfig'); - }, 100); - }); - /** hack in order to trigger the spinner 'importconfig' - * otherwise, we will think the application is not loading - */ - } else { - setTimeout(() => { - this.mainFormManager.doImport(configJson, configMapJson); - this.startEventSource.next(null); - this.spinner.hide('importconfig'); - }, 100); - } - - } - if (!!configId && !!configName) { - this.mainFormService.configChange.next({ id: configId, name: configName }); + setTimeout(() => { + this.mainFormManager.doImport(configJson, configMapJson); + this.startEventSource.next(null); + this.spinner.hide('importconfig'); + }, 100); } - }); + } + if (!!configId && !!configName) { + this.mainFormService.configChange.next({ id: configId, name: configName }); + } } public getServerCollections(serverUrl: string) { diff --git a/src/settings.yaml b/src/settings.yaml index da8c27b2..c08056c5 100644 --- a/src/settings.yaml +++ b/src/settings.yaml @@ -2,9 +2,9 @@ ############ AUTHENTICATION SETTINGS ############### ######################################################## authentication: - use_authent: false + use_authent: true auth_mode: iam - url: http://localhost/arlas_iam_server + url: 'https://localhost/arlas_iam_server' force_connect: true threshold: 60000 use_discovery: false @@ -26,12 +26,12 @@ authentication: sign_up_enabled: true persistence: - url: 'http://localhost:81/persist' + url: 'https://localhost/persist' ######################################################## ############ Permissions SETTINGS ################## ######################################################## permission: - url: http://localhost:81/permissions + url: 'https://localhost/arlas_permissions_server' ######################################################## ############ URLs to WUI app ####################### ########################################################