Skip to content

Commit

Permalink
Merge branch 'main' into chenyao/order-replacement-messages-for-vault
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyaoy committed Jun 10, 2024
2 parents 1489677 + 1e234eb commit b332cd9
Show file tree
Hide file tree
Showing 122 changed files with 3,566 additions and 2,676 deletions.
16 changes: 2 additions & 14 deletions .github/workflows/protocol-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,17 @@ jobs:
- name: install go
uses: actions/setup-go@v3
with:
go-version: '1.21'
go-version: '1.22'
check-latest: true
- name: Create Directory
run: mkdir ./build
- name: Build Reproducible Linux Binaries
run: make distclean build-reproducible
run: make distclean build-reproducible-linux-amd64
- name: Rename Binaries
run: |
mv ./build/dydxprotocold:linux-arm64 ./build/dydxprotocold-${{ env.VERSION }}-linux-arm64
mv ./build/dydxprotocold:linux-amd64 ./build/dydxprotocold-${{ env.VERSION }}-linux-amd64
- name: Compress binaries
run: |
tar -cvzf dydxprotocold-${{ env.VERSION }}-linux-arm64.tar.gz \
./build/dydxprotocold-${{ env.VERSION }}-linux-arm64
tar -cvzf dydxprotocold-${{ env.VERSION }}-linux-amd64.tar.gz \
./build/dydxprotocold-${{ env.VERSION }}-linux-amd64
- name: Create Release
Expand All @@ -63,15 +60,6 @@ jobs:
asset_path: protocol/dydxprotocold-${{ env.VERSION }}-linux-amd64.tar.gz
asset_name: dydxprotocold-${{ env.VERSION }}-linux-amd64.tar.gz
asset_content_type: application/gzip
- name: Upload linux-arm64 tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: protocol/dydxprotocold-${{ env.VERSION }}-linux-arm64.tar.gz
asset_name: dydxprotocold-${{ env.VERSION }}-linux-arm64.tar.gz
asset_content_type: application/gzip
# TODO(DEC-1743): add build report and binary check sums

v4-proto-py-release:
Expand Down
4 changes: 1 addition & 3 deletions indexer/packages/base/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import winston from 'winston';

import config from './config';
import { redact } from './sanitization';
import { InfoObject } from './types';

// Fix types. The methods available depend on the levels used. We're using syslog levels, so these
Expand Down Expand Up @@ -38,8 +37,7 @@ const logger: LoggerExport = winston.createLogger({
winston.format((info) => {
return {
...info, // info contains some symbols that are lost when the object is cloned.
...redact(info),
error: info.error, // cloning with redact() may break the error object
error: info.error,
};
})(),
winston.format.json(),
Expand Down
25 changes: 0 additions & 25 deletions indexer/packages/base/src/sanitization.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,7 @@
import traverse from 'traverse';

// Common request headers which should be redacted. Normalized to all-lowercase.
export const DEFAULT_SECRET_KEYS = [
'Authorization',
'X-Routing-Key', // Used by PagerDuty.
];

const DEFAULT_REDACTED_PLACEHOLDER = '[REDACTED]';
const JSON_CIRCULAR_PLACEHOLDER = '[CIRCULAR]';

/**
* Creates a deep copy of an object with values redacted where the key matches `secretKeys`.
*/
export function redact<T>(
obj: T,
secretKeys: string[] = DEFAULT_SECRET_KEYS,
placeholder: string = DEFAULT_REDACTED_PLACEHOLDER,
): T {
const normalizedSecretKeys = secretKeys.map((s) => s.toLowerCase());

// eslint-disable-next-line array-callback-return
return traverse(obj).map(function traverseFunction(this: traverse.TraverseContext, value: {}) {
if (normalizedSecretKeys.includes(this.key?.toLowerCase() as string) && value !== null) {
this.update(placeholder);
}
});
}

/**
* Creates a deep copy of an object with circular references removed or replaced.
*/
Expand Down
Loading

0 comments on commit b332cd9

Please sign in to comment.