eslint-plugin-anthropic-security 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eslint-plugin-anthropic-security",
3
- "version": "0.2.0",
4
- "description": "ESLint plugin for Anthropic SDK security — catches hardcoded API keys in the Claude client options.",
3
+ "version": "0.3.1",
4
+ "description": "ESLint plugin for Anthropic SDK security — catches hardcoded Claude API keys, the browser escape hatch that ships them to every visitor, and system prompts assembled from untrusted input.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
7
7
  "types": "./src/index.d.ts",
@@ -62,7 +62,7 @@
62
62
  "node": ">=18.0.0"
63
63
  },
64
64
  "peerDependencies": {
65
- "eslint": "^8.0.0 || ^9.0.0 || ^10.0.0",
65
+ "eslint": "^8.40.0 || ^9.0.0 || ^10.0.0",
66
66
  "@anthropic-ai/sdk": ">=0.1.0 <1.0.0",
67
67
  "@anthropic-ai/claude-agent-sdk": ">=0.1.0 <1.0.0"
68
68
  },
@@ -75,7 +75,7 @@
75
75
  }
76
76
  },
77
77
  "dependencies": {
78
- "@interlace/eslint-devkit": "^1.9.0"
78
+ "@interlace/eslint-devkit": "^1.11.0"
79
79
  },
