-
Notifications
You must be signed in to change notification settings - Fork 3
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
Api Key Rework - PRO-467 #17
Conversation
src/api_key.rs
Outdated
#[derive(Debug, Clone, PartialEq, Eq)] | ||
pub struct ApiKey { | ||
pub relayer_id: String, | ||
pub api_key: [u8; 32], | ||
pub secret: [u8; SECRET_LEN], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We actually need to make it into a Vec<u8>
or some sort of small vec. We already have 32 byte secret keys running in the dev env
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry could you elaborate? You mean you'd like to keep backwards compatibility with 32byte secrets? (48byte total for the api key?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly. I see that you already implemented that
@Dzejkop I've updated this to have the api keys be of variable length. I've also made the internals of |
I've updated this PR again as I discovered that API keys were being inadvertently revealed in logs in plain text. To remedy this I created a new type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - we're still leaking the keys through our logging of API calls - I'll add a Linear issue for that
* Update readme * Only saved fee estimates on mined blocks * Fixes & improvements * Update stuff * Prune blocks * Networks in DB - Handling reorgs (#2) * Update TODO * Update TODO * Allow updating relayers - max inflight txs in relayer * Start indexing chains at startup * Estimate block fees in a separate task * Add support for cross-chain gas price limits * Cleanup * Add transaction priority * Refactor routes * Fix manual test * RPC Access * Minor fixes * Parallelize broadcast per relayer + error handling * Expose unsent status * Update TODO * Add item to TODO * Consistent formatting of SQL * Minor cleanup * WIP * Add TODO item * Add TODO item * misc * Section TODO * Dzejkop/api-keys (#3) * Dzejkop/dockerize (#4) * Update API routes * Log more * Save all txs * Fetch block hashes * Update AWS libs * Minor fixes * Build and push image * Allow parts for db settings * Prefetch deps + use sparse registries + log connection string * Add GH actions * Enable auth for admin routes * Speed up tests * Install foundry for tests * Add health endpoint * Fix anvil issue * Cache dependencies in docker builds * Remove secrets leak * Use cache * Use buildx * Add clippy * Add getTxs endpoint * WIP: Integrate telemetry-batteries * Change service tag * Update telemetry-batteries * fmt * Don't destroy the db * Remove redundant relayer id * Try unnested fields * Use new telemetry-batteries * Fix * Emit metrics periodically * Fix get_txs bug * misc * Big query & mining metrics * More logging & metrics * Fix escalation fee logic * fmt * Metrics for gas * Better logging * Add tx created log * Add relayers endpoint * Fix * Fix race condition * Add relayer reset endpoint * Fix * Fix * Fix * Remove hard coded gas limit * Remove surge logic * added .gitignore, increased allowable db setup time * fix: typo * Make transfers in tests more parallel * updated logic to back fill blocks that have been missed * adding comments * updated tests * updated get_latest_block_number * updated comments * cargo clippy * Preconfigured start - for dockerization (#6) * Allow preconfigured networks & relayers * Only allow single network and relayer * Allow filtering txs by status (#7) * Allow filtering txs by status * Minor refactor * insert into tx_hashes and sent_transactions seperatley, added raw_signed_tx for UniversalSigner * Example .env * Fix * added logic to recover simulated txs * cargo clippy, cargo sort * formatting * removed recover simulated tx * updated insert_into_tx_hashes to do nothing on conflict * on conflict, update tx_hashes * updated tx_hashes to add constraint on tx_id, do nothing on conflict when inserting into table * added insert_tx_broadcast * write to database after successful simulation * removed unneeded function * updated cargo toml to match dev branch * removed comments and todo * Build for multiple platforms * Don't build for arm/v7 * Tags * TEMP: Don't build for arm64 * Bring back arm64 * Update action versions * Add annotations * No more matrix * Remove matrix reference * Reorg & Escalation testing (#11) * Further dockerization support (#12) * Predefined api key for dockerization * Fix Dockerfile * Fix owned deserialization (#13) * Allow disabling relayers (#14) * Update DB * Integrate with db code * Escalate per relayer & don't if relayer disabled * clippy * Improve-logging (#15) * Improve logging * Clippy & fmt * Minor improvements * Remove redundant comment * instrument db txs (#19) * Api Key Rework - PRO-467 (#17) * shortened api key and fixed predefined toml * dynamic length api key * Fix for security issue where api keys were being exposed in logs and traces * redact api key (#20) * update tel batteries (#21) * Remove transaction simulation (#22) * More instrumentation * Docker compose setup * Misc * Additional logs * More logs * Abort on panic + better instrumentation * Fix escalation fees calculation logic * Bring back metrics (#24) * Config sanity check * Add max_queued_txs * Update metrics * Cleanup Cargo.toml * Add log to start service * Revert "Add max_queued_txs" This reverts commit 83c517d. * Add shutdown listening (non-graceful) * clippy + fmt * Fix telemetry issues (#27) * Fix telemetry issues * Update dep * Add max_queued_txs column + minor client improvement (#25) * Add max_queued_txs column * Implement logic (WIP) * Serialize errors * Update errors in client + update logic * Instrument remaining db methods + fix * Fix in code condition * Reenable test * Fix and refactor tests --------- Co-authored-by: 0xKitsune <[email protected]> Co-authored-by: 0xKitsune <[email protected]> Co-authored-by: Eric Woolsey <[email protected]>
* Update readme * Only saved fee estimates on mined blocks * Fixes & improvements * Update stuff * Prune blocks * Networks in DB - Handling reorgs (#2) * Update TODO * Update TODO * Allow updating relayers - max inflight txs in relayer * Start indexing chains at startup * Estimate block fees in a separate task * Add support for cross-chain gas price limits * Cleanup * Add transaction priority * Refactor routes * Fix manual test * RPC Access * Minor fixes * Parallelize broadcast per relayer + error handling * Expose unsent status * Update TODO * Add item to TODO * Consistent formatting of SQL * Minor cleanup * WIP * Add TODO item * Add TODO item * misc * Section TODO * Dzejkop/api-keys (#3) * Dzejkop/dockerize (#4) * Update API routes * Log more * Save all txs * Fetch block hashes * Update AWS libs * Minor fixes * Build and push image * Allow parts for db settings * Prefetch deps + use sparse registries + log connection string * Add GH actions * Enable auth for admin routes * Speed up tests * Install foundry for tests * Add health endpoint * Fix anvil issue * Cache dependencies in docker builds * Remove secrets leak * Use cache * Use buildx * Add clippy * Add getTxs endpoint * WIP: Integrate telemetry-batteries * Change service tag * Update telemetry-batteries * fmt * Don't destroy the db * Remove redundant relayer id * Try unnested fields * Use new telemetry-batteries * Fix * Emit metrics periodically * Fix get_txs bug * misc * Big query & mining metrics * More logging & metrics * Fix escalation fee logic * fmt * Metrics for gas * Better logging * Add tx created log * Add relayers endpoint * Fix * Fix race condition * Add relayer reset endpoint * Fix * Fix * Fix * Remove hard coded gas limit * Remove surge logic * added .gitignore, increased allowable db setup time * fix: typo * Make transfers in tests more parallel * updated logic to back fill blocks that have been missed * adding comments * updated tests * updated get_latest_block_number * updated comments * cargo clippy * Preconfigured start - for dockerization (#6) * Allow preconfigured networks & relayers * Only allow single network and relayer * Allow filtering txs by status (#7) * Allow filtering txs by status * Minor refactor * insert into tx_hashes and sent_transactions seperatley, added raw_signed_tx for UniversalSigner * Example .env * Fix * added logic to recover simulated txs * cargo clippy, cargo sort * formatting * removed recover simulated tx * updated insert_into_tx_hashes to do nothing on conflict * on conflict, update tx_hashes * updated tx_hashes to add constraint on tx_id, do nothing on conflict when inserting into table * added insert_tx_broadcast * write to database after successful simulation * removed unneeded function * updated cargo toml to match dev branch * removed comments and todo * Build for multiple platforms * Don't build for arm/v7 * Tags * TEMP: Don't build for arm64 * Bring back arm64 * Update action versions * Add annotations * No more matrix * Remove matrix reference * Reorg & Escalation testing (#11) * Further dockerization support (#12) * Predefined api key for dockerization * Fix Dockerfile * Fix owned deserialization (#13) * Allow disabling relayers (#14) * Update DB * Integrate with db code * Escalate per relayer & don't if relayer disabled * clippy * Improve-logging (#15) * Improve logging * Clippy & fmt * Minor improvements * Remove redundant comment * instrument db txs (#19) * Api Key Rework - PRO-467 (#17) * shortened api key and fixed predefined toml * dynamic length api key * Fix for security issue where api keys were being exposed in logs and traces * redact api key (#20) * update tel batteries (#21) * Remove transaction simulation (#22) * More instrumentation * Docker compose setup * Misc * Additional logs * More logs * Abort on panic + better instrumentation * Fix escalation fees calculation logic * Bring back metrics (#24) * Config sanity check * Add max_queued_txs * Update metrics * Cleanup Cargo.toml * Add log to start service * Revert "Add max_queued_txs" This reverts commit 83c517d. * Add shutdown listening (non-graceful) * clippy + fmt * Fix telemetry issues (#27) * Fix telemetry issues * Update dep * Add max_queued_txs column + minor client improvement (#25) * Add max_queued_txs column * Implement logic (WIP) * Serialize errors * Update errors in client + update logic * Instrument remaining db methods + fix * Fix in code condition * Reenable test * Fix and refactor tests --------- Co-authored-by: 0xKitsune <[email protected]> Co-authored-by: 0xKitsune <[email protected]> Co-authored-by: Eric Woolsey <[email protected]>
Shortened api keys to 32 bytes total, 16 for the uuid and 16 for the secret. Also fixed the missing/incorrect attributes for the predefined settings in the config.toml.