Skip to content

Release alpha to master: SonarCloud gate fixes and local store hardening - #376

Open
prashantasdeveloper wants to merge 7 commits into
masterfrom
alpha
Open

prashantasdeveloper wants to merge 7 commits into
masterfrom
alpha

Conversation

@prashantasdeveloper

Copy link
Copy Markdown
Contributor

JIRA Link

N/A

Changelog / Description

Releases the four commits on alpha that are not yet on master, from #374 and #375. 6be8068 is a fix:, so merging cuts a patch release.

  1. fix: use null-prototype maps in local API key and signer stores (fix: 🐛 use null-prototype maps in local API key and signer stores #375)

    • LocalApiKeysRepo.apiKeys and LocalSigningService.addressBook are now created with Object.create(null), so lookups only match entries that were explicitly configured or added.
    • Adds regression tests for lookups of unconfigured keys and signer handles, and for a signer handle that collides with a built-in object property name.
  2. chore: resolve SonarCloud quality gate failures (chore: 🤖 resolve SonarCloud quality gate failures #374)

    • Security (S6505): CI installs now run yarn --immutable --mode=skip-build so dependency lifecycle scripts don't execute, followed by an explicit yarn run postinstall so the repo's own @polkadot dedupe still runs. Same change in scripts/integration-test.sh.
    • Security hotspot: sequoia-pgp/fast-forward pinned to a full commit SHA (v1.0.0, same commit as before).
    • Code smells: readonly members, node: imports, Number.isNaN / Number.parseInt, Date.now(), flatMap over lodash flatten, String.raw regexes in jest.config.js, and shell/Dockerfile tidy-ups.
    • Test fix: the batchBumpNonce spec called expect() with no matcher, so it never asserted anything. It now checks the delegation to incrementNonces.
    • S2187 is suppressed for the *.repo.spec.ts files in sonar-project.properties. They run shared suites Sonar can't see, so the finding is a false positive.
  3. chore: remove the unused Jenkinsfile

    • The Jenkins pipeline is no longer used. Removes it and its CODEOWNERS entry.
  4. chore: correct the CODEOWNERS patterns and owners

    • ./github never matched anything, so .github/ changes fell through to the catch-all owners. It is now the root-anchored /.github/, which requires SRE review.
    • Replaces the individually named catch-all owners with @PolymeshAssociation/middleware. Three of the four named owners no longer resolved.

Reviewer notes

  • Please confirm the SonarCloud gate on master goes green after merge. The project uses Automatic Analysis, so check that the sonar.issue.ignore.multicriteria suppression is honoured. If the 9 S2187 findings still show, mark them "Won't Fix" in the SonarCloud UI.
  • Merge with /fast-forward so master and alpha stay identical.

Checklist -

  • New Feature ?
  • Updated swagger annotation (if API structure is changed) ?
  • Unit Test (if possible) ?
  • Updated the Readme.md (if required) ?

🤖 Generated with Claude Code

Addresses every open issue the quality gate reported on master.

Security (New Code rating C -> A):
- disable dependency lifecycle scripts on CI installs with
  `yarn --immutable --mode=skip-build`, running the repo's own trusted
  postinstall as an explicit step so the @PolkaDot dedupe still happens
- pin sequoia-pgp/fast-forward to a full commit SHA (v1.0.0), clearing
  the outstanding security hotspot

Code smells:
- mark never-reassigned members readonly
- prefer node: protocol imports, Number.isNaN / Number.parseInt,
  Date.now() and Array.prototype.flatMap over lodash flatten
- avoid an object literal as a default parameter in ApiArrayResponse
- use String.raw for the regex literals in jest.config.js
- sort the Dockerfile apk packages, use `[[ ]]` in the shell scripts and
  give the integration-test cleanup trap an explicit return
- extract cloneRepo/buildAndPushImage out of the Jenkinsfile node block
  to keep control flow nesting within 3 levels

Tests:
- complete the vacuous assertion in the batchBumpNonce spec, which
  called expect() with no matcher and so asserted nothing

S2187 is ignored for the datastore repo specs: they delegate to shared
suites (`XRepo.test(repo)`) whose `it` blocks Sonar's static analysis
cannot see, making "add some tests to this file" a false positive.
The Jenkins pipeline is no longer used, so drop it along with the
CODEOWNERS entry that pointed at it.

This also removes the three S134 control flow nesting smells the
previous commit refactored the file to satisfy.
`./github` is syntactically valid but never matches, so changes under
`.github/` were silently falling through to the catch-all owners rather
than requiring SRE review. Use a root-anchored `/.github/` instead.

Also replace the individually named catch-all owners with the Middleware
team. Three of the four no longer resolve, which left a single valid
reviewer on every path.
Lookups in the local API key store and local signer address book now
only match entries that were explicitly configured or added.
@prashantasdeveloper
prashantasdeveloper requested a review from a team as a code owner September 28, 2026 11:17
@polymesh-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 9.0.1-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

F-OBrien
F-OBrien previously approved these changes Sep 28, 2026
@F-OBrien

Copy link
Copy Markdown

/fast-forward

@polymesh-bot

Copy link
Copy Markdown
Contributor

Triggered from #376 (comment) by @​F-OBrien.

Trying to fast forward master (0a24090) to alpha (6be8068).

Target branch (master):

commit 0a240901b9a6889b77a55c78676a76087621e569 (HEAD -> master, tag: v9.0.0, origin/master)
Author: Prashant Bajpai <34747455+prashantasdeveloper@users.noreply.github.com>
Date:   Fri Sep 18 15:46:14 2026 +0530

    refactor: 💡 resolve SonarCloud issues
    
    Mark the PortfoliosController logger as readonly and extract the duplicated
    Identity setup in the registerIdentity/registerDid controller specs into a
    shared helper.

Pull request (alpha):

commit 6be80684417663a76a7948bd0da22b44d719a770 (pull_request/alpha)
Author: Prashant Bajpai <34747455+prashantasdeveloper@users.noreply.github.com>
Date:   Mon Sep 28 12:55:26 2026 +0530

    fix: 🐛 use null-prototype maps in local API key and signer stores
    
    Lookups in the local API key store and local signer address book now
    only match entries that were explicitly configured or added.

Fast forwarding master (0a24090) to alpha (6be8068).

$ git push origin 6be80684417663a76a7948bd0da22b44d719a770:master
remote: error: GH006: Protected branch update failed for refs/heads/master.        
remote: 
remote: - Waiting on code owner review from PolymeshAssociation/sre.        
To https://github.com/PolymeshAssociation/polymesh-rest-api.git
 ! [remote rejected]   6be80684417663a76a7948bd0da22b44d719a770 -> master (protected branch hook declined)
error: failed to push some refs to 'https://github.com/PolymeshAssociation/polymesh-rest-api.git'

debelio
debelio previously approved these changes Sep 29, 2026
The global logging interceptor wrote every request body to the logs in
plaintext, including the signer mnemonic sent to `POST /signer` and the
API key sent to `POST /auth/api-key/delete`. Anyone with read access to
the service logs could recover them.

Body fields whose names contain mnemonic, apiKey, secret, privateKey,
password, passphrase or seed now log as `*REDACTED*`, at any depth, for
the request log and for the 4xx and 5xx response logs.
A mnemonic the keyring cannot parse surfaced as an unhandled error and a
500 response. It is now rejected as a validation error with a 400, and
the underlying error is dropped so the mnemonic is never echoed back.
@polymesh-bot
polymesh-bot dismissed stale reviews from debelio and F-OBrien via f29ab37 October 19, 2026 11:19
@polymesh-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 9.0.1-alpha.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Reliability:
- await the offline transaction status update, which was fire and forget,
  so a failed write no longer goes unnoticed as an unhandled rejection
- log a clear error when an offline service cannot register its message
  listener, instead of leaving the rejection unhandled
- exit with a non zero code when the swagger spec cannot be written

Code smells:
- drop `async` from methods with no `await` in the local signer and API key
  stores and `PolymeshService.execTransaction`, returning settled promises so
  errors are still delivered as rejections
@sonarqubecloud

Copy link
Copy Markdown

@polymesh-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 9.0.1-alpha.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

This branch has not been deployed

No deployments
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.

4 participants