forked from external-secrets/external-secrets
-
Notifications
You must be signed in to change notification settings - Fork 1
Create release workable-1.3.1 #66
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
Open
mkousteris
wants to merge
7
commits into
workable-1.3.1
Choose a base branch
from
create-workable-1.3.1
base: workable-1.3.1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
febb3bd
feat: Add symlink functionality to vault provider
d5c9eea
feat: Customize CI workflow
5525979
chore: Change CODEOWNERS
add304f
FIX: helm schema in Makefile
mkousteris 5377d20
Remove license header check from CI and Makefile
pmarav 0c5bdc8
Pin setup-envtest install to release-0.20 branch for Go 1.25 compatib…
pmarav 5f10f5e
fix: set persist-credentials false on all checkout steps
mkousteris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * @Workable/systems |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| /* | ||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package vault | ||
|
|
||
| import ( | ||
| "context" | ||
| "regexp" | ||
| "strings" | ||
| ) | ||
|
|
||
| const ( | ||
| // Symlink must start with the prefix vault:// to be valid. | ||
| vaultSymlink = `vault://` | ||
| // Path can be anything and matches the last # as a separator of key. | ||
| vaultSymlinkPath = `(?P<Path>.*)#` | ||
| // Key can be any alphanumeric character and stops with the first @. | ||
| vaultSymlinkSecret = `(?P<Secret>\w+)` | ||
| // Version is optional and will match any number after @. | ||
| vaultSymlinkVersion = `(@(?P<Version>\d+)?)?` | ||
| vaultSymlinkPattern = vaultSymlink + vaultSymlinkPath + vaultSymlinkSecret + vaultSymlinkVersion | ||
| ) | ||
|
|
||
| // isSymlink tests if secret can be converted to string and if it matches the symlink pattern. | ||
| func isSymlink(secret any) bool { | ||
| if s, ok := secret.(string); ok { | ||
| return strings.HasPrefix(s, vaultSymlink) | ||
| } | ||
|
|
||
| return false | ||
| } | ||
|
|
||
| // extractSymlinkParts extract capture group items of regex to a map. | ||
| func extractSymlinkParts(secret any) (paramsMap map[string]string) { | ||
| r := regexp.MustCompile(vaultSymlinkPattern) | ||
| match := r.FindStringSubmatch(secret.(string)) | ||
| paramsMap = make(map[string]string) | ||
|
|
||
| for i, name := range r.SubexpNames() { | ||
| if i > 0 && i <= len(match) { | ||
| paramsMap[name] = match[i] | ||
| } | ||
| } | ||
|
|
||
| return paramsMap | ||
| } | ||
|
|
||
| // resolveSymlink test if the data passed has symlinks and resolve them. | ||
| func (c *client) resolveSymlink(ctx context.Context, data map[string]any) (map[string]any, error) { | ||
| for key, secret := range data { | ||
| for isSymlink(secret) { | ||
| symlink := extractSymlinkParts(secret) | ||
|
|
||
| s, err := c.readSecret(ctx, symlink["Path"], symlink["Version"]) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| secret = s[symlink["Secret"]] | ||
| data[key] = secret | ||
| } | ||
| } | ||
|
|
||
| return data, nil | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.