Add json-secret-keys parameter for selective JSON key extraction#264
Open
jnewton03 wants to merge 1 commit intoaws-actions:mainfrom
Open
Add json-secret-keys parameter for selective JSON key extraction#264jnewton03 wants to merge 1 commit intoaws-actions:mainfrom
jnewton03 wants to merge 1 commit intoaws-actions:mainfrom
Conversation
This feature allows users to specify which keys from JSON secrets should be extracted as environment variables, preventing over-masking of non-sensitive values like usernames, hostnames, and ports. Key changes: - Add json-secret-keys input parameter to action.yml - Modify injectSecret() function to support selective key filtering - Add comprehensive unit and integration tests - Update README.md with parameter documentation and examples Fixes over-masking issue where all JSON values were marked as secrets, making debugging difficult when innocent values got redacted in logs. Fixes aws-actions#263 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Running into this now. Yes please! |
|
What are we waiting for? |
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.
Summary
This PR adds a new optional
json-secret-keysparameter that allows users to specify which keys from JSON secrets should be extracted as environment variables. This solves the over-masking problem where ALL values in JSON secrets get marked as secrets, making debugging nearly impossible.Problem Description
When using
parse-json-secrets: true, all JSON values are marked as secrets viacore.setSecret(), causing over-masking where innocent values like usernames, hostnames, and API endpoints get redacted throughout GitHub Action logs.Example: A JSON secret containing
{"DOCKER_USERNAME": "liquibase", "DOCKER_PASSWORD": "secret123"}would mask the word "liquibase" everywhere in logs, making debugging very difficult.Solution
The new
json-secret-keysparameter allows selective extraction:This would only extract and mask the
passwordandapi_keyvalues, leaving other non-sensitive values likeusernameandhostunmasked.Key Features
json-secret-keysis not provided, all keys are extracted (existing behavior)Changes Made
json-secret-keysinput parameter toaction.ymlinjectSecret()function inutils.tsto support selective key filteringindex.tsto read and pass the new parameterTesting
dist/directoryExamples
Before: All JSON values get masked, making debugging difficult
{ "username": "admin", // Gets masked everywhere "password": "secret123", // Gets masked (correctly) "host": "db.example.com", // Gets masked everywhere "port": "5432" // Gets masked everywhere }After: Only sensitive values get masked
passwordvalue gets maskedusername,host,portremain visible in logs for debuggingFixes #263
🤖 Generated with Claude Code