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

BLUE-118(feat): Config-patch endpoint added #36

Merged
merged 8 commits into from
Jul 1, 2024

Conversation

achal-singh
Copy link
Contributor

Summary

This PR adds a new endpoint: /set-config that allows updating the archiver's config on-the-fly.

Linear Task - BLUE-118

@achal-singh achal-singh self-assigned this Jun 18, 2024
Copy link

linear bot commented Jun 18, 2024

BLUE-118 Ability to update the archiver config while running ( with dev key )

ISSUE SUMMARY:

<<TODO: Replace this with a short summary of the issue.>>


ISSUE REPRO STEPS:

<HINT: Add steps to list as-needed. If interaction is complex, add screenshots or a Slack screen-capture video (just drag and drop)>

  1. <<TODO: Replace with repro step Bump the npm_and_yarn group across 1 directory with 3 updates #1>>
  2. <<TODO: Replace with repro step Challenge receipt #2>>
  3. Observe <<TODO: Describe unintended behavior.>>

EXPECTED RESULT:

<<TODO: Replace this with your expected results.>>


PULL REQUESTS:

<HINT: If your fix requires changes in multiple repos, add the following info per-repository.>

<<TODO: Enter Repository Name>>

Pull Request Link: <<TODO: Insert PR-LINK>>

GPT Review Link: <<TODO: Insert GPT-Review-Link>>

Jenkins Test Link: <<TODO: Insert Jenkins Test Job Link>>


ADDITIONAL INSTRUCTIONS:

<HINT: Add any additional instructions needed for the assignee. If you have specific requirements for how the task should be implemented or fixed, enter them or link them here.>

<<TODO: Insert additional instructions for assignee.>>

src/Config.ts Outdated
if (newConfig[key] === 'true') newConfig[key] = true
else if (newConfig[key] === 'false') newConfig[key] = false
else if (typeof newConfig[key] !== 'boolean' && !Number.isNaN(Number(newConfig[key])))
newConfig[key] = Number(newConfig[key])}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a small formatting issue here. Could you please fix it?

src/Data/Data.ts Outdated
const devPublicKeys = tallyItem.value.config.devPublicKeys
const updateConfigProps = {
newPOQReceipt: tallyItem.value.config.useNewPOQ,
DevPublicKey: Object.keys(devPublicKeys).find((key) => devPublicKeys[key] === 3),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add an undefined check here? If no devPublicKey has a security level of 3, then we should avoid setting this config

@achal-singh achal-singh force-pushed the BLUE-118/config-patch-endpoint branch 2 times, most recently from d61b2c5 to 6c945ca Compare June 24, 2024 15:42
Logger.mainLogger.debug('Archiver config update executed: ', JSON.stringify(newConfig))

const updatedConfig = updateConfig(newConfig)
reply.send({ success: true, ...updatedConfig, ARCHIVER_SECRET_KEY: '' })

Check failure

Code scanning / CodeQL

Reflected cross-site scripting High

Cross-site scripting vulnerability due to a
user-provided value
.
jairajdev
jairajdev previously approved these changes Jun 24, 2024
@achal-singh achal-singh force-pushed the BLUE-118/config-patch-endpoint branch 4 times, most recently from c9824f3 to 04bd0fb Compare June 24, 2024 17:12
@jairajdev jairajdev dismissed tanuj-shardeum’s stale review June 24, 2024 17:13

This is updated now.

@jairajdev jairajdev force-pushed the BLUE-118/config-patch-endpoint branch from 5c7b070 to 7ea642b Compare June 25, 2024 07:07
)
}
config = merge(config, newConfig)
Logger.mainLogger.info('Updated Archiver Config:', config)

Check warning

Code scanning / CodeQL

Log injection Medium

Log entry depends on a
user-provided value
.
@jairajdev jairajdev merged commit 3f6b059 into dev Jul 1, 2024
1 of 2 checks passed
@jairajdev jairajdev deleted the BLUE-118/config-patch-endpoint branch July 1, 2024 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants