Skip to content
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

fix: deleted api token can be reused if created again with same name #4978

Merged
merged 31 commits into from
Apr 26, 2024

Conversation

ashishdevtron
Copy link
Contributor

Description

introduced api token versioning to keep track of deleted/old tokens

Fixes #4960

Checklist:

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR requires documentation updates?
  • I've updated documentation as required by this PR.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have tested it for all user roles.
  • I have added all the required unit/api test cases.

Does this PR introduce a user-facing change?


Copy link

gitguardian bot commented Apr 22, 2024

⚠️ GitGuardian has uncovered 2 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
10220829 Triggered Generic High Entropy Secret b04a949 charts/devtron/devtron-bom.yaml View secret
10220829 Triggered Generic High Entropy Secret b04a949 charts/devtron/values.yaml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

pkg/apiToken/ApiTokenRepository.go Outdated Show resolved Hide resolved
pkg/apiToken/ApiTokenRepository.go Outdated Show resolved Hide resolved
pkg/apiToken/ApiTokenService.go Outdated Show resolved Hide resolved
pkg/apiToken/ApiTokenService.go Outdated Show resolved Hide resolved
pkg/auth/user/UserAuthService.go Outdated Show resolved Hide resolved
pkg/auth/user/UserService.go Outdated Show resolved Hide resolved
pkg/auth/user/UserService.go Show resolved Hide resolved
pkg/auth/user/repository/UserRepository.go Outdated Show resolved Hide resolved
pkg/auth/user/repository/UserRepository.go Outdated Show resolved Hide resolved
pkg/auth/user/UserService.go Outdated Show resolved Hide resolved
pkg/auth/user/helper/helper.go Outdated Show resolved Hide resolved
nishant-d
nishant-d previously approved these changes Apr 23, 2024
Copy link

Error: The SQL file number: 238 is duplicated

Copy link

Error: The SQL file number: 238 is duplicated

Copy link

Error: The SQL file number: 238 is duplicated

Copy link

sonarcloud bot commented Apr 26, 2024

Quality Gate Passed Quality Gate passed

Issues
3 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@ashishdevtron ashishdevtron merged commit 93c43ee into main Apr 26, 2024
4 checks passed
@ashishdevtron ashishdevtron deleted the api-token-fix-v2 branch April 26, 2024 12:37
Kishan789dev pushed a commit that referenced this pull request May 13, 2024
…4978)

* introuddced api token versioning

* fix

* reverted wire_gen

* migration udpated and minor refactor

* refactor

* moved const from apiToken pkg to user

* reverted wire_gen

* refactor

* reverted wire_gen

* concurrency case handled

* fix

* commented wherever necessary

* refactor

* fix

* refactor

* refactor

* wip

* refactor

* added comments and minor refactor

* refactor

* refactoring

* fix

* added comments around cyclic import

* added few more comments

* sql script no updated
komalreddy3 pushed a commit that referenced this pull request May 28, 2024
…4978)

* introuddced api token versioning

* fix

* reverted wire_gen

* migration udpated and minor refactor

* refactor

* moved const from apiToken pkg to user

* reverted wire_gen

* refactor

* reverted wire_gen

* concurrency case handled

* fix

* commented wherever necessary

* refactor

* fix

* refactor

* refactor

* wip

* refactor

* added comments and minor refactor

* refactor

* refactoring

* fix

* added comments around cyclic import

* added few more comments

* sql script no updated
Kishan789dev added a commit that referenced this pull request May 29, 2024
* issue has been on code level

* added the changes

* changes made to fix the bug is done

* Delete go.sum

* Delete go.mod

