pumuki 6.3.322 → 6.3.324
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.
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
hasSwiftDummyAwaitUsage,
|
|
35
35
|
hasSwiftDispatchSemaphoreUsage,
|
|
36
36
|
collectSwiftLongAsyncOperationWithoutCancellationCheckLines,
|
|
37
|
+
collectSwiftAdHocLoggingLines,
|
|
37
38
|
hasSwiftAdHocLoggingUsage,
|
|
38
39
|
hasSwiftAlamofireUsage,
|
|
39
40
|
collectSwiftComposableArchitectureUsageLines,
|
|
@@ -171,8 +172,10 @@ import {
|
|
|
171
172
|
hasSwiftTestDoubleWithoutProtocolConformanceUsage,
|
|
172
173
|
hasSwiftSheetIsPresentedUsage,
|
|
173
174
|
hasSwiftScrollViewShowsIndicatorsUsage,
|
|
175
|
+
collectSwiftSensitiveLoggingLines,
|
|
174
176
|
hasSwiftSensitiveLoggingUsage,
|
|
175
177
|
hasSwiftSelfPrintChangesUsage,
|
|
178
|
+
collectSwiftSensitiveUserDefaultsStorageLines,
|
|
176
179
|
hasSwiftSensitiveUserDefaultsStorageUsage,
|
|
177
180
|
hasSwiftInsecureTransportUsage,
|
|
178
181
|
hasSwiftJSONSerializationUsage,
|
|
@@ -1942,9 +1945,13 @@ logger.error("Refresh failed \\(refreshToken)")
|
|
|
1942
1945
|
`;
|
|
1943
1946
|
|
|
1944
1947
|
assert.equal(hasSwiftAdHocLoggingUsage(adHoc), true);
|
|
1948
|
+
assert.deepEqual(collectSwiftAdHocLoggingLines(adHoc), [2, 3, 4, 5, 6]);
|
|
1945
1949
|
assert.equal(hasSwiftAdHocLoggingUsage(structuredSafe), false);
|
|
1950
|
+
assert.deepEqual(collectSwiftAdHocLoggingLines(structuredSafe), []);
|
|
1946
1951
|
assert.equal(hasSwiftSensitiveLoggingUsage(sensitive), true);
|
|
1952
|
+
assert.deepEqual(collectSwiftSensitiveLoggingLines(sensitive), [2, 3]);
|
|
1947
1953
|
assert.equal(hasSwiftSensitiveLoggingUsage(structuredSafe), false);
|
|
1954
|
+
assert.deepEqual(collectSwiftSensitiveLoggingLines(structuredSafe), []);
|
|
1948
1955
|
});
|
|
1949
1956
|
|
|
1950
1957
|
test('hasSwiftHardcodedSensitiveStringUsage detecta secretos hardcodeados en Swift productivo', () => {
|
|
@@ -2045,7 +2052,9 @@ let text = "UserDefaults.standard.set(accessToken, forKey: \\"accessToken\\")"
|
|
|
2045
2052
|
`;
|
|
2046
2053
|
|
|
2047
2054
|
assert.equal(hasSwiftSensitiveUserDefaultsStorageUsage(source), true);
|
|
2055
|
+
assert.deepEqual(collectSwiftSensitiveUserDefaultsStorageLines(source), [2, 3]);
|
|
2048
2056
|
assert.equal(hasSwiftSensitiveUserDefaultsStorageUsage(ignored), false);
|
|
2057
|
+
assert.deepEqual(collectSwiftSensitiveUserDefaultsStorageLines(ignored), []);
|
|
2049
2058
|
});
|
|
2050
2059
|
|
|
2051
2060
|
test('detector iOS de seguridad detecta transporte inseguro HTTP y ATS permisivo', () => {
|
|
@@ -1617,14 +1617,23 @@ export const collectSwiftMagicNumberLayoutLines = (source: string): readonly num
|
|
|
1617
1617
|
};
|
|
1618
1618
|
|
|
1619
1619
|
export const hasSwiftAdHocLoggingUsage = (source: string): boolean => {
|
|
1620
|
+
return collectSwiftAdHocLoggingLines(source).length > 0;
|
|
1621
|
+
};
|
|
1622
|
+
|
|
1623
|
+
export const collectSwiftAdHocLoggingLines = (source: string): readonly number[] => {
|
|
1620
1624
|
return collectSwiftRegexLines(
|
|
1621
1625
|
source,
|
|
1622
1626
|
/\b(?:print|debugPrint|dump|NSLog|os_log)\s*\(/
|
|
1623
|
-
)
|
|
1627
|
+
);
|
|
1624
1628
|
};
|
|
1625
1629
|
|
|
1626
1630
|
export const hasSwiftSensitiveLoggingUsage = (source: string): boolean => {
|
|
1627
|
-
return source
|
|
1631
|
+
return collectSwiftSensitiveLoggingLines(source).length > 0;
|
|
1632
|
+
};
|
|
1633
|
+
|
|
1634
|
+
export const collectSwiftSensitiveLoggingLines = (source: string): readonly number[] => {
|
|
1635
|
+
const lines: number[] = [];
|
|
1636
|
+
source.split(/\r?\n/).forEach((line, index) => {
|
|
1628
1637
|
const sanitized = stripSwiftLineForSemanticScan(line);
|
|
1629
1638
|
const lineWithoutComments = line.replace(/\/\/.*$/, '');
|
|
1630
1639
|
const hasLoggingCall =
|
|
@@ -1634,13 +1643,16 @@ export const hasSwiftSensitiveLoggingUsage = (source: string): boolean => {
|
|
|
1634
1643
|
);
|
|
1635
1644
|
|
|
1636
1645
|
if (!hasLoggingCall) {
|
|
1637
|
-
return
|
|
1646
|
+
return;
|
|
1638
1647
|
}
|
|
1639
1648
|
|
|
1640
|
-
|
|
1649
|
+
if (/\b(?:accessToken|refreshToken|authToken|token|password|secret|credential|authorization|email|userId)\b/i.test(
|
|
1641
1650
|
lineWithoutComments
|
|
1642
|
-
)
|
|
1651
|
+
)) {
|
|
1652
|
+
lines.push(index + 1);
|
|
1653
|
+
}
|
|
1643
1654
|
});
|
|
1655
|
+
return sortedUniqueLines(lines);
|
|
1644
1656
|
};
|
|
1645
1657
|
|
|
1646
1658
|
export const hasSwiftHardcodedSensitiveStringUsage = (source: string): boolean => {
|
|
@@ -1700,20 +1712,28 @@ export const hasSwiftJSONSerializationUsage = (source: string): boolean => {
|
|
|
1700
1712
|
};
|
|
1701
1713
|
|
|
1702
1714
|
export const hasSwiftSensitiveUserDefaultsStorageUsage = (source: string): boolean => {
|
|
1703
|
-
return source
|
|
1715
|
+
return collectSwiftSensitiveUserDefaultsStorageLines(source).length > 0;
|
|
1716
|
+
};
|
|
1717
|
+
|
|
1718
|
+
export const collectSwiftSensitiveUserDefaultsStorageLines = (source: string): readonly number[] => {
|
|
1719
|
+
const lines: number[] = [];
|
|
1720
|
+
source.split(/\r?\n/).forEach((line, index) => {
|
|
1704
1721
|
const sanitized = stripSwiftLineForSemanticScan(line);
|
|
1705
1722
|
const lineWithoutComments = line.replace(/\/\/.*$/, '');
|
|
1706
1723
|
const hasUserDefaultsWrite = /\bUserDefaults\s*\.\s*standard\s*\.\s*set\s*\(/.test(sanitized);
|
|
1707
1724
|
const hasAppStorage = /@\s*AppStorage\s*\(/.test(sanitized);
|
|
1708
1725
|
|
|
1709
1726
|
if (!hasUserDefaultsWrite && !hasAppStorage) {
|
|
1710
|
-
return
|
|
1727
|
+
return;
|
|
1711
1728
|
}
|
|
1712
1729
|
|
|
1713
|
-
|
|
1730
|
+
if (/\b(?:accessToken|refreshToken|authToken|token|password|secret|credential|authorization|bearer|apiKey|sessionId)\b/i.test(
|
|
1714
1731
|
lineWithoutComments
|
|
1715
|
-
)
|
|
1732
|
+
)) {
|
|
1733
|
+
lines.push(index + 1);
|
|
1734
|
+
}
|
|
1716
1735
|
});
|
|
1736
|
+
return sortedUniqueLines(lines);
|
|
1717
1737
|
};
|
|
1718
1738
|
|
|
1719
1739
|
export const hasSwiftInsecureTransportUsage = (source: string): boolean => {
|
|
@@ -804,13 +804,13 @@ const textDetectorRegistry: ReadonlyArray<TextDetectorRegistryEntry> = [
|
|
|
804
804
|
{ platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftNonIBOutletImplicitlyUnwrappedOptionalUsage, ruleId: 'heuristics.ios.safety.non-iboutlet-iuo.ast', code: 'HEURISTICS_IOS_SAFETY_NON_IBOUTLET_IUO_AST', message: 'AST heuristic detected an implicitly unwrapped optional outside IBOutlet wiring; explicit optionals or initialization guarantees remain the preferred baseline.' },
|
|
805
805
|
{ platform: 'ios', pathCheck: isIOSPresentationPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftMagicNumberLayoutUsage, locateLines: TextIOS.collectSwiftMagicNumberLayoutLines, primaryNode: (lines) => ({ kind: 'call', name: 'SwiftUI layout numeric literal', lines }), relatedNodes: (lines) => [{ kind: 'property', name: 'replacement: named metric constant or design token', lines }], why: 'Inline numeric layout literals hide design intent and make visual remediation dependent on scanning the whole view body.', impact: 'Pixel-perfect slices can be blocked without a concrete node unless the finding points to the exact spacing, frame or padding call to fix.', expected_fix: 'Move repeated or meaningful layout numbers into named constants or design tokens, or use relative layout APIs when the number encodes screen geometry.', ruleId: 'heuristics.ios.maintainability.magic-number-layout.ast', code: 'HEURISTICS_IOS_MAINTAINABILITY_MAGIC_NUMBER_LAYOUT_AST', message: 'AST heuristic detected SwiftUI layout magic numbers; named constants or design tokens remain the preferred baseline.' },
|
|
806
806
|
{ platform: 'ios', pathCheck: isIOSPresentationPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftUIKitManualFrameLayoutUsage, locateLines: TextIOS.collectSwiftUIKitManualFrameLayoutLines, primaryNode: (lines) => ({ kind: 'call', name: 'UIKit manual frame CGRect layout', lines }), relatedNodes: (lines) => [{ kind: 'call', name: 'replacement: Auto Layout constraints or SwiftUI relative layout', lines }], why: 'Manual UIKit frames hard-code geometry instead of using Auto Layout constraints or SwiftUI relative layout, so the layout cannot adapt reliably to devices, Dynamic Type or localization.', impact: 'Pixel-perfect work can regress across screens because fixed CGRect values bypass constraint solving and produce file-level ambiguity unless the exact frame node is reported.', expected_fix: 'Replace UIView(frame: CGRect(...)) and .frame = CGRect(...) layout with Auto Layout anchors/NSLayoutConstraint, UIStackView constraints, or SwiftUI relative layout where the screen is SwiftUI-first.', ruleId: 'heuristics.ios.uikit.manual-frame-layout.ast', code: 'HEURISTICS_IOS_UIKIT_MANUAL_FRAME_LAYOUT_AST', message: 'AST heuristic detected UIKit manual frame layout; use Auto Layout constraints or SwiftUI relative layout.' },
|
|
807
|
-
{ platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftAdHocLoggingUsage, ruleId: 'heuristics.ios.logging.adhoc-print.ast', code: 'HEURISTICS_IOS_LOGGING_ADHOC_PRINT_AST', message: 'AST heuristic detected
|
|
808
|
-
{ platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftSensitiveLoggingUsage, ruleId: 'heuristics.ios.logging.sensitive-data.ast', code: 'HEURISTICS_IOS_LOGGING_SENSITIVE_DATA_AST', message: 'AST heuristic detected sensitive data in an iOS logging call.' },
|
|
807
|
+
{ platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftAdHocLoggingUsage, locateLines: TextIOS.collectSwiftAdHocLoggingLines, primaryNode: (lines) => ({ kind: 'call', name: 'ad-hoc iOS logging call', lines }), relatedNodes: (lines) => [{ kind: 'call', name: 'replacement: structured logger with approved privacy level', lines }], why: 'Production iOS code must not use print/debugPrint/dump/NSLog/os_log ad hoc calls because they bypass repository logging policy and privacy controls.', impact: 'Ad-hoc logs create noisy diagnostics, can leak runtime state, and leave the developer without a clear logging boundary to audit or disable by environment.', expected_fix: 'Remove the print/debugPrint/dump/NSLog/os_log call or replace it with the repository-approved structured logger. If the log is still needed, use an explicit privacy level and avoid user data, tokens and request payloads.', ruleId: 'heuristics.ios.logging.adhoc-print.ast', code: 'HEURISTICS_IOS_LOGGING_ADHOC_PRINT_AST', message: 'AST heuristic detected ad-hoc logging in iOS production code.' },
|
|
808
|
+
{ platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftSensitiveLoggingUsage, locateLines: TextIOS.collectSwiftSensitiveLoggingLines, primaryNode: (lines) => ({ kind: 'call', name: 'logging call with sensitive data', lines }), relatedNodes: (lines) => [{ kind: 'call', name: 'replacement: redacted structured log without token/password/email/userId', lines }], why: 'Production logs must not include tokens, credentials, emails or user identifiers because logs are copied to diagnostics, crash reports and external observability stores.', impact: 'Sensitive values can leak outside the device or backend trust boundary and make incident response depend on scrubbing historical logs.', expected_fix: 'Remove the sensitive value from the log, log a redacted marker, or emit structured metadata that cannot expose token, password, email, authorization or userId values.', ruleId: 'heuristics.ios.logging.sensitive-data.ast', code: 'HEURISTICS_IOS_LOGGING_SENSITIVE_DATA_AST', message: 'AST heuristic detected sensitive data in an iOS logging call.' },
|
|
809
809
|
{ platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftHardcodedSensitiveStringUsage, locateLines: TextIOS.collectSwiftHardcodedSensitiveStringLines, primaryNode: (lines) => ({ kind: 'property', name: 'hardcoded sensitive Swift string', lines }), relatedNodes: (lines) => [{ kind: 'property', name: 'replacement: Keychain, secure config or environment-specific secret source', lines }], why: 'Sensitive strings assigned directly to token/password/secret properties create static production secrets and cannot be rotated safely.', impact: 'Credentials or identifiers can leak through source, binaries, logs or screenshots and block release until the concrete assignment is removed.', expected_fix: 'Read sensitive values from Keychain, secure configuration, injected environment or a repository-approved secret provider. Keep user-facing copy in localization assets, not sensitive variables.', ruleId: 'heuristics.ios.security.hardcoded-sensitive-string.ast', code: 'HEURISTICS_IOS_SECURITY_HARDCODED_SENSITIVE_STRING_AST', message: 'AST heuristic detected hardcoded sensitive Swift string; Keychain, secure config or environment-specific secrets remain the preferred baseline.' },
|
|
810
810
|
{ platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftUnlocalizedDateFormatterUsage, ruleId: 'heuristics.ios.localization.unlocalized-dateformatter.ast', code: 'HEURISTICS_IOS_LOCALIZATION_UNLOCALIZED_DATEFORMATTER_AST', message: 'AST heuristic detected DateFormatter dateFormat usage without an explicit locale.' },
|
|
811
811
|
{ platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftAlamofireUsage, ruleId: 'heuristics.ios.networking.alamofire.ast', code: 'HEURISTICS_IOS_NETWORKING_ALAMOFIRE_AST', message: 'AST heuristic detected Alamofire usage in iOS production code; URLSession remains the preferred baseline for new code.' },
|
|
812
812
|
{ platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftJSONSerializationUsage, ruleId: 'heuristics.ios.json.jsonserialization.ast', code: 'HEURISTICS_IOS_JSON_JSONSERIALIZATION_AST', message: 'AST heuristic detected JSONSerialization usage in iOS production code; Codable remains the preferred baseline for new code.' },
|
|
813
|
-
{ platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftSensitiveUserDefaultsStorageUsage, ruleId: 'heuristics.ios.security.userdefaults-sensitive-data.ast', code: 'HEURISTICS_IOS_SECURITY_USERDEFAULTS_SENSITIVE_DATA_AST', message: 'AST heuristic detected sensitive data stored in UserDefaults/AppStorage; native Keychain remains the preferred baseline for secrets.' },
|
|
813
|
+
{ platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftSensitiveUserDefaultsStorageUsage, locateLines: TextIOS.collectSwiftSensitiveUserDefaultsStorageLines, primaryNode: (lines) => ({ kind: 'call', name: 'sensitive UserDefaults/AppStorage storage', lines }), relatedNodes: (lines) => [{ kind: 'call', name: 'replacement: native Keychain or secure secret store', lines }], why: 'Tokens, passwords, credentials and session identifiers must not be stored in UserDefaults or AppStorage because those stores are not the approved secret boundary.', impact: 'Secrets persisted in UserDefaults/AppStorage can leak through backups, diagnostics or simple local inspection, and the gate needs the exact storage node to avoid whole-file remediation.', expected_fix: 'Move tokens, passwords, credentials and session identifiers to native Keychain or the repository-approved secure storage adapter. Keep UserDefaults/AppStorage only for non-sensitive preferences.', ruleId: 'heuristics.ios.security.userdefaults-sensitive-data.ast', code: 'HEURISTICS_IOS_SECURITY_USERDEFAULTS_SENSITIVE_DATA_AST', message: 'AST heuristic detected sensitive data stored in UserDefaults/AppStorage; native Keychain remains the preferred baseline for secrets.' },
|
|
814
814
|
{ platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftInsecureTransportUsage, ruleId: 'heuristics.ios.security.insecure-transport.ast', code: 'HEURISTICS_IOS_SECURITY_INSECURE_TRANSPORT_AST', message: 'AST heuristic detected insecure HTTP transport in iOS production code; HTTPS and ATS remain the preferred baseline.' },
|
|
815
815
|
{ platform: 'ios', pathCheck: isIOSInfoPlistPath, excludePaths: [], detect: TextIOS.hasSwiftInsecureTransportUsage, ruleId: 'heuristics.ios.security.insecure-transport.ast', code: 'HEURISTICS_IOS_SECURITY_INSECURE_TRANSPORT_AST', message: 'AST heuristic detected permissive App Transport Security configuration; HTTPS and ATS remain the preferred baseline.' },
|
|
816
816
|
{ platform: 'ios', pathCheck: isIOSLocalizableStringsPath, excludePaths: [], detect: detectsTrackedFilePresence, ruleId: 'heuristics.ios.localization.localizable-strings.ast', code: 'HEURISTICS_IOS_LOCALIZATION_LOCALIZABLE_STRINGS_AST', message: 'AST heuristic detected Localizable.strings usage; String Catalogs (.xcstrings) remain the preferred baseline for new localization work.' },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pumuki",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.324",
|
|
4
4
|
"description": "Enterprise-grade AST Intelligence System with multi-platform support (iOS, Android, Backend, Frontend) and Feature-First + DDD + Clean Architecture enforcement. Includes dynamic violations API for intelligent querying.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|