-
Notifications
You must be signed in to change notification settings - Fork 7
Pushing Develop Code to Master Branch. (non release repo) #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Mahesh-Binayak
wants to merge
152
commits into
master
Choose a base branch
from
develop
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
152 commits
Select commit
Hold shift + click to select a range
18acffe
[MOSIP-29854] Creating dockerfile for dbvaluefinder script
Mahesh-Binayak 7bb822e
Merge pull request #1 from Mahesh-Binayak/develop
Mahesh-Binayak f232b40
[MOSIP-29854] Updating directory
Mahesh-Binayak 8dabb96
[MOSIP-29854] Updating filenames
Mahesh-Binayak 1aa1c78
[MOSIP-29854]Created push_trigger.yml
Mahesh-Binayak 07eb0c7
Merge branch 'develop' of https://github.com/mosip/security-tools int…
Mahesh-Binayak 8ad0645
Merge branch 'develop' of https://github.com/mahesh-binayak/security-…
Mahesh-Binayak 8130bd1
[MOSIP-29854] Updating filenames
Mahesh-Binayak bcc87bb
[MOSIP-29854] Updated push_trigger.yml
Mahesh-Binayak 2a4fd2b
[MOSIP-29854] Updated push_trigger.yml
Mahesh-Binayak 288f32b
[MOSIP-29854] Updated push_trigger.yml
Mahesh-Binayak 9c17fca
[MOSIP-29854] Updated push_trigger.yml
Mahesh-Binayak bab1c4a
[MOSIP-29854] Updated push_trigger.yml
Mahesh-Binayak 717ddb0
[MOSIP-29854] Updated push_trigger.yml
Mahesh-Binayak 27de7eb
[MOSIP-29854] Updated push_trigger.yml
Mahesh-Binayak 006f175
[MOSIP-29854] Updated push_trigger.yml
Mahesh-Binayak 6608b0c
[MOSIP-29854] Updated push_trigger.yml
Mahesh-Binayak 3cbe423
[MOSIP-29854] Updated port number
Mahesh-Binayak f45988d
Merge pull request #2 from Mahesh-Binayak/develop
Mahesh-Binayak 751af3d
Added docker build job
VSIVAKALYAN 36e4f64
Merge pull request #3 from VSIVAKALYAN/develop
Mahesh-Binayak c1a99c3
Revert "Added docker build job"
Mahesh-Binayak a04c0d9
Merge pull request #4 from mosip/revert-3-develop
Mahesh-Binayak fac2673
[MOSIP-29854] created own image
Mahesh-Binayak 5e82dfc
[MOSIP-29854] created own image
Mahesh-Binayak 09a30cd
[MOSIP-29854] created own image
Mahesh-Binayak 220765c
[MOSIP-29854] created own image
Mahesh-Binayak c135419
[MOSIP-29854] created own image and updated script
Mahesh-Binayak de9f5b6
Merge pull request #5 from Mahesh-Binayak/update
Mahesh-Binayak fae2537
[MOSIP-29854] created own image and updated script
Mahesh-Binayak bb5b75d
Merge pull request #3 from Mahesh-Binayak/update
Mahesh-Binayak 4f5737d
[MOSIP-29854] created own image and updated script
Mahesh-Binayak 5e7a293
[MOSIP-29854] created own image and updated script
Mahesh-Binayak ddddfd7
Merge pull request #4 from Mahesh-Binayak/update
Mahesh-Binayak e3c6b57
[MOSIP-29854] created own image and updated script on update branch
Mahesh-Binayak 57cdf22
[MOSIP-29854] created own image and updated script on update branch
Mahesh-Binayak de7f1ce
[MOSIP-29854] created own image and updated script on update branch
Mahesh-Binayak 5d92313
[MOSIP-29854] created own image and updated script on update branch
Mahesh-Binayak 238b76e
[MOSIP-29854] created own image and updated script on update branch
Mahesh-Binayak d0f8a8f
[MOSIP-29854] updated script on update branch
Mahesh-Binayak 9e26907
[MOSIP-29854] updated script on update branch
Mahesh-Binayak d4a17d1
[MOSIP-29854] updated script on update branch
Mahesh-Binayak 46f9ff4
[MOSIP-29854] updated script on update branch
Mahesh-Binayak 9bf0f9f
[MOSIP-29854] updatepush_trigger and Dockerfile on update branch
Mahesh-Binayak 4c8d924
[MOSIP-29854] updatepush_trigger and Dockerfile on update branch
Mahesh-Binayak 1673f21
[MOSIP-29854]Renamed to lowercase
Mahesh-Binayak 9551bd5
Merge pull request #6 from Mahesh-Binayak/update
ckm007 3b2505f
Merge pull request #7 from mosip/update
Mahesh-Binayak 2cf5366
[MOSIP-29854]Updated regex and added db.properties
Mahesh-Binayak e85a684
[MOSIP-29854]Updated regex and added db.properties
Mahesh-Binayak 9ae776d
[MOSIP-29854]Updated regex and added db.properties
Mahesh-Binayak 8a77524
Merge pull request #8 from Mahesh-Binayak/update
Mahesh-Binayak e3363ad
[MOSIP-29854]Updated regex and added db.properties
Mahesh-Binayak c7e1374
[MOSIP-29854]Updated regex and added db.properties
Mahesh-Binayak 3c03d0c
Merge pull request #9 from Mahesh-Binayak/update
Mahesh-Binayak 8225896
[MOSIP-29854]Added PMS db to checklist
Mahesh-Binayak 83f78a8
Merge pull request #10 from Mahesh-Binayak/update
Mahesh-Binayak 4fa3421
[MOSIP-29854]Added PMS db to checklist
Mahesh-Binayak 34e4334
Merge pull request #11 from Mahesh-Binayak/update
Mahesh-Binayak 4b37897
Revert "[MOSIP-29854]Added PMS db to checklist"
Mahesh-Binayak 6942eea
Merge pull request #12 from mosip/revert-11-update
Mahesh-Binayak b3fb0d8
[MOSIP-29854]Added PMS db to checklist
Mahesh-Binayak 465ae0c
Merge pull request #13 from Mahesh-Binayak/update
Mahesh-Binayak 41bd685
Merge pull request #5 from Mahesh-Binayak/update
Mahesh-Binayak 6ad2504
Merge pull request #14 from Mahesh-Binayak/develop
Mahesh-Binayak c238be9
Merge pull request #15 from mosip/update
Mahesh-Binayak cb8cf0f
script enhancement
rajapandi1234 0e82c30
script enhancement
rajapandi1234 08c7546
script enhancement
rajapandi1234 47497c0
script enhancement
rajapandi1234 775ccd8
script enhancement
rajapandi1234 991c470
Merge pull request #18 from rajapandi1234/develop
Mahesh-Binayak 6381233
[MOSIP-31232] added files for certificate check and update
Mahesh-Binayak 79bf809
[MOSIP-31232] added files for certificate check and update
Mahesh-Binayak d303c93
[MOSIP-31232] added files for certificate check and update
Mahesh-Binayak 976f971
[MOSIP-31232] added files for certificate check and update
Mahesh-Binayak 4282e0f
[MOSIP-31232] added files for certificate check and update and named …
Mahesh-Binayak dacf269
[MOSIP-31232] Updated filename to renew
Mahesh-Binayak e33f9fb
[MOSIP-31232] Updated filename to check and completed dockerisation
Mahesh-Binayak d8973e0
[MOSIP-31232]added feature in certalert.py and will use that. SH scri…
Mahesh-Binayak d09b506
for snyk test
rajapandi1234 68abf74
Update push_trigger.yml
Mahesh-Binayak 526b640
Update push_trigger.yml
Mahesh-Binayak 3e9eeb1
[MOSIP-31232]added feature in certalert.py and will use that. SH scri…
Mahesh-Binayak b924a3d
[MOSIP-31232]Renamed files , tested with local docker image
Mahesh-Binayak 6e55454
[MOSIP-31232]Created Push-trigger.yml
Mahesh-Binayak 8461f5e
[MOSIP-31232]Updated Dockerfile
Mahesh-Binayak f6c28d0
[MOSIP-31232]Updated Dockerfile
Mahesh-Binayak 5903356
Merge pull request #19 from Mahesh-Binayak/mbupdates
Mahesh-Binayak 4448d53
[MOSIP-31232]Updated Dockerfile
Mahesh-Binayak 26e1d49
[MOSIP-31232]Updated checkupdate.py
Mahesh-Binayak da574c4
Merge pull request #20 from Mahesh-Binayak/mbupdates
Mahesh-Binayak f1ffd3c
fix: databreachdetector/Dockerfile to reduce vulnerabilities
snyk-bot 92f8347
Merge pull request #2 from rajapandi1234/snyk-fix-27c439a74d734a29b7f…
rajapandi1234 57d821d
Update databreachdetector.py
rajapandi1234 02904e1
Revert "[Snyk] Security upgrade python from 3.9 to 3.13.0b1-slim"
rajapandi1234 b532155
Update requirements.txt
rajapandi1234 00fcc72
Merge pull request #22 from rajapandi1234/develop
Mahesh-Binayak b765e94
[MOSIP-35490] moved required helm and deploy scripts to modular repo
ckm007 c11e70e
[[MOSIP-35490] moved required helm and deploy scripts to modular repo…
Prafulrakhade 22f7041
[MOSIP-35490] moved required helm and deploy scripts to modular]
Prafulrakhade 7a3157c
Merge pull request #29 from Prafulrakhade/ckm007-patch-2
ckm007 28adca4
Merge pull request #30 from mosip/develop2
Mahesh-Binayak 111bbbb
Merge pull request #28 from mosip/ckm007-patch-2
ckm007 cd44539
Update README.md
Mahesh-Binayak 307aba5
[MOSIP-39249] added option to get partner-id input from an env variable
Mahesh-Binayak 56bf2af
Merge pull request #31 from Mahesh-Binayak/develop2
Mahesh-Binayak 9c1b40b
Merge branch 'develop2' of https://github.com/mosip/security-tools in…
0d6049d
[MOSIP-32088]added changes
Mahesh-Binayak 68cb197
Merge pull request #32 from Mahesh-Binayak/develop2
Mahesh-Binayak c9916d7
[MOSIP-32088]added changes
cd5af64
Merge pull request #33 from Mahesh-Binayak/develop2
Mahesh-Binayak b246026
[MOSIP-41596]Updated the code to check for all partners.
Mahesh-Binayak 28ecd39
Merge branch 'develop2' of https://github.com/mahesh-binayak/security…
e2c165d
Merge pull request #34 from Mahesh-Binayak/develop2
Mahesh-Binayak 1b4d93d
[MOSIP-41897]adding dummy sonar code for pr check.
Mahesh-Binayak afcb768
Merge pull request #35 from Mahesh-Binayak/develop
ckm007 9bf0eff
[MOSIP-41897]adding dummy sonar code for pr check.
Mahesh-Binayak 6df2c0d
[MOSIP-32607]Update bootstrap.properties
Mahesh-Binayak 06a3a2e
Merge pull request #36 from Mahesh-Binayak/develop2
ckm007 68ae63c
[MOSIP-32607] updated helm charts
web-flow 0e88b80
[MOSIP-32607] updated helm charts
Rakshithb1 b54fda5
[MOSIP-32607] updated added cluster role
Rakshithb1 de11ce8
[MOSIP-32607] updated added cluster role
Rakshithb1 17d35f0
[MOSIP-32607] updated added cluster role
Rakshithb1 3788a50
Merge pull request #37 from Rakshithb1/MOSIP-32607
ckm007 d6d81a6
[MOSIP-32607] updated host
Rakshithb1 de426b8
Merge pull request #38 from Rakshithb1/MOSIP-32607
ckm007 6084c63
[MOSIP-32607]
Rakshithb1 fc25dbc
Merge pull request #40 from Rakshithb1/MOSIP-32607
Mahesh-Binayak 6637977
[MOSIP-32607] corrected helm path
Rakshithb1 bb11230
Merge pull request #41 from Rakshithb1/MOSIP-32607
Mahesh-Binayak f91d4c2
[MOSIP-32607]
Rakshithb1 d13e79e
Merge pull request #42 from Rakshithb1/MOSIP-32607
Mahesh-Binayak 93e8bb5
[MOSIP-32607] added values.yaml in install.sh
Rakshithb1 d89f95d
Merge pull request #44 from Rakshithb1/MOSIP-32607
Mahesh-Binayak 6e3bee9
[MOSIP-32607] updated values.yaml
Rakshithb1 18d8215
[MOSIP-32607] updated values.yaml
Rakshithb1 d573a26
Merge pull request #45 from Rakshithb1/MOSIP-32607
Mahesh-Binayak 8685b38
[MOSIP-32607]
Rakshithb1 adae46b
Merge pull request #47 from Rakshithb1/MOSIP-32607
Mahesh-Binayak 90e16fe
[MOSIP-32607] added README.md
Mahesh-Binayak 12013a1
Merge pull request #48 from Mahesh-Binayak/develop
ckm007 1d34318
[MOSIP-43032] added auditsweeper tool along with its helm charts.
Mahesh-Binayak eae51af
[MOSIP-43032] added missing . in dockerfile.
Mahesh-Binayak 60dccc5
[MOSIP-43032] added missing . in dockerfile.
Mahesh-Binayak 3deaa7f
[MOSIP-43032] Optimized dockerfile and updated properties.
Mahesh-Binayak 0849b17
Merge pull request #51 from Mahesh-Binayak/MOSIP-43032
ckm007 73c3fae
[MOSIP-43032] Updated auditsweeper.py
Mahesh-Binayak 1cb1183
Merge pull request #52 from Mahesh-Binayak/MOSIP-43032
ckm007 7504c84
[MOSIP-43032] Updated auditsweeper's permissions ,image names and con…
Mahesh-Binayak b97b7b2
Merge pull request #53 from Mahesh-Binayak/MOSIP-43032
ckm007 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| name: Validate / Publish helm charts | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
| pull_request: | ||
| types: [opened, reopened, synchronize] | ||
| paths: | ||
| - 'helm/**' | ||
| workflow_dispatch: | ||
| inputs: | ||
| IGNORE_CHARTS: | ||
| description: 'Provide list of charts to be ignored separated by pipe(|)' | ||
| required: false | ||
| default: '""' | ||
| type: string | ||
| CHART_PUBLISH: | ||
| description: 'Chart publishing to gh-pages branch' | ||
| required: false | ||
| default: 'NO' | ||
| type: string | ||
| options: | ||
| - YES | ||
| - NO | ||
| INCLUDE_ALL_CHARTS: | ||
| description: 'Include all charts for Linting/Publishing (YES/NO)' | ||
| required: false | ||
| default: 'NO' | ||
| type: string | ||
| options: | ||
| - YES | ||
| - NO | ||
| push: | ||
| branches: | ||
| - '!release-branch' | ||
| - '!master' | ||
| - 1.* | ||
| - 0.* | ||
| - develop | ||
| - MOSIP* | ||
| - release* | ||
| paths: | ||
| - 'helm/**' | ||
|
|
||
| jobs: | ||
| chart-lint-publish: | ||
| uses: mosip/kattu/.github/workflows/chart-lint-publish.yml@master | ||
| with: | ||
| CHARTS_DIR: ./helm | ||
| CHARTS_URL: https://mosip.github.io/mosip-helm | ||
| REPOSITORY: mosip-helm | ||
| BRANCH: gh-pages | ||
| INCLUDE_ALL_CHARTS: "${{ inputs.INCLUDE_ALL_CHARTS || 'NO' }}" | ||
| IGNORE_CHARTS: "${{ inputs.IGNORE_CHARTS || '\"\"' }}" | ||
| CHART_PUBLISH: "${{ inputs.CHART_PUBLISH || 'YES' }}" | ||
| LINTING_CHART_SCHEMA_YAML_URL: "https://raw.githubusercontent.com/mosip/kattu/master/.github/helm-lint-configs/chart-schema.yaml" | ||
| LINTING_LINTCONF_YAML_URL: "https://raw.githubusercontent.com/mosip/kattu/master/.github/helm-lint-configs/lintconf.yaml" | ||
| LINTING_CHART_TESTING_CONFIG_YAML_URL: "https://raw.githubusercontent.com/mosip/kattu/master/.github/helm-lint-configs/chart-testing-config.yaml" | ||
| LINTING_HEALTH_CHECK_SCHEMA_YAML_URL: "https://raw.githubusercontent.com/mosip/kattu/master/.github/helm-lint-configs/health-check-schema.yaml" | ||
| secrets: | ||
| TOKEN: ${{ secrets.ACTION_PAT }} | ||
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: Building Security Tools | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
| pull_request: | ||
| types: [opened, reopened, synchronize] | ||
| workflow_dispatch: | ||
| inputs: | ||
| message: | ||
| description: 'Message for manually triggering' | ||
| required: false | ||
| default: 'Triggered for Updates' | ||
| type: string | ||
| push: | ||
| branches: | ||
| - master | ||
| - 1.* | ||
| - develop* | ||
| - release* | ||
| - MOSIP* | ||
| - update | ||
|
|
||
| jobs: | ||
| build-dockers: | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - SERVICE_LOCATION: 'databreachdetector' | ||
| SERVICE_NAME: 'databreachdetector' | ||
| - SERVICE_LOCATION: 'certmanager' | ||
| SERVICE_NAME: 'certmanager' | ||
| - SERVICE_LOCATION: 'auditsweeper' | ||
| SERVICE_NAME: 'auditsweeper' | ||
| ONLY_DOCKER: true | ||
| fail-fast: false | ||
| name: ${{ matrix.SERVICE_NAME }} | ||
| uses: mosip/kattu/.github/workflows/docker-build.yml@master | ||
| with: | ||
| SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }} | ||
| SERVICE_NAME: ${{ matrix.SERVICE_NAME }} | ||
| ONLY_DOCKER: ${{ matrix.ONLY_DOCKER }} | ||
| secrets: | ||
| DEV_NAMESPACE_DOCKER_HUB: ${{ secrets.DEV_NAMESPACE_DOCKER_HUB }} | ||
| ACTOR_DOCKER_HUB: ${{ secrets.ACTOR_DOCKER_HUB }} | ||
| RELEASE_DOCKER_HUB: ${{ secrets.RELEASE_DOCKER_HUB }} | ||
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DEVOPS }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| name: SonarCloud PR Quality Gate | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - develop | ||
|
|
||
| jobs: | ||
| sonar_analysis: | ||
| name: maven-sonar-analysis | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK 21 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: 21 | ||
| distribution: 'temurin' | ||
|
|
||
| - name: Cache SonarCloud packages | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.sonar/cache | ||
| key: ${{ runner.os }}-sonar | ||
| restore-keys: ${{ runner.os }}-sonar | ||
|
|
||
| - name: Cache Maven packages | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.m2 | ||
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
| restore-keys: ${{ runner.os }}-m2 | ||
|
|
||
| - name: Run SonarCloud analysis | ||
| env: | ||
| SONAR_TOKEN: f4e496ee8ddc6661404844949201593f56078e94 | ||
| run: | | ||
| mvn -B verify sonar:sonar -Dsonar.projectKey=mosip_security-tools -Dsonar.organization=mosip -Dsonar.host.url=https://sonarcloud.io -DskipSigning=true | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| FROM python:3.9 | ||
|
|
||
| ARG SOURCE | ||
| ARG COMMIT_HASH | ||
| ARG COMMIT_ID | ||
| ARG BUILD_TIME | ||
| LABEL source=${SOURCE} | ||
| LABEL commit_hash=${COMMIT_HASH} | ||
| LABEL commit_id=${COMMIT_ID} | ||
| LABEL build_time=${BUILD_TIME} | ||
|
|
||
| ARG container_user=mosip | ||
| ARG container_user_group=mosip | ||
| ARG container_user_uid=1001 | ||
| ARG container_user_gid=1001 | ||
|
|
||
| # Create the user and set the working directory | ||
| RUN groupadd -r ${container_user_group} && useradd -u ${container_user_uid} -r -g ${container_user_group} -s /bin/bash -m -d /home/${container_user} ${container_user} | ||
|
|
||
| WORKDIR /home/${container_user} | ||
|
|
||
| # Add all files to the correct working directory | ||
| ADD . . | ||
|
|
||
| # Install kubectl and Python dependencies | ||
| RUN apt-get -y update && apt-get install -y curl \ | ||
| && curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.sio/release/stable.txt)/bin/linux/amd64/kubectl" \ | ||
| && chmod +x ./kubectl && mv ./kubectl /usr/local/bin/kubectl \ | ||
| && pip install --no-cache-dir -r requirements.txt \ | ||
| && chown -R ${container_user}:${container_user_group} /home/${container_user} | ||
|
|
||
| USER ${container_user} | ||
|
|
||
| ENV db-server= | ||
| ENV db-port= | ||
| ENV db-su-user= | ||
| ENV postgres-password= | ||
|
|
||
| CMD ["python", "auditsweeper.py"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| import os | ||
| import sys | ||
| import configparser | ||
| import psycopg2 | ||
|
|
||
| # This script performs a cleanup of old log entries from a PostgreSQL database. | ||
| # It is designed to be run as a Docker container via a cron job. | ||
|
|
||
| def get_db_credentials(): | ||
| """ | ||
| Attempts to get database credentials from environment variables. | ||
| If not found, falls back to a local.properties file. | ||
| """ | ||
| # List of required variables | ||
| required_vars = [ | ||
| "db-host", "db-port", "db-su-user", | ||
| "postgres-password", "log-age-days" | ||
| ] | ||
|
|
||
| env_vars = {var: os.getenv(var) for var in required_vars} | ||
|
|
||
| # Check if all environment variables are set | ||
| if all(env_vars.values()): | ||
| print("Using credentials from environment variables.") | ||
| return env_vars | ||
| else: | ||
| print("One or more required environment variables are not set. Checking for local.properties...") | ||
| config = configparser.ConfigParser() | ||
| config_file = "local.properties" | ||
|
|
||
| if not os.path.exists(config_file): | ||
| print(f"Error: Required variables not set and '{config_file}' not found.") | ||
| sys.exit(1) | ||
|
|
||
| try: | ||
| # Read the properties file, assuming a single section | ||
| config.read_string(f"[DEFAULT]\n{open(config_file).read()}") | ||
| props = config['DEFAULT'] | ||
|
|
||
| # Populate variables from the properties file | ||
| return {var: props.get(var) for var in required_vars} | ||
| except configparser.Error as e: | ||
| print(f"Error reading local.properties file: {e}") | ||
| sys.exit(1) | ||
|
|
||
| def cleanup_db(config): | ||
| """ | ||
| Connects to the database and performs the cleanup operation. | ||
| """ | ||
| db_name = "mosip_audit" | ||
| try: | ||
| conn = psycopg2.connect( | ||
| host=config["db-host"], | ||
| port=config["db-port"], | ||
| user=config["db-su-user"], | ||
| password=config["postgres-password"], | ||
| dbname=db_name | ||
| ) | ||
| cur = conn.cursor() | ||
|
|
||
| print(f"Starting database cleanup for logs older than {config['log-age-days']} days...") | ||
| print(f"Connecting to DB: {config['db-su-user']}@{config['db-host']}:{config['db-port']}/{db_name}") | ||
|
|
||
| # The core DELETE command | ||
| # Use a parameterized query for safety | ||
| delete_query = "DELETE FROM audit.app_audit_log WHERE log_dtimes < NOW() - INTERVAL %s" | ||
| interval_str = f"{config['log-age-days']} days" | ||
|
|
||
| cur.execute(delete_query, (interval_str,)) | ||
|
|
||
| # Get the number of rows deleted | ||
| rows_deleted = cur.rowcount | ||
| conn.commit() | ||
|
|
||
| print(f"Successfully deleted {rows_deleted} rows.") | ||
|
|
||
| except psycopg2.OperationalError as e: | ||
| print(f"Database connection or query failed: {e}") | ||
| sys.exit(1) | ||
| finally: | ||
| if 'conn' in locals() and conn: | ||
| conn.close() | ||
|
|
||
| if __name__ == "__main__": | ||
| db_config = get_db_credentials() | ||
| cleanup_db(db_config) | ||
| print("Database cleanup script finished successfully.") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| db-host=postgres.dev1.mosip.net | ||
| db-port=5432 | ||
| db-su-user=postgres | ||
| postgres-password=HEdM***9ZXir7Tu2F | ||
| log-age-days=85 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| psycopg2-binary==2.9.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| FROM python:3.9 | ||
|
|
||
| ARG SOURCE | ||
| ARG COMMIT_HASH | ||
| ARG COMMIT_ID | ||
| ARG BUILD_TIME | ||
| LABEL source=${SOURCE} | ||
| LABEL commit_hash=${COMMIT_HASH} | ||
| LABEL commit_id=${COMMIT_ID} | ||
| LABEL build_time=${BUILD_TIME} | ||
|
|
||
| ARG container_user=mosip | ||
| ARG container_user_group=mosip | ||
| ARG container_user_uid=1001 | ||
| ARG container_user_gid=1001 | ||
|
|
||
| # Install kubectl binary | ||
| RUN apt-get -y update \ | ||
| && apt-get install -y curl \ | ||
| && curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \ | ||
| && chmod +x ./kubectl && mv ./kubectl /usr/local/bin/kubectl | ||
|
|
||
| # Create user group | ||
| RUN groupadd -r ${container_user_group} && useradd -u ${container_user_uid} -r -g ${container_user_group} -s /bin/bash -m -d /home/${container_user} ${container_user} | ||
| RUN chown -R ${container_user}:${container_user} /home/${container_user} | ||
| WORKDIR /home/${container_user} | ||
| USER ${container_user} | ||
|
|
||
| ENV MYDIR=`pwd` | ||
| ENV DATE="$(date --utc +%FT%T.%3NZ)" | ||
| ENV ENABLE_INSECURE=false | ||
| ENV MODULE= | ||
|
|
||
|
|
||
| ENV db-server= | ||
| ENV db-port= | ||
| ENV db-su-user= | ||
| ENV postgres-password= | ||
| ENV ns_esignet=esignet | ||
|
|
||
| COPY partner.properties . | ||
| COPY requirements.txt . | ||
| COPY checkupdate.py . | ||
| COPY bootstrap.properties . | ||
| RUN pip install --no-cache-dir -r requirements.txt | ||
| CMD ["python", "checkupdate.py"] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 5 months ago
To fix the issue, add a
permissionsblock to the job definition at.github/workflows/sonar-check.ymlunder thesonar_analysisjob (line 10). The minimal recommended permission for most CI analysis workflows iscontents: read, which allows the job to read source code but not to push, modify, or delete repository content. As none of the steps in this job require write permissions to repository contents, usingcontents: readis the most secure and appropriate setting.Change summary:
permissions:block (withcontents: read) belowname: maven-sonar-analysis(line 10) and aboveruns-on: ubuntu-latest(line 11).