Skip to content

Commit

Permalink
Fix ARN parsing to not break on aws-us-gov resources (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
struz authored and jtblin committed Mar 8, 2017
1 parent a1f7cd7 commit 98da578
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var cache = ccache.New(ccache.Configure())
const (
ttl = time.Minute * 15
maxSessNameLength = 64
fullArnPrefix = "arn:aws:"
fullArnPrefix = "arn:"
)

type iam struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (s *Server) securityCredentialsHandler(w http.ResponseWriter, r *http.Reque
roleARN := s.iam.roleARN(role)
// If a base ARN has been supplied and this is not cross-account then
// return a simple role-name, otherwise return the full ARN
if s.iam.baseARN == "" && strings.HasPrefix(roleARN, s.iam.baseARN) {
if s.iam.baseARN != "" && strings.HasPrefix(roleARN, s.iam.baseARN) {
idx := strings.LastIndex(roleARN, "/")
write(w, roleARN[idx+1:])
return
Expand Down

0 comments on commit 98da578

Please sign in to comment.