Skip to content

Commit

Permalink
Fix/enhance security for browser elements (#847)
Browse files Browse the repository at this point in the history
* fix: Improve Handling of Sensitive Data in Browser

Signed-off-by: bhavanakarwade <[email protected]>

* improved error handling for layout component

Signed-off-by: bhavanakarwade <[email protected]>

* refactor: improve variables initialization logic

Signed-off-by: bhavanakarwade <[email protected]>

* removed hardcoded variables

Signed-off-by: bhavanakarwade <[email protected]>

* added file path in yml file

Signed-off-by: bhavanakarwade <[email protected]>

* refactor: added variable in constants file

Signed-off-by: bhavanakarwade <[email protected]>

* fix: signin issue

Signed-off-by: bhavanakarwade <[email protected]>

* refactor dev yml file

Signed-off-by: bhavanakarwade <[email protected]>

* fix: yml file

Signed-off-by: bhavanakarwade <[email protected]>

* fix: refactor common constants file

Signed-off-by: bhavanakarwade <[email protected]>

* fix: refactor yml file

Signed-off-by: bhavanakarwade <[email protected]>

* fix: added varibles in yml file

Signed-off-by: bhavanakarwade <[email protected]>

* fix: signin issue

Signed-off-by: bhavanakarwade <[email protected]>

---------

Signed-off-by: bhavanakarwade <[email protected]>
  • Loading branch information
bhavanakarwade authored Dec 23, 2024
1 parent ef55a56 commit b008606
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
echo "PUBLIC_MODE=DEV" > .env
echo "PUBLIC_BASE_URL=https://devapi.credebl.id" >> .env
echo "PUBLIC_BASE_URL=${{ secrets.DEV_PUBLIC_BASE_URL }}" >> .env
echo "PUBLIC_SHOW_NAME_AS_LOGO=true" >> .env
Expand Down
4 changes: 1 addition & 3 deletions src/config/CommonConstant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ export const storageKeys = {
ALL_SCHEMAS:'allSchemaFlag',
ECOSYSTEM_ID: "ecosystem_id",
ECOSYSTEM_ROLE: "ecosystem_role",


}

export const emailCredDefHeaders = [
Expand All @@ -64,7 +62,7 @@ export const emailCredDefHeaders = [
{ columnName: 'Revocable' },
];

export const excludeKeys = ['PUBLIC_CRYPTO_PRIVATE_KEY', 'PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_ID', 'PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_SECRET', 'PUBLIC_ALLOW_DOMAIN'];
export const excludeKeys = ['PUBLIC_BASE_URL', 'PUBLIC_CRYPTO_PRIVATE_KEY', 'PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_ID', 'PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_SECRET', 'PUBLIC_ALLOW_DOMAIN'];

export const predicatesConditions = [
{ value: '', label: 'Select' },
Expand Down
2 changes: 1 addition & 1 deletion src/config/SocketConfig.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { envConfig } from "./envConfig"
import io from "socket.io-client"

const SOCKET = io(`${envConfig.PUBLIC_BASE_URL}`, {
const SOCKET = io(`${import.meta.env.PUBLIC_BASE_URL}`, {
reconnection: true,
reconnectionDelay: 500,
reconnectionAttempts: Infinity,
Expand Down
2 changes: 1 addition & 1 deletion src/config/ssrApiConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const API = async ({ token, url, method, payload }: IProps) => {
method,
body: JSON.stringify(payload),
};
const baseURL = globalThis.baseUrl || envConfig.PUBLIC_BASE_URL || process.env.PUBLIC_BASE_URL;
const baseURL = globalThis.baseUrl || import.meta.env.PUBLIC_BASE_URL || process.env.PUBLIC_BASE_URL;
const apiURL = baseURL + url;
const res = await fetch(apiURL, {
...config,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/user/[user].astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { envConfig } from '../../config/envConfig';
import { pathRoutes } from '../../config/pathRoutes';
const { user } = Astro.params;
const baseUrl = process.env.PUBLIC_BASE_URL || envConfig.PUBLIC_BASE_URL
const baseUrl = process.env.PUBLIC_BASE_URL || import.meta.env.PUBLIC_BASE_URL
const response = await fetch(`${baseUrl}/users/public-profiles/${user}`);
const data = await response.json();
const userData = data?.data;
Expand Down
6 changes: 3 additions & 3 deletions src/services/axiosIntercepter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getFromLocalStorage, setToLocalStorage } from '../api/Auth';
import { apiStatusCodes, storageKeys } from '../config/CommonConstant';

const instance = axios.create({
baseURL: envConfig.PUBLIC_BASE_URL,
baseURL: import.meta.env.PUBLIC_BASE_URL,
});

const EcosystemInstance = axios.create({
Expand All @@ -16,7 +16,7 @@ const EcosystemInstance = axios.create({
const checkAuthentication = async (sessionCookie: string, request: AxiosRequestConfig) => {
const isAuthPage = window.location.href.includes('/authentication/sign-in') || window.location.href.includes('/authentication/sign-up')
try {
const baseURL = envConfig.PUBLIC_BASE_URL || process.env.PUBLIC_BASE_URL;
const baseURL = import.meta.env.PUBLIC_BASE_URL || process.env.PUBLIC_BASE_URL;
const config = {
headers: {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -48,7 +48,7 @@ const checkAuthentication = async (sessionCookie: string, request: AxiosRequestC
}
} catch (error) { }
};
const { PUBLIC_BASE_URL, PUBLIC_ECOSYSTEM_BASE_URL }: any = globalThis
const { PUBLIC_BASE_URL, PUBLIC_ECOSYSTEM_BASE_URL }: any = import.meta.env

instance.interceptors.request.use(async config => {
config.baseURL = PUBLIC_BASE_URL;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/check-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const checkUserSession = async ({

try {
const baseURL =
envConfig.PUBLIC_BASE_URL ||
import.meta.env.PUBLIC_BASE_URL ||
process.env.PUBLIC_BASE_URL;
const config = {
headers: {
Expand Down

0 comments on commit b008606

Please sign in to comment.