SOLUTION: Pass each -X flag as a separate -ldflags argument.
This isolates each credential value so special characters
in one value don't affect parsing of other values.
Tested successfully with passwords containing:
- Spaces AND quotes: "Pass \quote\ space"
- Hash character: Password#123
- All special characters: P@ss#123 \quote\ space$
This approach handles ALL special characters safely.
Use heredoc to write ldflags to temp file. This allows
passwords containing # (hash) characters to be embedded correctly.
Known limitation: Passwords with both spaces AND quotes together
may still fail. Most other special characters work fine.
The build script was using complex escaping mechanisms that were causing
linker failures with certain passwords.
Simplified to use the same approach as other Nextcloud tools:
- No temp files
- No escaping functions
- Direct variable substitution in ldflags
This matches the pattern used for nextcloud-client, nextcloud-contacts,
and nextcloud-calendar.
Known limitation: Passwords containing spaces, double quotes,
or $ characters may fail to build. Users with such passwords
should use a simpler password or manually modify the build command.
The build was failing with Go linker errors because special characters in
user-provided credentials (especially passwords) were not being properly escaped.
Added escape_ldflag() function to handle:
- Backslashes
- Double quotes
- Spaces
This ensures that any user input (including passwords with special characters)
is safely passed to Go's linker without breaking the build command.
Current compile-time approach is correct for bootstrap architecture:
- Credentials only used during build
- Agent never sees them after
- No binary distribution
- Strings extraction is irrelevant threat
Obfuscation was over-engineering for this use case.
- build-obfuscated.sh: XOR encryption with random 256-bit key
- obfuscation/obfuscation.go: Runtime de-obfuscation package
- OBFUSCATION.md: Documentation and security comparison
- Prevents casual extraction with 'strings' command
- Medium security: Good for personal use, env vars for production
- TEST-PLAN.md: 38 detailed tests covering all features
- quick-test.sh: Automated quick test for basic functionality
- Tests include IMAP, SMTP, attachments, SSL/TLS, error handling
- CLI tools: nextcloud-client, nextcloud-contacts, nextcloud-calendar, nextcloud-mail
- Build script with compile-time credentials
- Skills for all four tools
- Full documentation and examples
- Email tool supports IMAP/SMTP with attachment download
- SSL/TLS support with optional certificate validation