i18ntk 2.5.0 → 2.5.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.
@@ -0,0 +1,133 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances
31
+ of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ GitHub Security Advisories for sensitive reports, or GitHub issues for non-sensitive community concerns.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder][Mozilla CoC].
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
126
+ [Mozilla CoC]: https://github.com/mozilla/diversity
127
+
128
+ For answers to common questions about this code of conduct, see the FAQ at
129
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
130
+ [https://www.contributor-covenant.org/translations][translations].
131
+
132
+ [FAQ]: https://www.contributor-covenant.org/faq
133
+ [translations]: https://www.contributor-covenant.org/translations
@@ -0,0 +1,41 @@
1
+ # Contributing to i18ntk
2
+
3
+ Thanks for helping improve i18ntk.
4
+
5
+ ## Project Priorities
6
+
7
+ - Keep the npm package zero-dependency.
8
+ - Keep the published package minimal and free of tests, local setup state, reports, backups, logs, credentials, and generated artifacts.
9
+ - Preserve backward compatibility unless a breaking change is intentional and documented.
10
+ - Prefer small, well-tested fixes over broad refactors.
11
+
12
+ ## Development Setup
13
+
14
+ Clone the repository, install with npm, and run the project validation checks before opening a pull request.
15
+
16
+ ## Release Validation
17
+
18
+ Maintainer release commands are documented in the repository development guide. The package published to npm uses a stripped public manifest.
19
+
20
+ ## Security
21
+
22
+ Follow the security guidance in `SECURITY.md` and `docs/development/AGENTS.md`.
23
+
24
+ Report vulnerabilities through GitHub Security Advisories. Do not open public issues for sensitive security reports.
25
+
26
+ ## Translations
27
+
28
+ When editing `ui-locales/`, preserve JSON structure, placeholders, command names, file paths, and config keys.
29
+
30
+ Run:
31
+
32
+ Run the locale lint check before submitting translation changes.
33
+
34
+ ## Pull Requests
35
+
36
+ Include:
37
+
38
+ - the problem being fixed
39
+ - the user-visible behavior change
40
+ - validation commands that were run
41
+ - any remaining risk or unverified behavior
package/FUNDING.md ADDED
@@ -0,0 +1,5 @@
1
+ # Funding
2
+
3
+ i18ntk does not request project donations.
4
+
5
+ If you wanted to give something, please give it to a charity or community cause you trust.
package/README.md CHANGED
@@ -1,20 +1,60 @@
1
- # i18ntk v2.5.0
1
+ # i18ntk v2.5.1
2
2
 
3
3
  Zero-dependency internationalization toolkit for setup, scanning, analysis, validation, usage tracking, and translation completion.
4
4
 
5
- ![i18ntk Logo](docs/screenshots/i18ntk-logo-public.PNG)
5
+ ![i18ntk Logo](https://raw.githubusercontent.com/vladnoskv/i18ntk/main/docs/screenshots/i18ntk-logo-public.PNG)
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/i18ntk.svg?color=brightgreen)](https://www.npmjs.com/package/i18ntk)
8
8
  [![npm downloads](https://img.shields.io/npm/dt/i18ntk.svg)](https://www.npmjs.com/package/i18ntk)
9
9
  [![node](https://img.shields.io/badge/node-%3E%3D16-339933)](https://nodejs.org)
10
10
  [![dependencies](https://img.shields.io/badge/dependencies-0-success)](https://www.npmjs.com/package/i18ntk)
11
11
  [![license](https://img.shields.io/badge/license-MIT-yellow.svg)](LICENSE)
12
- [![socket](https://socket.dev/api/badge/npm/package/i18ntk/2.5.0)](https://socket.dev/npm/package/i18ntk/overview/2.5.0)
12
+ [![socket](https://socket.dev/api/badge/npm/package/i18ntk/2.5.1)](https://socket.dev/npm/package/i18ntk/overview/2.5.1)
13
13
 
14
14
  ## Upgrade Notice
15
15
 
16
- Versions earlier than `2.5.0` may contain known stability and security issues.
17
- They are considered unsupported for production use. Upgrade to `2.5.0` or newer.
16
+ Versions earlier than `2.5.1` may contain known stability and security issues.
17
+ They are considered unsupported for production use. Upgrade to `2.5.1` or newer.
18
+
19
+ ## v2.5.1 Security Update
20
+
21
+ `v2.5.1` is a security and packaging-process update for the `2.5.x` release line.
22
+
23
+ ### Change Summary
24
+
25
+ - Hardened `utils/admin-auth.js` so `verifyPin()` fails closed when admin config is missing, disabled, or malformed.
26
+ - Hardened auth-required checks so enabled PIN protection does not silently bypass authentication when admin config is unusable.
27
+ - Normalized admin session expiry handling by storing both `expires` and `expiresAt` and cleaning up either format consistently.
28
+ - Marked the root `package.json` as development-only and added a separate public manifest flow.
29
+ - Added package scripts to stage, pack, and publish the public npm package from `package.public.json`.
30
+ - Added a root publish guard via `prepack` and `prepublishOnly` to block accidental publishing of the development manifest.
31
+ - Updated ignore rules to exclude release staging artifacts and public package metadata from the repo/package payload.
32
+ - Replaced the expanded `SECURITY.md` policy with a shorter reporting-oriented policy and added community docs links.
33
+ - Updated docs and release reset automation to use `npm run package:public` instead of `npm pack --dry-run`.
34
+
35
+ ### Files Changed
36
+
37
+ - `utils/admin-auth.js`: fixed fail-open PIN verification and session expiry consistency.
38
+ - `tests/security.test.js`: added admin-auth fail-closed and session cleanup coverage.
39
+ - `package.json`: set development-only metadata, adjusted included files, and added public packaging/publish scripts.
40
+ - `package.public.json`: introduced the stripped public npm manifest.
41
+ - `scripts/build-public-package.js`: added the public package staging, pack, and publish workflow.
42
+ - `scripts/prevent-root-publish.js`: added a guard against publishing the root development manifest.
43
+ - `scripts/reset-release-state.js`: switched release validation to the public package build flow.
44
+ - `README.md`, `docs/README.md`, `docs/development/AGENTS.md`, `docs/migration-guide-v2.5.1.md`, `docs/migration-guide-v2.5.0.md`: documented the security fix, packaging, and community file layout.
45
+ - `SECURITY.md`, `CODE_OF_CONDUCT.md`, `CONTRIBUTING.md`, `FUNDING.md`: updated or added community and security-facing docs.
46
+ - `.gitignore`, `.npmignore`: excluded release staging output and public-package metadata.
47
+
48
+ ### Audit Trail
49
+
50
+ - Risk addressed: AI-based analysis flagged `verifyPin()` as fail-open when admin config was missing or disabled.
51
+ - Behavior change: direct `verifyPin()` calls now return `false` unless a usable enabled PIN config exists.
52
+ - Behavior change: when settings require PIN auth but admin config is broken, protected auth checks now require authentication and verification fails closed.
53
+ - Risk: the root manifest is intentionally non-publishable, so publishing flows must use the public-package scripts.
54
+ - Behavior change: `npm pack` and `npm publish` at the repo root are blocked by guard scripts.
55
+ - Behavior change: the public npm payload is staged from `package.public.json` rather than the development manifest.
56
+ - Validation note: release-state reset now exercises `npm run package:public` as part of its checks.
57
+ - Validation note: this documentation update describes the working tree changes used for the packaging split.
18
58
 
19
59
  ## What i18ntk Does
20
60
 
@@ -154,7 +194,7 @@ Example `.i18ntk-config`:
154
194
 
155
195
  ```json
156
196
  {
157
- "version": "2.5.0",
197
+ "version": "2.5.1",
158
198
  "sourceDir": "./locales",
159
199
  "i18nDir": "./locales",
160
200
  "outputDir": "./i18ntk-reports",
@@ -170,16 +210,22 @@ See [docs/api/CONFIGURATION.md](docs/api/CONFIGURATION.md) for the full configur
170
210
 
171
211
  ## Docs
172
212
 
173
- - [Documentation Index](docs/README.md)
174
- - [Getting Started](docs/getting-started.md)
175
- - [API Reference](docs/api/API_REFERENCE.md)
176
- - [Configuration Guide](docs/api/CONFIGURATION.md)
177
- - [Runtime API Guide](docs/runtime.md)
178
- - [Scanner Guide](docs/scanner-guide.md)
179
- - [Environment Variables](docs/environment-variables.md)
180
- - [Migration Guide v2.5.0](docs/migration-guide-v2.5.0.md)
181
- - [Migration Guide v2.4.0](docs/migration-guide-v2.4.0.md)
182
- - [Optimization Prompt](docs/development/package-optimization-prompt.md)
213
+ - [Documentation Index](https://github.com/vladnoskv/i18ntk/blob/main/docs/README.md)
214
+ - [Getting Started](https://github.com/vladnoskv/i18ntk/blob/main/docs/getting-started.md)
215
+ - [API Reference](https://github.com/vladnoskv/i18ntk/blob/main/docs/api/API_REFERENCE.md)
216
+ - [Configuration Guide](https://github.com/vladnoskv/i18ntk/blob/main/docs/api/CONFIGURATION.md)
217
+ - [Runtime API Guide](https://github.com/vladnoskv/i18ntk/blob/main/docs/runtime.md)
218
+ - [Scanner Guide](https://github.com/vladnoskv/i18ntk/blob/main/docs/scanner-guide.md)
219
+ - [Environment Variables](https://github.com/vladnoskv/i18ntk/blob/main/docs/environment-variables.md)
220
+ - [Migration Guide v2.5.1](https://github.com/vladnoskv/i18ntk/blob/main/docs/migration-guide-v2.5.1.md)
221
+ - [Migration Guide v2.5.0](https://github.com/vladnoskv/i18ntk/blob/main/docs/migration-guide-v2.5.0.md)
222
+
223
+ ## Community
224
+
225
+ - [Contributing](CONTRIBUTING.md)
226
+ - [Code of Conduct](CODE_OF_CONDUCT.md)
227
+ - [Security Policy](SECURITY.md)
228
+ - [Funding](FUNDING.md)
183
229
 
184
230
  ## Code of Conduct
185
231
 
package/SECURITY.md ADDED
@@ -0,0 +1,52 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ The supported production line is `2.5.x`.
6
+
7
+ Versions earlier than `2.5.0` are not recommended for production use because later releases include package, filesystem, environment, and admin-auth hardening.
8
+
9
+ ## Security Model
10
+
11
+ i18ntk is a local developer CLI and runtime helper. It is expected to read and write project files, but it must do so with conservative path validation and without external runtime dependencies.
12
+
13
+ Security priorities:
14
+
15
+ - zero runtime dependencies
16
+ - no install-time lifecycle commands in the public package manifest
17
+ - no shipped local setup state, admin PINs, backups, reports, logs, credentials, or generated artifacts
18
+ - centralized environment-variable access through `utils/env-manager.js`
19
+ - path containment checks based on resolved paths and `path.relative()`
20
+ - timing-safe comparison for authentication hashes or tokens
21
+ - silent-by-default logging for production-like contexts
22
+
23
+ ## Published Package Controls
24
+
25
+ The npm package uses a stripped public manifest. It must not contain install-time lifecycle commands, dependency fields, local setup state, or development tooling.
26
+
27
+ ## Reporting Vulnerabilities
28
+
29
+ Do not report security vulnerabilities in public GitHub issues.
30
+
31
+ Use GitHub Security Advisories for private vulnerability reports. Include:
32
+
33
+ - affected version
34
+ - clear reproduction steps
35
+ - expected and actual behavior
36
+ - impact assessment
37
+ - proof of concept, if safe to share privately
38
+
39
+ ## Disclosure Process
40
+
41
+ Security reports are reviewed privately first. Confirmed issues should receive:
42
+
43
+ - a fix or mitigation
44
+ - a release note or migration note when user action is required
45
+ - an npm release when the fix affects published users
46
+
47
+ ## User Guidance
48
+
49
+ - Keep i18ntk updated to `2.5.0` or newer.
50
+ - Do not commit `.i18ntk-config`, admin PIN files, backup directories, generated reports, logs, npm credentials, or secret material.
51
+ - Run i18ntk only in project directories you trust.
52
+ - Review generated translation changes before committing them.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "i18ntk",
3
- "version": "2.5.0",
4
- "description": "🚀 The fastest internationalization toolkit with 97% performance boost! Zero-dependency, enterprise-grade internationalization for React, Vue, Angular, Python, Java, PHP & more. Features PIN protection, auto framework detection, 7+ UI languages, and comprehensive translation management. Perfect for startups to enterprises.",
3
+ "version": "2.5.1",
4
+ "description": "Zero-dependency internationalization toolkit for setup, scanning, analysis, validation, usage tracking, fixing, reporting, and runtime translation loading.",
5
5
  "keywords": [
6
6
  "i18n",
7
7
  "internationalization",
@@ -9,94 +9,22 @@
9
9
  "translation",
10
10
  "l10n",
11
11
  "multilingual",
12
- "globalization",
13
12
  "i18next",
14
13
  "react-i18next",
15
14
  "vue-i18n",
16
15
  "angular-i18n",
17
16
  "next-i18next",
18
- "nuxt-i18n",
19
- "svelte-i18n",
20
- "django",
21
- "flask",
22
- "fastapi",
23
- "laravel",
24
- "spring-boot",
25
17
  "nodejs",
26
18
  "javascript",
27
19
  "typescript",
28
20
  "cli",
29
21
  "command-line",
30
- "automation",
31
22
  "developer-tools",
32
- "productivity",
33
23
  "translation-management",
34
- "language-support",
35
24
  "framework-detection",
36
25
  "zero-dependency",
37
- "lightweight",
38
- "fast",
39
- "performance",
40
26
  "security",
41
- "enterprise",
42
- "devops",
43
- "ci-cd",
44
- "json",
45
- "yaml",
46
- "csv",
47
- "po",
48
- "xliff",
49
- "android",
50
- "ios",
51
- "react-native",
52
- "flutter",
53
- "expo",
54
- "electron",
55
- "desktop",
56
- "mobile",
57
- "web",
58
- "full-stack",
59
- "backend",
60
- "frontend",
61
- "api",
62
- "microservices",
63
- "serverless",
64
- "docker",
65
- "kubernetes",
66
- "cloud",
67
- "aws",
68
- "azure",
69
- "gcp",
70
- "saas",
71
- "paas",
72
- "open-source",
73
- "free",
74
- "npm",
75
- "package",
76
- "tool",
77
- "utility",
78
- "workflow",
79
- "efficiency",
80
- "best-practices",
81
- "standards",
82
- "compliance",
83
- "accessibility",
84
- "a11y",
85
- "seo",
86
- "marketing",
87
- "growth",
88
- "scale",
89
- "startup",
90
- "business",
91
- "professional",
92
- "expert",
93
- "advanced",
94
- "comprehensive",
95
- "complete",
96
- "all-in-one",
97
- "suite",
98
- "platform",
99
- "solution"
27
+ "json"
100
28
  ],
101
29
  "homepage": "https://github.com/vladnoskv/i18ntk#readme",
102
30
  "bugs": {
@@ -107,8 +35,8 @@
107
35
  "url": "git+https://github.com/vladnoskv/i18ntk.git"
108
36
  },
109
37
  "funding": {
110
- "type": "github",
111
- "url": "https://github.com/sponsors/vladnoskv"
38
+ "type": "individual",
39
+ "url": "https://www.charitynavigator.org/"
112
40
  },
113
41
  "license": "MIT",
114
42
  "author": {
@@ -150,10 +78,6 @@
150
78
  "i18ntk-scanner": "main/i18ntk-scanner.js",
151
79
  "i18ntk-backup": "main/i18ntk-backup.js"
152
80
  },
153
- "directories": {
154
- "doc": "docs",
155
- "test": "tests"
156
- },
157
81
  "files": [
158
82
  "main/i18ntk-analyze.js",
159
83
  "main/i18ntk-backup-class.js",
@@ -207,49 +131,13 @@
207
131
  "utils/version-utils.js",
208
132
  "utils/watch-locales.js",
209
133
  "LICENSE",
210
- "package.json",
211
- "README.md"
134
+ "README.md",
135
+ "CODE_OF_CONDUCT.md",
136
+ "CONTRIBUTING.md",
137
+ "FUNDING.md",
138
+ "SECURITY.md"
212
139
  ],
213
140
  "sideEffects": false,
214
- "scripts": {
215
- "i18ntk": "node main/manage/index.js",
216
- "i18ntk-setup": "node main/i18ntk-setup.js",
217
- "i18ntk-manage": "node main/manage/index.js",
218
- "i18ntk-init": "node main/i18ntk-init.js",
219
- "i18ntk-analyze": "node main/i18ntk-analyze.js",
220
- "i18ntk-validate": "node main/i18ntk-validate.js",
221
- "i18ntk-usage": "node main/i18ntk-usage.js",
222
- "i18ntk-complete": "node main/i18ntk-complete.js",
223
- "i18ntk-sizing": "node main/i18ntk-sizing.js",
224
- "i18ntk-summary": "node main/i18ntk-summary.js",
225
- "i18ntk-doctor": "node main/i18ntk-doctor.js",
226
- "i18ntk-fixer": "node main/i18ntk-fixer.js",
227
- "i18ntk-scanner": "node main/i18ntk-scanner.js",
228
- "i18ntk-backup": "node main/i18ntk-backup.js",
229
- "i18ntk-py": "node main/i18ntk-py.js",
230
- "i18ntk-js": "node main/i18ntk-js.js",
231
- "i18ntk-java": "node main/i18ntk-java.js",
232
- "i18ntk-php": "node main/i18ntk-php.js",
233
- "i18ntk-go": "node main/i18ntk-go.js",
234
- "start": "node main/manage/index.js",
235
- "security:check": "node utils/security-check-improved.js",
236
- "security:test": "node --test tests/security.test.js",
237
- "security:audit": "npm run security:check && npm run security:test",
238
- "test": "npm run security:test",
239
- "test:all": "npm run security:audit",
240
- "release:reset": "node scripts/reset-release-state.js",
241
- "prepublishOnly": "npm run security:audit",
242
- "prepare": "npm run security:check",
243
- "backup:create": "node main/i18ntk-backup.js create",
244
- "backup:restore": "node main/i18ntk-backup.js restore",
245
- "backup:list": "node main/i18ntk-backup.js list",
246
- "backup:verify": "node main/i18ntk-backup.js verify",
247
- "backup:cleanup": "node main/i18ntk-backup.js cleanup",
248
- "languages:select": "node settings/settings-cli.js",
249
- "languages:list": "node settings/settings-cli.js --list-languages",
250
- "languages:status": "node settings/settings-cli.js --language-status",
251
- "lint:locales": "node scripts/lint-locales.js"
252
- },
253
141
  "engines": {
254
142
  "node": ">=16.0.0",
255
143
  "npm": ">=8.0.0"
@@ -257,47 +145,5 @@
257
145
  "publishConfig": {
258
146
  "access": "public"
259
147
  },
260
- "preferGlobal": true,
261
- "versionInfo": {
262
- "version": "2.5.0",
263
- "releaseDate": "29/04/2026",
264
- "lastUpdated": "29/04/2026",
265
- "maintainer": "Vlad Noskov",
266
- "changelog": "./CHANGELOG.md",
267
- "documentation": "./README.md",
268
- "apiReference": "./docs/api/API_REFERENCE.md",
269
- "majorChanges": [
270
- "SECURITY: Centralized environment-variable access behind an explicit allowlist.",
271
- "SECURITY: Hardened path containment checks to reject sibling-prefix traversal cases.",
272
- "SECURITY: Added timing-safe admin PIN hash comparison and fixed expired-session cleanup.",
273
- "SECURITY: Expanded release security scanning to nested production source files.",
274
- "FIXER: Fixed translation fixer writes for absolute source directories and confirmed applied fixes persist.",
275
- "PACKAGING: Updated package and documentation metadata for the 2.5.0 release."
276
- ],
277
- "breakingChanges": [],
278
- "nextVersion": "2.5.1",
279
- "supportedNodeVersions": ">=16.0.0",
280
- "supportedFrameworks": {
281
- "react-i18next": ">=11.0.0",
282
- "vue-i18n": ">=9.0.0",
283
- "angular-i18n": ">=12.0.0",
284
- "next-i18next": ">=13.0.0",
285
- "nuxt-i18n": ">=8.0.0",
286
- "svelte-i18n": ">=3.0.0",
287
- "sveltekit-i18n": ">=2.0.0",
288
- "react-native-localize": ">=2.0.0",
289
- "expo-localization": ">=14.0.0",
290
- "ionic-angular": ">=6.0.0",
291
- "ember-intl": ">=5.0.0",
292
- "formatjs": ">=2.0.0",
293
- "i18next": ">=21.0.0",
294
- "django": ">=3.0.0",
295
- "flask-babel": ">=2.0.0",
296
- "fastapi": ">=0.70.0",
297
- "spring-boot": ">=2.5.0",
298
- "laravel": ">=8.0.0"
299
- },
300
- "supportPolicy": "Versions earlier than 2.5.0 may be unstable or insecure. Upgrade to 2.5.0 or newer."
301
- },
302
- "_comment": "This package is zero-dependency and uses only native Node.js modules"
148
+ "preferGlobal": true
303
149
  }
@@ -188,14 +188,60 @@ class AdminAuth {
188
188
  return crypto.timingSafeEqual(left, right);
189
189
  }
190
190
 
191
+ hasUsablePinConfig(config) {
192
+ return Boolean(
193
+ config &&
194
+ config.enabled === true &&
195
+ typeof config.pinHash === 'string' &&
196
+ config.pinHash.length > 0 &&
197
+ typeof config.salt === 'string' &&
198
+ config.salt.length > 0
199
+ );
200
+ }
201
+
202
+ logMissingPinConfig(context) {
203
+ SecurityUtils.logSecurityEvent(
204
+ 'admin_auth_config_invalid',
205
+ 'warning',
206
+ { message: `Admin PIN is required but not usable during ${context}` }
207
+ );
208
+ }
209
+
210
+ getSessionExpiryTime(session) {
211
+ if (!session || typeof session !== 'object') {
212
+ return NaN;
213
+ }
214
+
215
+ if (Number.isFinite(session.expiresAt)) {
216
+ return session.expiresAt;
217
+ }
218
+
219
+ if (typeof session.expiresAt === 'string') {
220
+ const parsedExpiresAt = Date.parse(session.expiresAt);
221
+ if (Number.isFinite(parsedExpiresAt)) {
222
+ return parsedExpiresAt;
223
+ }
224
+ }
225
+
226
+ if (typeof session.expires === 'string') {
227
+ const parsedExpires = Date.parse(session.expires);
228
+ if (Number.isFinite(parsedExpires)) {
229
+ return parsedExpires;
230
+ }
231
+ }
232
+
233
+ return NaN;
234
+ }
235
+
191
236
  /**
192
237
  * Verify PIN
193
238
  */
194
239
  async verifyPin(pin) {
195
240
  try {
196
241
  const config = await this.loadConfig();
197
- if (!config || !config.enabled) {
198
- return true; // No authentication required if not enabled
242
+ if (!this.hasUsablePinConfig(config)) {
243
+ this.logMissingPinConfig('PIN verification');
244
+ return false;
199
245
  }
200
246
 
201
247
  // Check for lockout
@@ -256,7 +302,7 @@ class AdminAuth {
256
302
  */
257
303
  async isPinConfigured() {
258
304
  const config = await this.loadConfig();
259
- return config && config.enabled && config.pinHash;
305
+ return this.hasUsablePinConfig(config);
260
306
  }
261
307
 
262
308
  /**
@@ -270,7 +316,10 @@ class AdminAuth {
270
316
  }
271
317
 
272
318
  const config = await this.loadConfig();
273
- return config && config.enabled;
319
+ if (!this.hasUsablePinConfig(config)) {
320
+ this.logMissingPinConfig('auth-required check');
321
+ }
322
+ return true;
274
323
  }
275
324
 
276
325
  /**
@@ -283,12 +332,6 @@ class AdminAuth {
283
332
  return false;
284
333
  }
285
334
 
286
- // Check if admin PIN is actually configured
287
- const config = await this.loadConfig();
288
- if (!config || !config.enabled || !config.pinHash) {
289
- return false; // Don't require PIN if admin PIN is not configured
290
- }
291
-
292
335
  // Check if PIN protection is enabled
293
336
  const pinProtection = globalSettings.security?.pinProtection;
294
337
  if (!pinProtection || !pinProtection.enabled) {
@@ -297,7 +340,16 @@ class AdminAuth {
297
340
 
298
341
  // Check if this specific script requires protection
299
342
  const protectedScripts = pinProtection.protectedScripts || {};
300
- return protectedScripts[scriptName] !== false; // Default to true if not explicitly set
343
+ if (protectedScripts[scriptName] === false) {
344
+ return false;
345
+ }
346
+
347
+ const config = await this.loadConfig();
348
+ if (!this.hasUsablePinConfig(config)) {
349
+ this.logMissingPinConfig(`script auth-required check for ${scriptName}`);
350
+ }
351
+
352
+ return true; // Default to true if not explicitly set
301
353
  }
302
354
 
303
355
  /**
@@ -336,11 +388,14 @@ class AdminAuth {
336
388
  sessionId = this.generateSessionId();
337
389
  }
338
390
 
391
+ const now = Date.now();
392
+ const expiresAt = now + this.sessionTimeout;
339
393
  const session = {
340
394
  id: sessionId,
341
- created: new Date().toISOString(),
342
- lastActivity: new Date().toISOString(),
343
- expires: new Date(Date.now() + this.sessionTimeout).toISOString()
395
+ created: new Date(now).toISOString(),
396
+ lastActivity: new Date(now).toISOString(),
397
+ expires: new Date(expiresAt).toISOString(),
398
+ expiresAt
344
399
  };
345
400
 
346
401
  this.activeSessions.set(sessionId, session);
@@ -373,10 +428,10 @@ class AdminAuth {
373
428
  return false;
374
429
  }
375
430
 
376
- const now = new Date();
377
- const expires = new Date(session.expires);
431
+ const now = Date.now();
432
+ const expiresAt = this.getSessionExpiryTime(session);
378
433
 
379
- if (now > expires) {
434
+ if (!Number.isFinite(expiresAt) || now > expiresAt) {
380
435
  this.activeSessions.delete(sessionId);
381
436
  this.clearCurrentSession();
382
437
  SecurityUtils.logSecurityEvent(
@@ -388,8 +443,10 @@ class AdminAuth {
388
443
  }
389
444
 
390
445
  // Update last activity
391
- session.lastActivity = now.toISOString();
392
- session.expires = new Date(now.getTime() + this.sessionTimeout).toISOString();
446
+ const nextExpiresAt = now + this.sessionTimeout;
447
+ session.lastActivity = new Date(now).toISOString();
448
+ session.expires = new Date(nextExpiresAt).toISOString();
449
+ session.expiresAt = nextExpiresAt;
393
450
  this.activeSessions.set(sessionId, session);
394
451
 
395
452
  return true;
@@ -571,9 +628,13 @@ class AdminAuth {
571
628
  let cleaned = 0;
572
629
 
573
630
  for (const [sessionId, session] of this.activeSessions.entries()) {
574
- const expiresAt = session.expiresAt || new Date(session.expires).getTime();
631
+ const expiresAt = this.getSessionExpiryTime(session);
575
632
  if (!Number.isFinite(expiresAt) || now > expiresAt) {
576
633
  this.activeSessions.delete(sessionId);
634
+ if (this.currentSession && this.currentSession.id === sessionId) {
635
+ this.currentSession = null;
636
+ this.sessionStartTime = null;
637
+ }
577
638
  cleaned++;
578
639
  }
579
640
  }