Skip to content

Commit 3270ee4

Browse files
committed
Avoid sensitive terms in compiled source #12190
1 parent 41ec034 commit 3270ee4

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

bin/generate-client-configuration.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414

1515
$clientConfig = array_intersect_key($config, array_flip($clientKeys));
1616
$clientConfig['log']['url'] = $config['log']['url'];
17-
$clientConfig['signedQueries']['key'] = $config['signedQueries']['keys'][0] ?? '';
17+
$signedQueriesKey = $config['signedQueries']['keys'][0] ?? '';
1818

1919
$json = json_encode($clientConfig, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
20+
$signedQueriesKey = json_encode($signedQueriesKey, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
2021
$code = <<<STRING
2122
export const localConfig = $json as const;
23+
export const signedQueriesKey = $signedQueriesKey as const;
2224
STRING;
2325

2426
file_put_contents('client/app/shared/generated-config.ts', $code);

client/app/app.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
ShowOnDirtyErrorStateMatcher,
3131
} from '@angular/material/core';
3232
import {LoggerExtraService} from './shared/services/logger-extra.service';
33-
import {localConfig} from './shared/generated-config';
33+
import {localConfig, signedQueriesKey} from './shared/generated-config';
3434
import localeFRCH from '@angular/common/locales/fr-CH';
3535
import {provideRouter, withInMemoryScrolling, withRouterConfig} from '@angular/router';
3636
import {MAT_TABS_CONFIG, MatTabsConfig} from '@angular/material/tabs';
@@ -100,7 +100,7 @@ export const appConfig: ApplicationConfig = {
100100
},
101101
apolloOptionsProvider,
102102
{provide: MAT_TOOLTIP_DEFAULT_OPTIONS, useValue: matTooltipCustomConfig},
103-
provideHttpClient(withInterceptors([activityInterceptor, graphqlQuerySigner(localConfig.signedQueries.key)])),
103+
provideHttpClient(withInterceptors([activityInterceptor, graphqlQuerySigner(signedQueriesKey)])),
104104
provideRouter(
105105
routes,
106106
withRouterConfig({

0 commit comments

Comments
 (0)