Repository: gohugoio/hugo (language: go)

Issue:
hugo snap is unable to deploy to AWS/GCP due to snap confinement misconfiguration
### What version of Hugo are you using (`hugo version`)?

<pre>
$ hugo version
hugo v0.115.1-857374e69358f788bd31ddc55255c5c8e3dcfd80+extended linux/amd64 BuildDate=2023-07-03T17:28:25Z VendorInfo=snap:0.115.1
</pre>

### Does this issue reproduce with the latest release? 

Yes  - the HEAD snapcraft.yaml contains the issue 

### Issue Description

The third assumption in the [deploy documentation](https://gohugo.io/hosting-and-deployment/hugo-deploy/#assumptions) is impossible to cleanly fulfil when using hugo installed from snap (one of the supported mechanisms listed at https://gohugo.io/installation/linux/#snap)

Specifically, the listed cloud authentication methods (e.g. `gcloud auth login`, `aws configure`, etc) all rely on credential files located in hidden directories within $HOME which are not accessible to the hugo snap due to the strict confinement policy applied at snapcraft.yaml line 12. 

While specific plugs to access the gitconfig within the `.git` directory are provided, no similar plug configuration is provided for the cloud provider directories making `hugo deploy` essentially impossible to use as per the documented instructions.

### Steps to reproduce

1. Create a hugo site with an s3 deployment configuration
2. Configure AWS credentials via the documented `aws configure` command
3. run `hugo deploy`

### Expected behaviour

Hugo would pick up the configured credentials (via gocloud's default behaviour) from `.aws/credentials` and deploy the site. 

### Observed behaviour

Hugo fails to deploy the site with an obscure and confusing error
```
matt@argon:~/web/hugo$ hugo deploy
Deploying to target "s3" (s3://test-bucket?region=ap-southeast-2)
Error: blob (code=Unknown): NoCredentialProviders: no valid providers in chain. Deprecated.
	For verbose messaging see aws.Config.CredentialsChainVerboseErrors
```

### Suggested Fixes

1. Hugo needs to provide a snap configuration that works with the documented deployment mechanisms, so access to `~/.gcloud`, `~/.aws` and whatever Azure uses needs to be configured in snapcraft.yaml
2. The snap package documentation at https://gohugo.io/installation/linux/ could also be a bit more verbose about the implications of strict confinement - specifically the limitations on accessing dotfiles other than those explicitly allowed, while the limitations on removeable media are specifically noted, the nuance of snaps `home` vs `personal-files` interfaces is unlikely to be obvious or apparent to even a diligent user who clicks through to the confinement link (and even if they do, this is a developer oriented document, not an end-user oriented document!).

Add structured logging



Discussion / hints:

Fix patch:
diff --git a/snap/local/logo.png b/snap/local/logo.png
new file mode 100644
index 00000000000..76d463600e7
Binary files /dev/null and b/snap/local/logo.png differ
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index ab3f326aa9a..2c5fa7dc06c 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -1,16 +1,33 @@
 name: hugo
-issues: https://github.com/gohugoio/hugo/issues
-source-code: https://github.com/gohugoio/hugo.git
-website: https://gohugo.io/
-summary: Fast and Flexible Static Site Generator
-description: |
-  Hugo is a static HTML and CSS website generator written in Go. It is
-  optimized for speed, easy use and configurability. Hugo takes a directory
-  with content and templates and renders them into a full HTML website.
-license: "Apache-2.0"
 base: core20
 confinement: strict
 adopt-info: hugo
+title: Hugo
+icon: snap/local/logo.png
+summary: Fast and Flexible Static Site Generator
+description: |
+  Hugo is a static site generator written in Go, optimized for speed and
+  designed for flexibility. With its advanced templating system and fast asset
+  pipelines, Hugo renders a complete site in seconds, often less.
+
+  Due to its flexible framework, multilingual support, and powerful taxonomy
+  system, Hugo is widely used to create:
+
+  * Corporate, government, nonprofit, education, news, event, and project sites
+  * Documentation sites
+  * Image portfolios
+  * Landing pages
+  * Business, professional, and personal blogs
+  * Resumes and CVs
+
+  Use Hugo's embedded web server during development to instantly see changes to
+  content, structure, behavior, and presentation. Then deploy the site to your
+  host, or push changes to your Git provider for automated builds and
+  deployment.
+issues: https://github.com/gohugoio/hugo/issues
+license: "Apache-2.0"
+source-code: https://github.com/gohugoio/hugo.git
+website: https://gohugo.io/
 
 package-repositories:
   - type: apt
@@ -28,8 +45,20 @@ plugs:
     interface: personal-files
     read:
       - $HOME/.gitconfig
-      - $HOME/.config/git       # Allows $HOME/.config/git/config and more
-      - $HOME/.gitconfig.local  # See #10337
+      - $HOME/.config/git
+      - $HOME/.gitconfig.local
+  dot-aws:
+    interface: personal-files
+    read:
+      - $HOME/.aws
+  dot-azure:
+    interface: personal-files
+    read:
+      - $HOME/.azure
+  dot-config-gcloud:
+    interface: personal-files
+    read:
+      - $HOME/.config/gcloud
 
 environment:
   HOME: $SNAP_REAL_HOME
@@ -44,14 +73,14 @@ environment:
   # HUGO_SECURITY_EXEC_OSENV
   #
   # Default value:
-  #   (?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\w+)$
+  #   (?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\w+|(XDG_CONFIG_)?HOME|USERPROFILE|SSH_AUTH_SOCK|DISPLAY|LANG)$
   # Bundled applications require additional access:
   #   git:          GIT_EXEC_PATH and LD_LIBRARY_PATH
   #   npx:          npm_config_{cache,init_module,userconfig}
   #   pandoc:       pandoc_datadir
   #   rst2html:     PYTHONHOME and SNAP
   #   asciidoctor:  RUBYLIB
-  HUGO_SECURITY_EXEC_OSENV: (?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\w+|GIT_EXEC_PATH|LD_LIBRARY_PATH|npm_config_(cache|init_module|userconfig)|pandoc_datadir|PYTHONHOME|SNAP|RUBYLIB)$
+  HUGO_SECURITY_EXEC_OSENV: (?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\w+|(XDG_CONFIG_)?HOME|USERPROFILE|SSH_AUTH_SOCK|DISPLAY|LANG|GIT_EXEC_PATH|LD_LIBRARY_PATH|npm_config_(cache|init_module|userconfig)|pandoc_datadir|PYTHONHOME|SNAP|RUBYLIB)$
 
 apps:
   hugo:
@@ -63,6 +92,9 @@ apps:
       - removable-media
       - etc-gitconfig
       - gitconfig
+      - dot-aws
+      - dot-azure
+      - dot-config-gcloud
 
 parts:
   git:


Test patch: