Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
cdk-stack-resource-rename
Advanced tools
Two main use cases:
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
StackResourceRenamer.rename(stack,
rename=(resName, _)=>{
return resName+'-'+alias;
}
)
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
StackResourceRenamer.rename(stack, {
"rename": (_, typeName)=>{
counts[typeName]++;
return projectName+'-'+serviceName+'-'+typeName+'-'+counts[typeName];
}
}, user_custom_name_only=False)
typescript
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from cdk_stack_resource_rename import StackResourceRenamer
app = core.App()
stack = core.Stack(app, "my-stack")
alias = stack.node.try_get_context("alias")
if alias:
# if alias is defined, rename stack and resources' custom names
StackResourceRenamer.rename(stack,
rename=(resName, _)=>{
return resName+'-'+alias;
}
)
# resources in stack
bucket = s3.Bucket(stack, "bucket",
bucket_name="my-bucket"
)
python
from cdk_stack_resource_rename import (StackResourceRenamer, IRenameOperation)
@jsii.implements(IRenameOperation)
class RenameOper:
def __init__(self, alias):
self.alias=alias
def rename(self, resName, typeName):
return resName+'-'+self.alias
class AppStack(core.Stack):
def __init__(self, scope: core.Construct, construct_id: str, **kwargs) -> None:
......
alias = self.node.try_get_context("alias")
if alias != None:
# if alias is defined, rename stack/resources' custom names
StackResourceRenamer.rename(self, RenameOper(alias))
java
import io.github.yglcode.cdkutils.aspects.resourcerename.StackResourceRenamer;
import io.github.yglcode.cdkutils.aspects.resourcerename.IRenameOperation;
public class AppStack extends Stack {
......
String alias = (String) this.getNode().tryGetContext("alias");
if (alias != null) {
StackResourceRenamer.rename(this, new IRenameOperation() {
public String rename(String resName, String typeName) {
return resName + "-"+alias;
}
});
}
csharp
using CdkUtils.Aspects.ResourceRename;
public class RenameOper: Amazon.JSII.Runtime.Deputy.DeputyBase, IRenameOperation {
private string alias;
public RenameOper(string alias) {
this.alias=alias;
}
public string Rename(string resName, string typeName) {
return resName+"-"+alias;
}
}
public class AppStack : Stack
{
internal AppStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
{
......
var alias = (string)this.Node.TryGetContext("alias");
if (alias!=null) {
StackResourceRenamer.Rename(this, new RenameOper(alias));
}
To create multiple stacks:
cdk -c alias=a1 deploy
will create a stack: my-stack-a1 with my-bucket-a1.
To create more stacks: my-stack-a2 with my-bucket-a2, my-stack-a3 with my-bucket-a3:
cdk -c alias=a2 deploy
cdk -c alias=a3 deploy
FAQs
cdk-stack-resource-rename
We found that cdk-stack-resource-rename demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.