* fix: grpc error handling for TemplateChart req (#4980)

* grpc error handling

* fix

* fix: terminate sync if in progress  (#4946)

* terminate operation before sync

* using method for checking manual sync

* terminating only in case of error

* handling termination error

* updating sync function

* fix: Kubelink Requests getting Failed for gRPC method GetAppDetails (#5012)

* fixed

* code review comments

* fix: deleted api token can be reused if created again with same name (#4978)

* introuddced api token versioning

* fix

* reverted wire_gen

* migration udpated and minor refactor

* refactor

* moved const from apiToken pkg to user

* reverted wire_gen

* refactor

* reverted wire_gen

* concurrency case handled

* fix

* commented wherever necessary

* refactor

* fix

* refactor

* refactor

* wip

* refactor

* added comments and minor refactor

* refactor

* refactoring

* fix

* added comments around cyclic import

* added few more comments

* sql script no updated

* feat: Introduction to feasibility in Deployment (#4862)

* introduction to feasibility

* moved feasibility in trigger/devtronApps

* feasibility refactorings

* refactoring and feasibility manager

* removing vulnerability changes

* vulnerability checks retract

* dry run removed

* dry run checks removed

* refactoring

* removing unnecessary code

* comments

* trigger request

* doc: Changes made in the doc according to the newer version (#5024)

* Changes made in the doc according to the newer version

* Revert "Changes made in the doc according to the newer version"

This reverts commit 1f4d806.

* created a doc for the newer version of the plugin

* added the pass/fail condition

* corrected mistakes

* added failed workflow in ISLastReleaseStopType method (#5005)

* fix: Dockerfile ubuntu version (#5022)

* Update DockerfileEA

* Update Dockerfile

* doc: Added new doc in the index (#5029)

* Changes made in the doc according to the newer version

* Revert "Changes made in the doc according to the newer version"

This reverts commit 1f4d806.

* created a doc for the newer version of the plugin

* added the pass/fail condition

* corrected mistakes

* added the new doc in the index file

* fix: handle for wrong format of k8s version in semvercompare func in cronjob template charts (#5016)

* handle for wrong format of k8s version in semvercompare func in cronjob template charts

* TestStripPrereleaseFromK8sVersion UT's added

* constants added

* incorporated code review changes

* merge main

* feat: CD Trigger Plugin (#4810)

* Add files via upload

CD plugin

* Update 238_devtron_CD_trigger_v1.0.0.up.sql

* Rename 231_devtron_CD_trigger_v1.0.0.down.sql to 238_devtron_CD_trigger_v1.0.0.down.sql

* Rename 231_devtron_CD_trigger_v1.0.0.up.sql to 238_devtron_CD_trigger_v1.0.0.up.sql

* Update 238_devtron_CD_trigger_v1.0.0.up.sql

* Update 238_devtron_CD_trigger_v1.0.0.up.sql

* Update 238_devtron_CD_trigger_v1.0.0.up.sql

* Rename 238_devtron_CD_trigger_v1.0.0.down.sql to 240_devtron_CD_trigger_v1.0.0.down.sql

* Rename 238_devtron_CD_trigger_v1.0.0.up.sql to 240_devtron_CD_trigger_v1.0.0.up.sql

---------

Co-authored-by: Prakarsh <[email protected]>

* fix: terminal stuck in connecting state (#4989)

* closing channel after write operation

* removing close

* using buffered channel

* wip: making done channel bufferred

* terminal racecondition and deadlock fix

* wire run

* removing done send call

* updating bound channel send function

* panic handled (#5036)

* fix: git material saved in transaction (#5040)

* git material flow added in transaction

* wire refactored

* code review comments incorporated

* code review comments incorporated

* code review comments incorporated

* fix: App create api validations (#5019)

* wip

* error handling done

* fix

---------

Co-authored-by: ayushmaheshwari <[email protected]>

* gitops update updated (#5055)

* feat: Plugin to trigger Devtron Job (#5053)

* feat: Plugin to trigger Devtron Job (#5052)

* Update 241_devtronJobTrigger.up.sql

* fix: handle 5xx in fetch resource tree api and cd-trigger (#5050)

* handle context cancelled and deadline exceeded in fetch resource tree api

* handle context cancelled and deadline exceeded error for resource tree fetch api for acd deployment

* handle context cancelled and deadline exceeded error sync argo app with normal refresh

* revert TIMEOUT_IN_SECONDS

* revert bean TimeoutSlow param

* fix

* feat: resource scan  (#4977)

* cherry-pick

* incorporating feedbacks

* sync with main

* misc: uniform GitHub action (#5069)

* Update azure-devops-issue-sync.yml

* Update chart-sync.yaml

* Update create-release.yml

* Update enterprise-repo-sync.yaml

* Update pager-duty-issue-escalate.yaml

* Update update-release-notes.yml

* Update chart-sync.yaml

* Update create-release.yml

* Update enterprise-repo-sync.yaml

* Update update-release-notes.yml

* Update enterprise-repo-sync.yaml

---------

Co-authored-by: Prakarsh <[email protected]>

* fix (#5074)

* gitops validation in api (#5082)

* condition fix (#5088)

* handled namespace case if deleted by kubectl (#5081)

Co-authored-by: Shivam Nagar <[email protected]>

* resolved PR review comments also remove check for virtual cluster (#5095)

* feat: added sql for release and release channels (#4898)

* added sql for relese feat

* updated sql script no

* renamed sql files

* updated schema for release & release track

* fixes in schema

* updated schema

* made changes in old schemas

* enum correction

* minor change in script

* sql script update

* updated script

* updated sql script no

* exposed release resource

* updated sql script no

* updated release catalog data

* added rescind status change policy handling

* renaming policy json field

* updated schema ordering

* updated global policy version

* updated policy json

* prod bug fix

* updated policy lock status

* added action check policy release

* wip

* updated policy for release status

* updated down sql

* updated sql script no.

* fixed autocorrect issues

* added first released on key for release

* updated task run migration

* Added task run down migration

* sql script change

* updated policy for action check - instruction patch

* fixed schema merge conflict

---------

Co-authored-by: Shivam-nagar23 <[email protected]>

* sync with main

* final fixes done

* final code ready fo the pr

* changes suggested are incorporated

* missed changes in a file from above commit are added and committing now

* changes done for adding a if condition for apps

---------

Co-authored-by: ashishdevtron <[email protected]>
Co-authored-by: iamayushm <[email protected]>
Co-authored-by: Shashwat Dadhich <[email protected]>
Co-authored-by: Shivam Nagar <[email protected]>
Co-authored-by: satya_prakash <[email protected]>
Co-authored-by: jatin-jangir-0220 <[email protected]>
Co-authored-by: Prakash <[email protected]>
Co-authored-by: shaileshmehta16 <[email protected]>
Co-authored-by: Prakarsh <[email protected]>
Co-authored-by: ayushmaheshwari <[email protected]>
Co-authored-by: Kiran <[email protected]>
Co-authored-by: subhashish-devtron <[email protected]>
Co-authored-by: Laeeq Ahmad <[email protected]>
Co-authored-by: kartik-579 <[email protected]>
Co-authored-by: Shivam-nagar23 <[email protected]>
Co-authored-by: ShashwatDadhich <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: [Prod] In a specific case we are able to use old deleted API token
2 participants