Skip to content
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

ACPENG-718: Obfuscate IAM credentials when not accessed by original user #326

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ steps:
IMAGE_NAME: platform-hub-api:${DRONE_COMMIT_SHA}
SERVICE_URL: http://anchore-submission-server:10080
WHITELIST: CVE-2020-8164,CVE-2020-8165,CVE-2020-8162,CVE-2019-5420,CVE-2021-22880,CVE-2021-29509,CVE-2021-32740,CVE-2021-22904,CVE-2020-36327
FAIL_ON_DETECTION: false
when:
event: [push, tag]

Expand Down
1 change: 1 addition & 0 deletions platform-hub-api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RUN apk update && apk upgrade \
postgresql-client postgresql-dev \
&& apk --update add --virtual build_deps sudo build-base ruby-dev libc-dev libressl-dev zlib-dev \
&& echo 'gem: --no-document' > /etc/gemrc \
&& gem i rubygems-update -v '<3' && update_rubygems \
&& gem install bundler -v 2.1.4 \
&& gem update --system \
&& rm /etc/ssl/certs/ca-cert-DST_ACES_CA_X6.pem \
Expand Down
21 changes: 20 additions & 1 deletion platform-hub-api/app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,26 @@ def search

# GET /users/:id/identities
def identities
render json: @user.identities
user_identity = @user.identities.dup

if current_user.id != @user.id
user_identity.each do |item|
if item["provider"] == "ecr"
if item["data"]
if item["data"]["credentials"]
if item["data"]["credentials"]["access_id"]
item["data"]["credentials"]["access_id"] = item["data"]["credentials"]["access_id"].gsub!(/\S/, '*')
end
if item["data"]["credentials"]["access_key"]
item["data"]["credentials"]["access_id"] = item["data"]["credentials"]["access_key"].gsub!(/\S/, '*')
end
end
end
end
end
end

render json: user_identity
end

# POST /users/:id/make_admin
Expand Down