-
Notifications
You must be signed in to change notification settings - Fork 33
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
BFD-3723: Determine SAMHSA authorization based on certificate identity #2486
base: master
Are you sure you want to change the base?
Conversation
fi | ||
|
||
# Skip binary formats | ||
case "$extension" in |
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.
Shellcheck was blowing up when trying to parse the certificate formats
@@ -160,12 +160,13 @@ if lsof -Pi :4566 -sTCP:LISTEN -t >/dev/null ; then | |||
export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY | |||
export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_KEY | |||
SSM_PARAMETER_PATH=/bfd-server | |||
export CONFIG_SETTINGS_JSON=$(cat <<EOF | |||
CONFIG_SETTINGS_JSON=$(cat <<EOF |
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.
Shellcheck wanted the export on a separate line
# If debug_suspend is y the pipeline app will wait for a debugger to connect before doing any work. | ||
if [[ $debug_enabled = "true" ]] ; then | ||
ARGS="$ARGS -agentlib:jdwp=transport=dt_socket,server=y,suspend=${debug_suspend},address=*:5005" | ||
ARGS="$ARGS -agentlib:jdwp=transport=dt_socket,server=y,suspend=${debug_suspend},address=*:${debug_port}" |
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.
The debug_port
variable already existed, but wasn't used, so shellcheck was complaining. Figure we might as well use it since it already exists.
@@ -294,7 +296,7 @@ if [[ x$kubernetes = xtrue ]] ; then | |||
elif [[ x$image_tag = x ]] ; then | |||
echo running application directly | |||
export CLASSPATH="$classpath" | |||
exec $java $properties $ARGS $mainClass | |||
exec $java $ARGS $mainClass |
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.
$properties
wasn't being set anywhere so it didn't do anything.
/*** | ||
* test. | ||
*/ | ||
public class ClientCertificateUtils { |
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.
Most of this was moved here from RequestResponseMdcFilter
so it can be reused.
JIRA Ticket:
BFD-3723
What Does This PR Do?
This change reduces the likelihood of a SAMHSA incident by automatically disallowing any client from seeing SAMHSA data unless they use a certificate that is explicitly allowed. We do this by dynamically loading in the serial numbers for each allowed certificate at startup. The allowed certificates are determined by a new configuration parameter
samhsa_allowed_certificate_aliases_json
. The values in that parameter directly match the names underclient_certificates/*
, which are used to populate the trust store on deployment. Serial numbers are not globally unique, but they are unique per CA, which should be sufficient enough to verify identity for our purposes.On each request, we extract the serial number from the provided client certificate and compare it with the list of allowed certificates that we generated on startup. The
excludeSAMHSA
parameter is still honored for any clients that are allowed to see SAMHSA info.I've added the list of certificates that should have SAMHSA access and created a new certificate per environment for internal testing.
What Should Reviewers Watch For?
If you're reviewing this PR, please check for these things in particular:
What Security Implications Does This PR Have?
Please indicate if this PR does any of the following:
Adds any new software dependencies
Modifies any security controls
Adds new transmission or storage of data
Any other changes that could possibly affect security?
I have considered the above security implications as it relates to this PR. (If one or more of the above apply, it cannot be merged without the ISSO or team security engineer's (
@sb-benohe
) approval.)This change does affect security controls.
Validation
Have you fully verified and tested these changes? Is the acceptance criteria met? Please provide reproducible testing instructions, code snippets, or screenshots as applicable.