Record the series key by id in audit metadata, not by name - #108
Merged
Conversation
CodeQL flagged the Series API's audit write as clear-text storage of sensitive data (rb/clear-text-storage-sensitive-data, high): it traces the read of `name` off a series API token into audit_logs.metadata, which is a plain jsonb column. The name was never a secret -- it is the display label built from the creator's email local part, and the secret itself is only ever held as a SHA256 digest. But the metadata does not need the label: storing the key's id instead removes the flagged dataflow entirely and is more useful to an auditor, since an id survives a rename or a rotation, resolves to the key's name, creator and revocation state, and revoking a key keeps its row.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #106.
CodeQL flagged the Series API's audit write as clear-text storage of sensitive data (
rb/clear-text-storage-sensitive-data, high). It traces the read ofnameoff a series API token intoaudit_logs.metadata, which is a plainjsonbcolumn. The alert appeared on #106 but CodeQL is not a required check, so auto-merge landed the PR before it was addressed.The name was never a secret — it is the display label built from the creator's email local part, and the secret itself is only ever held as a SHA256 digest. So this is not a leak. But the metadata does not need the label, and storing the key's id instead:
Distinct from the ~14 pre-existing alerts under the same rule, which are the known Active Record
encryptsblindness (CodeQL cannot see thatdate_of_birth,medical_textand friends are encrypted at rest). Those are genuine false positives; this one was better fixed than dismissed.Spec updated to assert the id. 41 series specs green, rubocop clean.