80
80
  "funding": {
81
81
  "type": "github",
package/src/index.js CHANGED
@@ -1,37 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.configs = exports.plugin = exports.rules = exports.noHardcodedApiKey = exports.noBrowserApiKeyExposure = void 0;
4
- var no_browser_api_key_exposure_2 = require("./rules/no-browser-api-key-exposure");
5
- Object.defineProperty(exports, "noBrowserApiKeyExposure", { enumerable: true, get: function () { return no_browser_api_key_exposure_2.noBrowserApiKeyExposure; } });
6
- var no_hardcoded_api_key_2 = require("./rules/no-hardcoded-api-key");
7
- Object.defineProperty(exports, "noHardcodedApiKey", { enumerable: true, get: function () { return no_hardcoded_api_key_2.noHardcodedApiKey; } });
8
- exports.rules = {
9
- get 'no-browser-api-key-exposure'() { return require("./rules/no-browser-api-key-exposure").noBrowserApiKeyExposure; },
10
- get 'no-hardcoded-api-key'() { return require("./rules/no-hardcoded-api-key").noHardcodedApiKey; },
11
-
12
- };
13
- exports.plugin = {
14
- meta: {
15
- name: 'eslint-plugin-anthropic-security',
16
- version: '0.2.0',
17
- },
18
- rules: exports.rules,
19
- };
20
- const enabled = {
21
- plugins: {
22
- 'anthropic-security': exports.plugin,
23
- },
24
- rules: {
25
- 'anthropic-security/no-browser-api-key-exposure': 'error',
26
- 'anthropic-security/no-hardcoded-api-key': 'error',
27
- },
28
- };
29
- exports.configs = {
30
- minimal: enabled,
31
- recommended: enabled,
32
- strict: enabled,
33
- };
34
- exports.default = {
35
- ...exports.plugin,
36
- configs: exports.configs,
37
- };
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.configs=exports.plugin=exports.rules=exports.noUntrustedContentInPrompt=exports.noHardcodedApiKey=exports.noBrowserApiKeyExposure=void 0;var no_browser_api_key_exposure_2=require("./rules/no-browser-api-key-exposure");Object.defineProperty(exports,"noBrowserApiKeyExposure",{enumerable:true,get:function(){return no_browser_api_key_exposure_2.noBrowserApiKeyExposure}});var no_hardcoded_api_key_2=require("./rules/no-hardcoded-api-key");Object.defineProperty(exports,"noHardcodedApiKey",{enumerable:true,get:function(){return no_hardcoded_api_key_2.noHardcodedApiKey}});var no_untrusted_content_in_prompt_2=require("./rules/no-untrusted-content-in-prompt");Object.defineProperty(exports,"noUntrustedContentInPrompt",{enumerable:true,get:function(){return no_untrusted_content_in_prompt_2.noUntrustedContentInPrompt}});exports.rules={get"no-browser-api-key-exposure"(){return require("./rules/no-browser-api-key-exposure").noBrowserApiKeyExposure},get"no-hardcoded-api-key"(){return require("./rules/no-hardcoded-api-key").noHardcodedApiKey},get"no-untrusted-content-in-prompt"(){return require("./rules/no-untrusted-content-in-prompt").noUntrustedContentInPrompt}};exports.plugin={meta:{name:"eslint-plugin-anthropic-security",version:"0.3.1"},rules:exports.rules};const enabled={plugins:{"anthropic-security":exports.plugin},rules:{"anthropic-security/no-browser-api-key-exposure":"error","anthropic-security/no-hardcoded-api-key":"error"}};const strict={plugins:{"anthropic-security":exports.plugin},rules:{...enabled.rules,"anthropic-security/no-untrusted-content-in-prompt":"error"}};exports.configs={minimal:enabled,recommended:enabled,strict};exports.default={...exports.plugin,configs:exports.configs};
package/src/oxlint.js CHANGED
@@ -1,3 +1 @@
1
- "use strict";
2
- const index_1 = require("./index");
3
- module.exports = index_1.plugin;
1
+ "use strict";const index_1=require("./index");module.exports=index_1.plugin;
@@ -1,11 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.noBrowserApiKeyExposure = void 0;
4
- const eslint_devkit_1 = require("@interlace/eslint-devkit");
5
- exports.noBrowserApiKeyExposure = (0, eslint_devkit_1.createBrowserEscapeHatchRule)({
6
- ruleName: 'no-browser-api-key-exposure',
7
- vendor: 'Anthropic',
8
- modules: ['@anthropic-ai'],
9
- docsUrl: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-anthropic-security/docs/rules/no-browser-api-key-exposure.md',
10
- documentationLink: 'https://docs.anthropic.com/en/api/getting-started',
11
- });
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noBrowserApiKeyExposure=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.noBrowserApiKeyExposure=(0,eslint_devkit_1.createBrowserEscapeHatchRule)({ruleName:"no-browser-api-key-exposure",vendor:"Anthropic",modules:["@anthropic-ai"],docsUrl:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-anthropic-security/docs/rules/no-browser-api-key-exposure.md",documentationLink:"https://docs.anthropic.com/en/api/getting-started"});
@@ -1,13 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.noHardcodedApiKey = void 0;
4
- const eslint_devkit_1 = require("@interlace/eslint-devkit");
5
- exports.noHardcodedApiKey = (0, eslint_devkit_1.createSdkApiKeyRule)({
6
- ruleName: 'no-hardcoded-api-key',
7
- vendor: 'Anthropic',
8
- modules: ['@anthropic-ai'],
9
- keyProps: ['apiKey', 'authToken'],
10
- fixTemplate: 'new Anthropic({ {{prop}}: process.env.ANTHROPIC_API_KEY })',
11
- docsUrl: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-anthropic-security/docs/rules/no-hardcoded-api-key.md',
12
- documentationLink: 'https://docs.anthropic.com/en/api/getting-started',
13
- });
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noHardcodedApiKey=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.noHardcodedApiKey=(0,eslint_devkit_1.createSdkApiKeyRule)({ruleName:"no-hardcoded-api-key",vendor:"Anthropic",modules:["@anthropic-ai"],keyProps:["apiKey","authToken"],fixTemplate:"new Anthropic({ {{prop}}: process.env.ANTHROPIC_API_KEY })",docsUrl:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-anthropic-security/docs/rules/no-hardcoded-api-key.md",documentationLink:"https://docs.anthropic.com/en/api/getting-started"});
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noUntrustedContentInPrompt=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.noUntrustedContentInPrompt=(0,eslint_devkit_1.createSystemPromptInjectionRule)({ruleName:"no-untrusted-content-in-prompt",vendor:"Anthropic",modules:["@anthropic-ai"],requestPaths:["messages.create","messages.stream"],systemPromptProps:["system"],docsUrl:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-anthropic-security/docs/rules/no-untrusted-content-in-prompt.md",documentationLink:"https://docs.anthropic.com/en/docs/system-prompts"});