3 Commits

Author SHA1 Message Date
ba7e966446 Reject duplicate service token on create
Some checks failed
Build docker image / Build-Docker-Image (push) Has been cancelled
rust-clippy analyze / Run rust-clippy analyzing (push) Has been cancelled
2025-10-25 19:45:08 +02:00
bdfa94cb15 Merge pull request #39 from flibusta-apps/dependabot/github_actions/github/codeql-action-4
Some checks failed
Build docker image / Build-Docker-Image (push) Has been cancelled
rust-clippy analyze / Run rust-clippy analyzing (push) Has been cancelled
Bump github/codeql-action from 3 to 4
2025-10-14 17:49:05 +02:00
dependabot[bot]
9855d967b5 Bump github/codeql-action from 3 to 4
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3 to 4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-08 10:05:44 +00:00
2 changed files with 16 additions and 1 deletions

View File

@@ -49,7 +49,7 @@ jobs:
continue-on-error: true continue-on-error: true
- name: Upload analysis results to GitHub - name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v3 uses: github/codeql-action/upload-sarif@v4
with: with:
sarif_file: rust-clippy-results.sarif sarif_file: rust-clippy-results.sarif
wait-for-processing: true wait-for-processing: true

View File

@@ -113,6 +113,21 @@ async fn create_service(db: Database, Json(data): Json<CreateServiceData>) -> im
return StatusCode::PAYMENT_REQUIRED.into_response(); return StatusCode::PAYMENT_REQUIRED.into_response();
}; };
let token_exists = sqlx::query_scalar!(
r#"
SELECT EXISTS(SELECT 1 FROM services WHERE token = $1)
"#,
token
)
.fetch_one(&db.0)
.await
.unwrap_or(Some(false))
.unwrap();
if token_exists {
return StatusCode::CONFLICT.into_response();
}
let service = sqlx::query_as!( let service = sqlx::query_as!(
Service, Service,
r#" r#"